Functionality
Metanorma plugin that allows you to access lutaml objects from a Metanorma document
Installation
$ gem install metanorma-plugin-lutaml
Usage, lutaml macro
Given example.exp file with the content:
SCHEMA test_schema 'test';
(* Need select elements for measure_value *)
REFERENCE FROM measure_schema
(measure_value);
TYPE my_type1 = EXTENSIBLE SELECT;
END_TYPE;
TYPE my_type2 = EXTENSIBLE ENUMERATION;
END_TYPE;
TYPE my_type3 = EXTENSIBLE ENUMERATION;
END_TYPE;
TYPE my_type4 = EXTENSIBLE ENUMERATION;
END_TYPE;
TYPE my_type5 = EXTENSIBLE ENUMERATION;
END_TYPE;
END_SCHEMA;
And the lutaml macro block:
[lutaml,example.exp,my_context]
----
{% for schema in my_context.schemas %}
== {{schema.id}}
{% for entity in schema.entities %}
=== {{entity.id}}
{% endfor %}
{% endfor %}
----
Will produce this output:
== test_schema
=== my_type1
=== my_type2
=== my_type3
=== my_type4
=== my_type5
This macro also supports .lutaml files.
Usage, lutaml_uml_attributes_table macro
This macro allows to quickly render datamodel attributes/values tables. Given example.lutaml file with the content:
diagram MyView {
title "my diagram"
enum AddressClassProfile {
imlicistAttributeProfile: CharacterString [0..1] {
definition
this is multiline with `ascidoc`
end definition
}
}
class AttributeProfile {
+addressClassProfile: CharacterString [0..1]
imlicistAttributeProfile: CharacterString [0..1] {
definition this is attribute definition
}
}
}
And the lutaml_uml_attributes_table macro:
[lutaml_uml_attributes_table, example.lutaml, AttributeProfile]
Will produce this output:
=== AttributeProfile
.AttributeProfile attributes
|===
|Name |Definition |Mandatory/ Optional/ Conditional |Max Occur |Data Type
|addressClassProfile |TODO: enum 's definition |M |1 | `CharacterString`
|imlicistAttributeProfile |this is attribute definition with multiply lines |M |1 | `CharacterString`
|===
In case of "enumeration"(AddressClassProfile) entity:
[lutaml_uml_attributes_table, example.lutaml, AddressClassProfile]
Will produce this output:
=== AddressClassProfile
.AddressClassProfile values
|===
|Name |Definition
|imlicistAttributeProfile |this is multiline with `ascidoc`
|===