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 %}
----
Where:
-
content within the block is called the “template”;
-
{example.exp}
is the location of the exp schema file that contains data to be loaded. Location of the file is computed relative to the source directory that[lutaml]
is used (e.g., if[lutaml,example.exp,my_context]
is invoked in an.adoc
file located at/foo/bar/doc.adoc
, the data file is expected to be found at/foo/bar/example.exp
); -
{my_context}
is the name where the EXPRESS Repository read from the .exp file can be accessed with. Context object is a serialized Expressir::Model::Repository object with all variable names available. See Expressir docs for reference.{my_context}
hasschemas
method to access Expressir schemas
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`
|===