metanorma-plugin-lutaml 0.4.6 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +155 -74
  3. data/lib/metanorma/plugin/lutaml/liquid/custom_filters.rb +9 -0
  4. data/lib/metanorma/plugin/lutaml/liquid_templates/_diagrams_block.liquid +1 -1
  5. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages.liquid +113 -7
  6. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_class.liquid +12 -12
  7. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_data_dictionary.liquid +235 -63
  8. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_data_dictionary_class.liquid +73 -0
  9. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_data_dictionary_classes.liquid +1 -41
  10. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_data_type.liquid +9 -10
  11. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_entity_list.liquid +134 -36
  12. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_entity_list_class.liquid +19 -0
  13. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_entity_list_classes.liquid +11 -0
  14. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_enum.liquid +11 -11
  15. data/lib/metanorma/plugin/lutaml/liquid_templates/test.rb +1 -0
  16. data/lib/metanorma/plugin/lutaml/lutaml_preprocessor.rb +1 -1
  17. data/lib/metanorma/plugin/lutaml/lutaml_table_inline_macro.rb +25 -0
  18. data/lib/metanorma/plugin/lutaml/lutaml_uml_attributes_table_preprocessor.rb +1 -1
  19. data/lib/metanorma/plugin/lutaml/lutaml_uml_datamodel_description_preprocessor.rb +93 -19
  20. data/lib/metanorma/plugin/lutaml/utils.rb +1 -1
  21. data/lib/metanorma/plugin/lutaml/version.rb +1 -1
  22. data/lib/metanorma-plugin-lutaml.rb +1 -0
  23. metadata +7 -2
@@ -8,6 +8,15 @@ module Metanorma
8
8
  def html2adoc(input)
9
9
  ReverseAdoc.convert(input)
10
10
  end
11
+
12
+ def interpolate(input)
13
+ sub = ::Liquid::Template.parse(input)
14
+ sub.render(@context)
15
+ end
16
+
17
+ def identify(input)
18
+ input.split(/(?=[A-Z])/).map(&:downcase).join('-')
19
+ end
11
20
  end
12
21
  end
13
22
  end
@@ -3,7 +3,7 @@
3
3
  {% for diagram in package.diagrams %}
4
4
  [[figure-{{ diagram.xmi_id }}]]
5
5
  .{{ diagram.name }}
6
- image::{{ image_base_path }}/{{ diagram.xmi_id }}.png[]
6
+ image::{{ image_base_path }}/{{ diagram.xmi_id }}.{{ format | default: 'png' }}[]
7
7
 
8
8
  {% if diagram.definition %}
9
9
  {{ diagram.definition | html2adoc }}
@@ -2,7 +2,14 @@
2
2
  {% assign package_name = package.name | downcase | replace: ":", "" | replace: " ", "_" %}
3
3
  {% if additional_context.before and additional_context.before.size > 0 %}
4
4
  {% for before in additional_context.before %}
5
+ {% if before.text %}
6
+
7
+ {% if before.liquid %}
8
+ {{ before.text | interpolate }}
9
+ {% else %}
5
10
  {{ before.text }}
11
+ {% endif %}
12
+ {% endif %}
6
13
  {% endfor %}
7
14
  {% endif %}
8
15
  {% assign is_package_spare = package.name | slice: 0,5 %}
@@ -11,24 +18,67 @@
11
18
  {% endif %}
12
19
 
13
20
  {% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}{{equalsigns}} {{ package.name }} package
21
+ [[section-{{ package.xmi_id }}]]
14
22
  {{equalsigns}}= {{ package.name }} overview
15
23
 
24
+ {% if additional_context.all_macros.size > 0 %}
25
+ {% assign sorted_all_macros = additional_context.all_macros | where: "position", "before" | sort: 'index' %}
26
+ {% for block in sorted_all_macros %}
27
+ {% case block.type %}
28
+ {% when 'include_block' %}
29
+ {% unless block.package and block.package != package.name %}
30
+ {% capture block_filename %}{{ block.base_path }}{{ package_name }}{% endcapture %}
31
+ {% capture block_content %}{% include block_filename %}{% endcapture %}
32
+ {% unless block_content contains "Liquid error" %}
33
+ {% if block.text %}
34
+
35
+ {% if block.liquid %}
36
+ {{ block.text | interpolate }}
37
+ {% else %}
38
+ {{ block.text }}
39
+ {% endif %}
40
+ {% endif %}
41
+
42
+ {{ block_content }}
43
+ {% endunless %}
44
+ {% endunless %}
45
+ {% when 'package_text' %}
46
+ {% unless block.package and block.package != package.name %}
47
+
48
+ {% if block.liquid %}
49
+ {{ block.text | interpolate }}
50
+ {% else %}
51
+ {{ block.text }}
52
+ {% endif %}
53
+ {% endunless %}
54
+ {% else %}
55
+ {% endcase %}
56
+ {% endfor %}
57
+ {% endif %}
58
+
16
59
  {% assign before_package_key = 'before;' | append: package.name %}
17
60
  {% if additional_context[before_package_key] and additional_context[before_package_key].size > 0 %}
18
61
  {% for before in additional_context[before_package_key] %}
62
+ {% if before.text %}
63
+
64
+ {% if before.liquid %}
65
+ {{ before.text | interpolate }}
66
+ {% else %}
19
67
  {{ before.text }}
68
+ {% endif %}
69
+ {% endif %}
20
70
  {% endfor %}
21
71
  {% endif %}
22
72
  {% if additional_context.diagram_include_block %}
23
73
  {% for diagram_include_block in additional_context.diagram_include_block %}
24
- {% include "diagrams_block", package_name: package_name, image_base_path: diagram_include_block.base_path, text: diagram_include_block.text %}
74
+ {% include "diagrams_block", package_name: package_name, image_base_path: diagram_include_block.base_path, text: diagram_include_block.text, format: diagram_include_block.format %}
25
75
  {% endfor %}
26
76
  {% endif %}
27
77
 
28
78
  {% if package.packages.size > 0 %}The {{ package.name }} package is organized into
29
79
  {{ package.packages.size }} packages{% assign modules_nested_size = 0 %}{% for module in package.packages %}{% assign modules_nested_size = modules_nested_size | plus: module.packages.size %}{% endfor %}{% if modules_nested_size > 0 %} with {{modules_nested_size}} modules{% endif %}:
30
80
  {% endif %}
31
- [arabic]
81
+
32
82
  {% for module in package.packages %}
33
83
  {% if module.packages.length > 0 %}
34
84
  . {{ module.name }} package comprises:
@@ -44,14 +94,14 @@
44
94
 
45
95
  {{equalsigns}}= Defining tables
46
96
 
47
- [arabic]
48
97
  {% for klass in package.classes %}
49
98
  {% assign is_klass_spare = klass.name | slice: 0,5 %}
50
99
  {% if is_klass_spare == 'old: ' %}{% continue %}
51
100
  {% elsif is_klass_spare == 'Spare' %}{% continue %}
52
101
  {% endif %}
53
102
  {% assign klass_name = klass.name | downcase | replace: ':', '' | replace: ' ', '_' %}
54
- .<<tab-P-{{ package_name }}-C-{{ klass_name }}>> -- Elements of {{ package.name }}::{{ klass.name }}
103
+ [[section-{{ klass.xmi_id }}]]
104
+ .Elements of &#8220;{{ package.name }}::{{ klass.name }}&#8221; ({{ klass.stereotype }})
55
105
 
56
106
  {% endfor %}
57
107
  {% for enum in package.enums %}
@@ -60,7 +110,8 @@
60
110
  {% elsif is_enum_spare == 'Spare' %}{% continue %}
61
111
  {% endif %}
62
112
  {% assign enum_name = enum.name | downcase | replace: ':', '' | replace: ' ', '_' %}
63
- .<<tab-P-{{ package_name }}-E-{{ enum_name }}>> -- Elements of {{ package.name }}::{{ enum.name }}
113
+ [[section-{{ enum.xmi_id }}]]
114
+ .Elements of &#8220;{{ package.name }}::{{ enum.name }}&#8221; ({{ enum.stereotype }})
64
115
 
65
116
  {% endfor %}
66
117
  {% for data_type in package.data_types %}
@@ -69,7 +120,8 @@
69
120
  {% elsif is_data_type_spare == 'Spare' %}{% continue %}
70
121
  {% endif %}
71
122
  {% assign data_type_name = data_type.name | downcase | replace: ':', '' | replace: ' ', '_' %}
72
- .<<tab-P-{{ package_name }}-DT-{{ data_type_name }}>> -- Elements of {{ package.name }}::{{ data_type.name }}
123
+ [[section-{{ data_type.xmi_id }}]]
124
+ .Elements of &#8220;{{ package.name }}::{{ data_type.name }}&#8221; ({{ data_type.stereotype }})
73
125
 
74
126
  {% endfor %}
75
127
 
@@ -107,18 +159,65 @@
107
159
  {% capture block_content %}{% include block_filename %}{% endcapture %}
108
160
  {% unless block_content contains "Liquid error" %}
109
161
  {% if block.text %}
162
+
163
+ {% if block.liquid %}
164
+ {{ block.text | interpolate }}
165
+ {% else %}
166
+ {{ block.text }}
167
+ {% endif %}
168
+ {% endif %}
169
+ {{ block_content }}
170
+ {% endunless %}
171
+ {% endfor %}
172
+ {% endif %}
173
+
174
+ {% if additional_context.all_macros.size > 0 %}
175
+ {% assign sorted_all_macros = additional_context.all_macros | where: "position", "after" | sort: 'index' %}
176
+ {% for block in sorted_all_macros %}
177
+ {% case block.type %}
178
+ {% when 'include_block' %}
179
+ {% unless block.package and block.package != package.name %}
180
+ {% capture block_filename %}{{ block.base_path }}{{ package_name }}{% endcapture %}
181
+ {% capture block_content %}{% include block_filename %}{% endcapture %}
182
+ {% unless block_content contains "Liquid error" %}
183
+ {% if block.text %}
184
+
185
+ {% if block.liquid %}
186
+ {{ block.text | interpolate }}
187
+ {% else %}
110
188
  {{ block.text }}
111
189
  {% endif %}
190
+ {% endif %}
191
+
112
192
  {{ block_content }}
113
193
  {% endunless %}
194
+ {% endunless %}
195
+ {% when 'package_text' %}
196
+ {% unless block.package and block.package != package.name %}
197
+
198
+ {% if block.liquid %}
199
+ {{ block.text | interpolate }}
200
+ {% else %}
201
+ {{ block.text }}
202
+ {% endif %}
203
+ {% endunless %}
204
+ {% else %}
205
+ {% endcase %}
114
206
  {% endfor %}
115
207
  {% endif %}
116
208
 
117
209
  {% assign after_package_key = 'after;' | append: package.name %}
118
210
  {% if additional_context[after_package_key] %}
119
- {{equalsigns}}= Additional Information
211
+ {{equalsigns}}= Additional information
120
212
  {% for after in additional_context[after_package_key] %}
213
+ {% if after.text %}
214
+
215
+ {% if after.liquid %}
216
+ {{ after.text | interpolate }}
217
+ {% else %}
121
218
  {{ after.text }}
219
+ {% endif %}
220
+ {% endif %}
122
221
  {% endfor %}
123
222
  {% endif %}
124
223
  {% if package.packages.size > 0 and render_nested_packages %}
@@ -128,6 +227,13 @@
128
227
 
129
228
  {% if additional_context.after and additional_context.after.size > 0 %}
130
229
  {% for after in additional_context.after %}
230
+ {% if after.text %}
231
+
232
+ {% if after.liquid %}
233
+ {{ after.text | interpolate }}
234
+ {% else %}
131
235
  {{ after.text }}
236
+ {% endif %}
237
+ {% endif %}
132
238
  {% endfor %}
133
239
  {% endif %}
@@ -3,8 +3,8 @@
3
3
  {% elsif is_klass_spare == 'Spare' %}{% continue %}
4
4
  {% endif %}
5
5
  {% assign klass_name = klass.name | downcase | replace: ':', '' | replace: ' ', '_' %}
6
- [[tab-P-{{ package_name }}-C-{{ klass_name }}]]
7
- .Elements of {{ package.name }}::{{ klass.name }}
6
+ [[section-{{ klass.xmi_id }}]]
7
+ .Elements of &#8220;{{ package.name }}::{{ klass.name }}&#8221; ({{ klass.stereotype }})
8
8
  [width="100%",cols="a,a,a,a,a,a,a,a"]
9
9
  |===
10
10
 
@@ -24,14 +24,14 @@ h|Inheritance from: 7+| {{ inherited | map: 'member_end' | join: ", " }}
24
24
  h|Generalization of: 7+| {{ generalizations | map: 'member_end' | join: ", " }}
25
25
  {% endif %}
26
26
 
27
- h|Abstract: 7+| {{ klass.is_abstract }}
27
+ h|Abstract: 7+| {% if klass.is_abstract %}True{% else %}False{% endif %}
28
28
  {% assign aggregations = klass.associations | where: "member_end_type", "aggregation" %}
29
29
  {% if aggregations.size > 0 %}
30
30
  .{{aggregations.size | plus: 1}}+h|Associations:
31
- 4+|_Association with:_
32
- |_Obligation_
31
+ 4+| _Association with_
32
+ | _Obligation_
33
33
  | _Maximum occurrence_
34
- |_Provides:_
34
+ | _Provides_
35
35
 
36
36
  {% for assoc in aggregations %}
37
37
  4+| {{assoc.member_end}}
@@ -41,9 +41,9 @@ h|Abstract: 7+| {{ klass.is_abstract }}
41
41
 
42
42
  {% endfor %}
43
43
  {% else %}
44
-
45
- .1+h|Associations: 7+| (none)
44
+ h| Associations: 7+| (none)
46
45
  {% endif %}
46
+
47
47
  {% if klass.attributes.size > 0 %}
48
48
  .{{klass.attributes.size | plus: 1}}+h|Public attributes:
49
49
  | _Name_
@@ -63,14 +63,14 @@ h|Abstract: 7+| {{ klass.is_abstract }}
63
63
 
64
64
  {% endfor %}
65
65
  {% else %}
66
- .1+h|Public attributes:
66
+ h| Public attributes:
67
67
  7+| (none)
68
68
  {% endif %}
69
69
 
70
70
  {% if klass.constraints.size > 0 %}
71
- .{{ klass.constraints.size }}+|*Constraints:*
72
- {% for constr in klass.constraints %}
73
- 7+| `{{ constr.body }}`
71
+ .{{ klass.constraints.size }}+h| Constraints:
72
+ {% for constraint in klass.constraints %}
73
+ 7+| `{{ constraint.body }}`: `{{ constraint.definition | replace: '|', '\|' }}`
74
74
 
75
75
  {% endfor %}
76
76
  {% else %}
@@ -1,134 +1,250 @@
1
1
  {% for package in context.packages %}
2
2
  {% assign package_name = package.name | downcase | replace: ":", "" | replace: " ", "_" %}
3
+ {% assign nested_depth = depth | plus: 1 %}
3
4
  {% if additional_context.before and additional_context.before.size > 0 %}
4
5
  {% for before in additional_context.before %}
6
+ {% if before.text %}
7
+
8
+ {% if before.liquid %}
9
+ {{ before.text | interpolate }}
10
+ {% else %}
5
11
  {{ before.text }}
12
+ {% endif %}
13
+ {% endif %}
14
+ {% endfor %}
15
+ {% endif %}
16
+
17
+ {% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}
18
+ {{equalsigns}} {{ package.name }}
19
+ {%comment%}(package: depth is {{ depth }}, nested_depth is {{ nested_depth }}){%endcomment%}
20
+
21
+ {% if additional_context.all_macros.size > 0 %}
22
+ {% assign sorted_all_macros = additional_context.all_macros | where: "position", "before" | sort: 'index' %}
23
+ {% for block in sorted_all_macros %}
24
+ {% case block.type %}
25
+ {% when 'include_block' %}
26
+ {% unless block.package and block.package != package.name %}
27
+ {% capture block_filename %}{{ block.base_path }}{{ package_name }}{% endcapture %}
28
+ {% capture block_content %}{% include block_filename %}{% endcapture %}
29
+ {% unless block_content contains "Liquid error" %}
30
+ {% if block.text %}
31
+
32
+ {% if block.liquid %}
33
+ {{ block.text | interpolate }}
34
+ {% else %}
35
+ {{ block.text }}
36
+ {% endif %}
37
+ {% endif %}
38
+
39
+ {{ block_content }}
40
+ {% endunless %}
41
+ {% endunless %}
42
+ {% when 'package_text' %}
43
+ {% unless block.package and block.package != package.name %}
44
+
45
+ {% if block.liquid %}
46
+ {{ block.text | interpolate }}
47
+ {% else %}
48
+ {{ block.text }}
49
+ {% endif %}
50
+ {% endunless %}
51
+ {% else %}
52
+ {% endcase %}
6
53
  {% endfor %}
7
54
  {% endif %}
8
- {% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}{{equalsigns}} {{ package.name }}
9
- {{equalsigns}}= {{ package.name }}
10
55
 
11
56
  {% assign before_package_key = 'before;' | append: package.name %}
12
57
  {% if additional_context[before_package_key] and additional_context[before_package_key].size > 0 %}
13
58
  {% for before in additional_context[before_package_key] %}
59
+ {% if before.text %}
60
+
61
+ {% if before.liquid %}
62
+ {{ before.text | interpolate }}
63
+ {% else %}
14
64
  {{ before.text }}
65
+ {% endif %}
66
+ {% endif %}
15
67
  {% endfor %}
16
68
  {% endif %}
17
69
 
70
+ .Metadata of {{ package.name }} ({{ package.stereotype }})
18
71
  [cols="1a,4a"]
19
72
  |===
20
73
 
21
- h|Description: | {{ package.definition }}
22
- h|Parent Package: | {{ context.name }}
74
+ h|Description: | {{ package.definition | replace: '|', '\|' }}
75
+ h|Parent package: | {{ context.name }}
23
76
  h|Stereotype: | «{{ package.stereotype }}»
24
77
 
25
78
  |===
26
79
 
27
- {% assign feature_types = package.classes | where: "stereotype", "FeatureType" %}
28
- {% assign object_types = package.classes | where: "stereotype", "ObjectType" %}
80
+ {% assign inner_depth = depth | plus: 2 %}
29
81
  {% assign basic_types = package.classes | where: "stereotype", "BasicType" %}
30
- {% assign unions = package.classes | where: "stereotype", "Union" %}
82
+ {% assign unions = package.data_types | where: "stereotype", "Union" %}
31
83
  {% assign code_lists = package.classes | where: "stereotype", "CodeList" %}
32
- {% if feature_types.size > 0 or object_types.size > 0 %}
84
+ {% assign not_classes_length = basic_types.size | plus: code_lists.size %}
85
+ {% assign not_classes_stereotypes = 'DataType,BasicType,Enumeration,CodeList' | split: ','%}
86
+ {% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}
33
87
  {{equalsigns}}= Classes
88
+ {%comment%}(class: depth is {{ depth }}, nested_depth is {{ nested_depth }}){%endcomment%}
34
89
 
35
- {% include "packages_data_dictionary_classes", classes: feature_types %}
36
- {% include "packages_data_dictionary_classes", classes: object_types %}
37
- {% endif %}
90
+ {% unless not_classes_length == package.classes.size %}
38
91
 
39
- {% if basic_types.size > 0 %}
40
- {{equalsigns}}= Basic Types
92
+ {% for klass in package.classes %}
93
+ {% unless not_classes_stereotypes contains klass.stereotype %}
94
+ {% include "packages_data_dictionary_class", depth: inner_depth %}
95
+ {% endunless %}
96
+ {% endfor %}
97
+ {% else %}
98
+ None.
99
+ {% endunless %}
100
+
101
+ {% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}
102
+ {{equalsigns}}= Basic types
103
+ {%comment%}(class: depth is {{ depth }}, inner_depth is {{ inner_depth }}){%endcomment%}
41
104
 
42
- {% include "packages_data_dictionary_classes", classes: basic_types %}
105
+ {% if basic_types.size > 0 %}
106
+ {% include "packages_data_dictionary_classes", classes: basic_types, depth: inner_depth %}
107
+ {% else %}
108
+ None.
43
109
  {% endif %}
44
110
 
45
- {% if unions.size > 0 %}
111
+ {% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}
46
112
  {{equalsigns}}= Unions
113
+ {%comment%}(class: depth is {{ depth }}, inner_depth is {{ inner_depth }}){%endcomment%}
47
114
 
48
- {% include "packages_data_dictionary_classes", classes: unions %}
115
+ {% if unions.size > 0 %}
116
+ {% include "packages_data_dictionary_classes", classes: unions, depth: inner_depth %}
117
+ {% else %}
118
+ None.
49
119
  {% endif %}
50
120
 
51
- {% if code_lists.size > 0 %}
52
- {{equalsigns}}= Code Lists
121
+ {% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}
122
+ {{equalsigns}}= Code lists
123
+ {%comment%}(class: depth is {{ depth }}, inner_depth is {{ inner_depth }}){%endcomment%}
53
124
 
54
- {% include "packages_data_dictionary_classes", classes: code_lists %}
125
+ {% if code_lists.size > 0 %}
126
+ {% include "packages_data_dictionary_classes", classes: code_lists, depth: inner_depth %}
127
+ {% else %}
128
+ None.
55
129
  {% endif %}
56
130
 
57
- {% if package.data_types.size > 0 %}
58
- {{equalsigns}}= Data Types
131
+ {% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}
132
+ {{equalsigns}}= Data types
133
+ {%comment%}(class: depth is {{ depth }}, inner_depth is {{ inner_depth }}){%endcomment%}
59
134
 
60
- {% for data_type in package.data_types %}
61
- {% capture generalizations %}{% for assoc in data_type.associations | where: "member_end_type", "generalization" %}{{ assoc.member_end }} {% endfor %}{% endcapture %}
135
+ {% assign non_unions = package.data_types | where: "stereotype", "DataType" %}
136
+ {% if non_unions.size > 0 %}
137
+ {% for data_type in non_unions %}
138
+ {% capture generalizations %}{% assign inheritance = klass.associations | where: "member_end_type", "inheritance" %}{% for assoc in inheritance %}<<{{ assoc.member_end }}-section,{{ assoc.member_end }}>>{% endfor %}{% endcapture %}
62
139
  [[{{ data_type.name }}-section]]
63
- [cols="1a"]
140
+ {{equalsigns}}== {{ data_type.name }}
141
+
142
+ .Metadata of {{ data_type.name }} ({{ data_type.stereotype }})
143
+ [cols="1a,4a"]
144
+ |===
145
+ h|Definition: | {{ data_type.definition | replace: '|', '\|' }}
146
+ h|Subclass of: | {% if generalizations.size > 0 %}{{ generalizations }}{% else %}None{% endif %}
147
+ h|Stereotype: | «{{ data_type.stereotype }}»
148
+
149
+ {% if data_type.constraints.size > 0 %}
150
+ {% for constraint in data_type.constraints %}
151
+ h| Constraint:
152
+ | `{{ constraint.body }}`:
153
+
154
+ [source,ocl,%unnumbered]
155
+ ------
156
+ {{ constraint.definition | replace: '|', '\|' }}
157
+ ------
158
+ {% endfor %}
159
+ {% endif %}
160
+
64
161
  |===
65
- |*{{ data_type.name }}*
66
- |[cols="1,4",frame=none,grid=none]
67
- !===
68
- !{nbsp}{nbsp}{nbsp}{nbsp}Definition: ! {{ data_type.definition }}
69
- !{nbsp}{nbsp}{nbsp}{nbsp}Subclass of: ! {{ generalizations }}
70
- !{nbsp}{nbsp}{nbsp}{nbsp}Stereotype: ! «DataType»
71
- !===
162
+
72
163
  {% if data_type.associations.size > 0 %}
73
164
  {% capture rendered_associations %}
74
165
  {% for assoc in data_type.associations %}
75
166
  {% if assoc.member_end_attribute_name.size > 0 %}
76
- {% capture cardinality %}{% if assoc.member_end_cardinality.min == 'C' %}[0..{{ assoc.member_end_cardinality.max }}]{% elsif assoc.member_end_cardinality.min == 'M' and assoc.member_end_cardinality.max == '1' %}[1..1]{% else %}[{{ assoc.member_end_cardinality.max }}]{% endif %}{% endcapture %}
77
- !{set:cellbgcolor:#FFFFFF} {{ assoc.member_end_attribute_name }} !<<{{assoc.member_end}}-section,{{assoc.member_end}}>> {{ cardinality }} ! {{ assoc.definition }}
167
+ {% capture cardinality %}&#91;{% case assoc.member_end_cardinality.min %}{% when "C" %}0{% when "M" %}1{% else %}{{assoc.member_end_cardinality.min}}{% endcase %}..{{ assoc.member_end_cardinality.max }}&#93;{% endcapture %}
168
+ | {{ assoc.member_end_attribute_name }}
169
+ | <<{{assoc.member_end}}-section,{{assoc.member_end}}>> {{ cardinality }}
170
+ | {{ assoc.definition | replace: '|', '\|' }}
78
171
  {% endif %}
79
172
  {% endfor %}
80
173
  {% endcapture %}
81
- {% if rendered_associations.size > 0 %}
82
- |[cols="15,20,60",frame=none,grid=none,options="header"]
83
- !===
84
- !{set:cellbgcolor:#DDDDDD} *Role name* !*Target class and multiplicity* !*Definition*
174
+
175
+ {% assign associations_stripped = rendered_associations | strip_newlines | strip %}
176
+
177
+ {% if associations_stripped.size > 0 %}
178
+ .Associations of {{ data_type.name }} ({{ data_type.stereotype }})
179
+ [cols="15a,20a,60a",options="header"]
180
+ |===
181
+ | Role name | Target class and multiplicity | Definition
182
+
85
183
  {{ rendered_associations }}
86
- !===
184
+
185
+ |===
87
186
  {% endif %}
88
187
  {% endif %}
188
+
89
189
  {% if data_type.attributes.size > 0 %}
90
- |[cols="15,20,60",frame=none,grid=none,options="header"]
91
- !===
92
- !{set:cellbgcolor:#DDDDDD} *Attribute* !*Value type and multiplicity* !*Definition*
190
+ .Attributes of {{ data_type.name }} ({{ data_type.stereotype }})
191
+ [cols="15a,20a,60a",options="header"]
192
+ |===
193
+ | Attribute | Value type and multiplicity | Definition
194
+
93
195
  {% for attr in data_type.attributes %}
94
- {% capture cardinality %}{% if attr.cardinality.min == 'C' %}[0..{{ attr.cardinality.max }}]{% elsif assoc.member_end_cardinality.min == 'M' and assoc.member_end_cardinality.max == '1' %}[1..1]{% else %}[{{ attr.cardinality.max }}]{% endif %}{% endcapture %}
95
- !{set:cellbgcolor:#FFFFFF} {{ attr.name }} !<<{{ attr.type }}-section,{{ attr.name }}>> {{ cardinality }} !{{ attr.definition }}
196
+ {% capture cardinality %}&#91;{% case attr.cardinality.min %}{% when 'C' %}0{% when 'M' %}1{% else %}{{ attr.cardinality.min }}{% endcase %}..{{ attr.cardinality.max }}&#93;{% endcapture %}
197
+ | {{ attr.name }}
198
+ | <<{{ attr.type }}-section,{{ attr.type }}>> {{ cardinality }}
199
+ | {{ attr.definition | replace: '|', '\|' }}
200
+
96
201
  {% endfor %}
97
- !===
98
- |{set:cellbgcolor:#FFFFFF} Note: Unless otherwise specified, all attributes and role names have the stereotype «Property».
99
- {% endif %}
100
202
  |===
101
203
 
204
+ [NOTE,keep-separate=true]
205
+ ====
206
+ Unless otherwise specified, all attributes and role names have the stereotype
207
+ «Property».
208
+ ====
209
+ {% endif %}
210
+
102
211
  {% endfor %}
212
+ {% else %}
213
+ None.
103
214
  {% endif %}
104
215
 
105
- {% if package.enums.size > 0 %}
106
216
  {{equalsigns}}= Enumerations
107
217
 
218
+ {% if package.enums.size > 0 %}
108
219
  {% for enum in package.enums %}
109
- {% capture generalizations %}{% for assoc in enum.associations | where: "member_end_type", "generalization" %}{{ assoc.member_end }} {% endfor %}{% endcapture %}
110
220
  [[{{ enum.name }}-section]]
111
- [cols="1a"]
221
+ {{equalsigns}}== {{ enum.name }}
222
+
223
+ .Metadata of {{ enum.name }} (Enumeration)
224
+ [cols="1a,4a"]
112
225
  |===
113
- |*{{ enum.name }}*
114
- |[cols="1,4",frame=none,grid=none]
115
- !===
116
- !{nbsp}{nbsp}{nbsp}{nbsp}Definition: ! {{ enum.definition }}
117
- !{nbsp}{nbsp}{nbsp}{nbsp}Stereotype: ! «Enumeration»
118
- !===
226
+ h|Definition: | {{ enum.definition | replace: '|', '\|' }}
227
+ h|Stereotype: | «Enumeration»
228
+ |===
229
+
119
230
  {% if enum.values.size > 0 %}
120
- |[cols="1,4",frame=none,grid=none,options="header"]
121
- !===
122
- ^!{set:cellbgcolor:#DDDDDD} *Literal value* !*Definition*
231
+ .Values of {{ enum.name }} (Enumeration)
232
+ [cols="1a,4a",options="header"]
233
+ |===
234
+ | Literal value | Definition
123
235
 
124
236
  {% for val in enum.values %}
125
- ^!{set:cellbgcolor:#FFFFFF} {{ val.name }} !{{ val.definition }}
237
+ | {{ val.name }}
238
+ | {{ val.definition | replace: '|', '\|' }}
239
+
126
240
  {% endfor %}
127
- !===
128
- {% endif %}
241
+
129
242
  |===
243
+ {% endif %}
130
244
 
131
245
  {% endfor %}
246
+ {% else %}
247
+ None.
132
248
  {% endif %}
133
249
 
134
250
  {% if additional_context.include_block and additional_context.include_block.size > 0 %}
@@ -151,27 +267,83 @@ h|Stereotype: | «{{ package.stereotype }}»
151
267
  {% capture block_content %}{% include block_filename %}{% endcapture %}
152
268
  {% unless block_content contains "Liquid error" %}
153
269
  {% if block.text %}
270
+
271
+ {% if block.liquid %}
272
+ {{ block.text | interpolate }}
273
+ {% else %}
154
274
  {{ block.text }}
155
275
  {% endif %}
276
+ {% endif %}
156
277
  {{ block_content }}
157
278
  {% endunless %}
158
279
  {% endfor %}
159
280
  {% endif %}
160
281
 
282
+ {% if additional_context.all_macros.size > 0 %}
283
+ {% assign sorted_all_macros = additional_context.all_macros | where: "position", "after" | sort: 'index' %}
284
+ {% for block in sorted_all_macros %}
285
+ {% case block.type %}
286
+ {% when 'include_block' %}
287
+ {% unless block.package and block.package != package.name %}
288
+ {% capture block_filename %}{{ block.base_path }}{{ package_name }}{% endcapture %}
289
+ {% capture block_content %}{% include block_filename %}{% endcapture %}
290
+ {% unless block_content contains "Liquid error" %}
291
+ {% if block.text %}
292
+
293
+ {% if block.liquid %}
294
+ {{ block.text | interpolate }}
295
+ {% else %}
296
+ {{ block.text }}
297
+ {% endif %}
298
+ {% endif %}
299
+
300
+ {{ block_content }}
301
+ {% endunless %}
302
+ {% endunless %}
303
+ {% when 'package_text' %}
304
+ {% unless block.package and block.package != package.name %}
305
+
306
+ {% if block.liquid %}
307
+ {{ block.text | interpolate }}
308
+ {% else %}
309
+ {{ block.text }}
310
+ {% endif %}
311
+ {% endunless %}
312
+ {% else %}
313
+ {% endcase %}
314
+ {% endfor %}
315
+ {% endif %}
316
+
317
+
161
318
  {% assign after_package_key = 'after;' | append: package.name %}
162
319
  {% if additional_context[after_package_key] %}
163
- {{equalsigns}}= Additional Information
320
+ {{equalsigns}}= Additional information
164
321
  {% for after in additional_context[after_package_key] %}
322
+ {% if after.text %}
323
+
324
+ {% if after.liquid %}
325
+ {{ after.text | interpolate }}
326
+ {% else %}
165
327
  {{ after.text }}
328
+ {% endif %}
329
+ {% endif %}
166
330
  {% endfor %}
167
331
  {% endif %}
332
+
168
333
  {% if package.packages.size > 0 and render_nested_packages %}
169
- {% assign nested_depth = depth | plus: 1 %}{% include "packages_data_dictionary", depth: nested_depth, context: package %}
334
+ {% include "packages_data_dictionary", depth: nested_depth, context: package %}
170
335
  {% endif %}
171
336
  {% endfor %}
172
337
 
173
338
  {% if additional_context.after and additional_context.after.size > 0 %}
174
339
  {% for after in additional_context.after %}
340
+ {% if after.text %}
341
+
342
+ {% if after.liquid %}
343
+ {{ after.text | interpolate }}
344
+ {% else %}
175
345
  {{ after.text }}
346
+ {% endif %}
347
+ {% endif %}
176
348
  {% endfor %}
177
349
  {% endif %}