metanorma-plugin-lutaml 0.4.7 → 0.4.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +153 -72
  3. data/lib/metanorma/plugin/lutaml/liquid/custom_filters.rb +9 -0
  4. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages.liquid +112 -6
  5. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_class.liquid +12 -12
  6. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_data_dictionary.liquid +237 -63
  7. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_data_dictionary_class.liquid +75 -0
  8. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_data_dictionary_classes.liquid +1 -41
  9. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_data_type.liquid +9 -10
  10. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_entity_list.liquid +118 -49
  11. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_entity_list_class.liquid +19 -0
  12. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_entity_list_classes.liquid +11 -0
  13. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_enum.liquid +11 -11
  14. data/lib/metanorma/plugin/lutaml/liquid_templates/test.rb +1 -0
  15. data/lib/metanorma/plugin/lutaml/lutaml_preprocessor.rb +1 -1
  16. data/lib/metanorma/plugin/lutaml/lutaml_table_inline_macro.rb +25 -0
  17. data/lib/metanorma/plugin/lutaml/lutaml_uml_attributes_table_preprocessor.rb +1 -1
  18. data/lib/metanorma/plugin/lutaml/lutaml_uml_datamodel_description_preprocessor.rb +93 -19
  19. data/lib/metanorma/plugin/lutaml/utils.rb +1 -1
  20. data/lib/metanorma/plugin/lutaml/version.rb +1 -1
  21. data/lib/metanorma-plugin-lutaml.rb +1 -0
  22. metadata +7 -2
@@ -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 “{{ package.name }}::{{ klass.name }}” ({{ 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,252 @@
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 %}{% capture ref_id %}{% if additional_context.external_classes[assoc.member_end] %}{{ additional_context.external_classes[assoc.member_end] }}{% else %}{{ assoc.member_end }}-section{% endif %}{% endcapture %}<<{{ ref_id }},{{ 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
+ {% capture ref_id %}{% if additional_context.external_classes[assoc.member_end] %}{{ additional_context.external_classes[assoc.member_end] }}{% else %}{{ assoc.member_end }}-section{% endif %}{% endcapture %}
170
+ | <<{{ ref_id }},{{assoc.member_end}}>> {{ cardinality }}
171
+ | {{ assoc.definition | replace: '|', '\|' }}
78
172
  {% endif %}
79
173
  {% endfor %}
80
174
  {% 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*
175
+
176
+ {% assign associations_stripped = rendered_associations | strip_newlines | strip %}
177
+
178
+ {% if associations_stripped.size > 0 %}
179
+ .Associations of {{ data_type.name }} ({{ data_type.stereotype }})
180
+ [cols="15a,20a,60a",options="header"]
181
+ |===
182
+ | Role name | Target class and multiplicity | Definition
183
+
85
184
  {{ rendered_associations }}
86
- !===
185
+
186
+ |===
87
187
  {% endif %}
88
188
  {% endif %}
189
+
89
190
  {% 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*
191
+ .Attributes of {{ data_type.name }} ({{ data_type.stereotype }})
192
+ [cols="15a,20a,60a",options="header"]
193
+ |===
194
+ | Attribute | Value type and multiplicity | Definition
195
+
93
196
  {% 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 }}
197
+ {% capture cardinality %}&#91;{% case attr.cardinality.min %}{% when 'C' %}0{% when 'M' %}1{% else %}{{ attr.cardinality.min }}{% endcase %}..{{ attr.cardinality.max }}&#93;{% endcapture %}
198
+ | {{ attr.name }}
199
+ {% capture ref_id %}{% if additional_context.external_classes[attr.type] %}{{ additional_context.external_classes[attr.type] }}{% else %}{{ attr.type }}-section{% endif %}{% endcapture %}
200
+ | <<{{ ref_id }},{{ attr.type }}>> {{ cardinality }}
201
+ | {{ attr.definition | replace: '|', '\|' }}
202
+
96
203
  {% endfor %}
97
- !===
98
- |{set:cellbgcolor:#FFFFFF} Note: Unless otherwise specified, all attributes and role names have the stereotype «Property».
99
- {% endif %}
100
204
  |===
101
205
 
206
+ [NOTE,keep-separate=true]
207
+ ====
208
+ Unless otherwise specified, all attributes and role names have the stereotype
209
+ «Property».
210
+ ====
211
+ {% endif %}
212
+
102
213
  {% endfor %}
214
+ {% else %}
215
+ None.
103
216
  {% endif %}
104
217
 
105
- {% if package.enums.size > 0 %}
106
218
  {{equalsigns}}= Enumerations
107
219
 
220
+ {% if package.enums.size > 0 %}
108
221
  {% for enum in package.enums %}
109
- {% capture generalizations %}{% for assoc in enum.associations | where: "member_end_type", "generalization" %}{{ assoc.member_end }} {% endfor %}{% endcapture %}
110
222
  [[{{ enum.name }}-section]]
111
- [cols="1a"]
223
+ {{equalsigns}}== {{ enum.name }}
224
+
225
+ .Metadata of {{ enum.name }} (Enumeration)
226
+ [cols="1a,4a"]
112
227
  |===
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
- !===
228
+ h|Definition: | {{ enum.definition | replace: '|', '\|' }}
229
+ h|Stereotype: | «Enumeration»
230
+ |===
231
+
119
232
  {% if enum.values.size > 0 %}
120
- |[cols="1,4",frame=none,grid=none,options="header"]
121
- !===
122
- ^!{set:cellbgcolor:#DDDDDD} *Literal value* !*Definition*
233
+ .Values of {{ enum.name }} (Enumeration)
234
+ [cols="1a,4a",options="header"]
235
+ |===
236
+ | Literal value | Definition
123
237
 
124
238
  {% for val in enum.values %}
125
- ^!{set:cellbgcolor:#FFFFFF} {{ val.name }} !{{ val.definition }}
239
+ | {{ val.name }}
240
+ | {{ val.definition | replace: '|', '\|' }}
241
+
126
242
  {% endfor %}
127
- !===
128
- {% endif %}
243
+
129
244
  |===
245
+ {% endif %}
130
246
 
131
247
  {% endfor %}
248
+ {% else %}
249
+ None.
132
250
  {% endif %}
133
251
 
134
252
  {% if additional_context.include_block and additional_context.include_block.size > 0 %}
@@ -151,27 +269,83 @@ h|Stereotype: | «{{ package.stereotype }}»
151
269
  {% capture block_content %}{% include block_filename %}{% endcapture %}
152
270
  {% unless block_content contains "Liquid error" %}
153
271
  {% if block.text %}
272
+
273
+ {% if block.liquid %}
274
+ {{ block.text | interpolate }}
275
+ {% else %}
154
276
  {{ block.text }}
155
277
  {% endif %}
278
+ {% endif %}
156
279
  {{ block_content }}
157
280
  {% endunless %}
158
281
  {% endfor %}
159
282
  {% endif %}
160
283
 
284
+ {% if additional_context.all_macros.size > 0 %}
285
+ {% assign sorted_all_macros = additional_context.all_macros | where: "position", "after" | sort: 'index' %}
286
+ {% for block in sorted_all_macros %}
287
+ {% case block.type %}
288
+ {% when 'include_block' %}
289
+ {% unless block.package and block.package != package.name %}
290
+ {% capture block_filename %}{{ block.base_path }}{{ package_name }}{% endcapture %}
291
+ {% capture block_content %}{% include block_filename %}{% endcapture %}
292
+ {% unless block_content contains "Liquid error" %}
293
+ {% if block.text %}
294
+
295
+ {% if block.liquid %}
296
+ {{ block.text | interpolate }}
297
+ {% else %}
298
+ {{ block.text }}
299
+ {% endif %}
300
+ {% endif %}
301
+
302
+ {{ block_content }}
303
+ {% endunless %}
304
+ {% endunless %}
305
+ {% when 'package_text' %}
306
+ {% unless block.package and block.package != package.name %}
307
+
308
+ {% if block.liquid %}
309
+ {{ block.text | interpolate }}
310
+ {% else %}
311
+ {{ block.text }}
312
+ {% endif %}
313
+ {% endunless %}
314
+ {% else %}
315
+ {% endcase %}
316
+ {% endfor %}
317
+ {% endif %}
318
+
319
+
161
320
  {% assign after_package_key = 'after;' | append: package.name %}
162
321
  {% if additional_context[after_package_key] %}
163
- {{equalsigns}}= Additional Information
322
+ {{equalsigns}}= Additional information
164
323
  {% for after in additional_context[after_package_key] %}
324
+ {% if after.text %}
325
+
326
+ {% if after.liquid %}
327
+ {{ after.text | interpolate }}
328
+ {% else %}
165
329
  {{ after.text }}
330
+ {% endif %}
331
+ {% endif %}
166
332
  {% endfor %}
167
333
  {% endif %}
334
+
168
335
  {% 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 %}
336
+ {% include "packages_data_dictionary", depth: nested_depth, context: package %}
170
337
  {% endif %}
171
338
  {% endfor %}
172
339
 
173
340
  {% if additional_context.after and additional_context.after.size > 0 %}
174
341
  {% for after in additional_context.after %}
342
+ {% if after.text %}
343
+
344
+ {% if after.liquid %}
345
+ {{ after.text | interpolate }}
346
+ {% else %}
175
347
  {{ after.text }}
348
+ {% endif %}
349
+ {% endif %}
176
350
  {% endfor %}
177
351
  {% endif %}
@@ -0,0 +1,75 @@
1
+ {% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}
2
+ {% capture generalizations %}{% assign inheritance = klass.associations | where: "member_end_type", "inheritance" %}{% for assoc in inheritance %}{% capture ref_id %}{% if additional_context.external_classes[assoc.member_end] %}{{ additional_context.external_classes[assoc.member_end] }}{% else %}{{ assoc.member_end }}-section{% endif %}{% endcapture %}<<{{ ref_id }},{{ assoc.member_end }}>>{% endfor %}{% endcapture %}
3
+ [[{{ klass.name }}-section]]
4
+ {{equalsigns}} {{ klass.name }}
5
+ {%comment%}(inside class: depth is {{ depth }}, equalsigns {{equalsigns}}){%endcomment%}
6
+
7
+ .Metadata of {{ klass.name }} ({{klass.stereotype}})
8
+ [cols="1a,4a"]
9
+ |===
10
+ h| Definition: | {{ klass.definition | replace: '|', '\|' }}
11
+ h| Subclass of: | {% if generalizations.size > 0 %}{{ generalizations }}{% else %}None{% endif %}
12
+ h| Stereotype: | «{{ klass.stereotype }}»
13
+
14
+ {% if klass.constraints.size > 0 %}
15
+ {% for constraint in klass.constraints %}
16
+ h| Constraint:
17
+ | `{{ constraint.body }}`:
18
+
19
+ [source,ocl,%unnumbered]
20
+ ------
21
+ {{ constraint.definition | replace: '|', '\|' }}
22
+ ------
23
+ {% endfor %}
24
+ {% endif %}
25
+
26
+ |===
27
+
28
+ {% if klass.associations.size > 0 %}
29
+ {% capture rendered_associations %}
30
+ {% for assoc in klass.associations %}
31
+ {% if assoc.member_end_attribute_name.size > 0 %}
32
+ {% 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 %}
33
+ | {{ assoc.member_end_attribute_name }}
34
+ {% capture ref_id %}{% if additional_context.external_classes[assoc.member_end] %}{{ additional_context.external_classes[assoc.member_end] }}{% else %}{{ assoc.member_end }}-section{% endif %}{% endcapture %}
35
+ | <<{{ ref_id }},{{assoc.member_end}}>> {{ cardinality }}
36
+ | {{ assoc.definition | replace: '|', '\|' }}
37
+ {% endif %}
38
+ {% endfor %}
39
+ {% endcapture %}
40
+ {% assign associations_stripped = rendered_associations | strip_newlines | strip %}
41
+
42
+ {% if associations_stripped.size > 0 %}
43
+ .Associations of {{ klass.name }} ({{ klass.stereotype }})
44
+ [cols="15a,20a,60a",options="header"]
45
+ |===
46
+ | Role name | Target class and multiplicity | Definition
47
+
48
+ {{ rendered_associations }}
49
+
50
+ |===
51
+ {% endif %}
52
+ {% endif %}
53
+
54
+ {% if klass.attributes.size > 0 %}
55
+ .Attributes of {{ klass.name }} ({{klass.stereotype}})
56
+ [cols="15a,20a,60a",options="header"]
57
+ |===
58
+ | Attribute | Value type and multiplicity | Definition
59
+
60
+ {% for attr in klass.attributes %}
61
+ {% capture cardinality %}&#91;{% case attr.cardinality.min %}{% when 'C' %}0{% when 'M' %}1{% else %}{{ attr.cardinality.min }}{% endcase %}..{{ attr.cardinality.max }}&#93;{% endcapture %}
62
+ | {{ attr.name }}
63
+ {% capture ref_id %}{% if additional_context.external_classes[attr.type] %}{{ additional_context.external_classes[attr.type] }}{% else %}{{ attr.type }}-section{% endif %}{% endcapture %}
64
+ | <<{{ ref_id }},{{ attr.type }}>> {{ cardinality }}
65
+ | {{ attr.definition | replace: '|', '\|' }}
66
+
67
+ {% endfor %}
68
+ |===
69
+
70
+ [NOTE,keep-separate=true]
71
+ ====
72
+ Unless otherwise specified, all attributes and role names have the stereotype
73
+ «Property».
74
+ ====
75
+ {% endif %}
@@ -1,43 +1,3 @@
1
1
  {% for klass in classes %}
2
- {% capture generalizations %}{% for assoc in klass.associations | where: "member_end_type", "generalization" %}{{ assoc.member_end }} {% endfor %}{% endcapture %}
3
- [[{{ klass.name }}-section]]
4
- [cols="1a"]
5
- |===
6
- |*{{ klass.name }}*
7
- |[cols="1,4",frame=none,grid=none]
8
- !===
9
- !{nbsp}{nbsp}{nbsp}{nbsp}Definition: ! {{ klass.definition }}
10
- !{nbsp}{nbsp}{nbsp}{nbsp}Subclass of: ! {{ generalizations }}
11
- !{nbsp}{nbsp}{nbsp}{nbsp}Stereotype: ! «{{ klass.stereotype }}»
12
- !===
13
- {% if klass.associations.size > 0 %}
14
- {% capture rendered_associations %}
15
- {% for assoc in klass.associations %}
16
- {% if assoc.member_end_attribute_name.size > 0 %}
17
- {% 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 %}
18
- !{set:cellbgcolor:#FFFFFF} {{ assoc.member_end_attribute_name }} !<<{{assoc.member_end}}-section,{{assoc.member_end}}>> {{ cardinality }} ! {{ assoc.definition }}
19
- {% endif %}
20
- {% endfor %}
21
- {% endcapture %}
22
- {% if rendered_associations.size > 0 %}
23
- |[cols="15,20,60",frame=none,grid=none,options="header"]
24
- !===
25
- !{set:cellbgcolor:#DDDDDD} *Role name* !*Target class and multiplicity* !*Definition*
26
- {{ rendered_associations }}
27
- !===
28
- {% endif %}
29
- {% endif %}
30
- {% if klass.attributes.size > 0 %}
31
- |[cols="15,20,60",frame=none,grid=none,options="header"]
32
- !===
33
- !{set:cellbgcolor:#DDDDDD} *Attribute* !*Value type and multiplicity* !*Definition*
34
- {% for attr in klass.attributes %}
35
- {% 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 %}
36
- !{set:cellbgcolor:#FFFFFF} {{ attr.name }} !<<{{ attr.type }}-section,{{ attr.name }}>> {{ cardinality }} !{{ attr.definition }}
37
- {% endfor %}
38
- !===
39
- |{set:cellbgcolor:#FFFFFF} Note: Unless otherwise specified, all attributes and role names have the stereotype «Property».
40
- {% endif %}
41
- |===
42
-
2
+ {% include "packages_data_dictionary_class", depth: depth %}
43
3
  {% endfor %}
@@ -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 }}-DT-{{ klass_name }}]]
7
- .Elements of {{ package.name }}::{{ klass.name }}
6
+ [[section-{{ klass.xmi_id }}]]
7
+ .Definition table 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,12 +41,11 @@ 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 %}
47
46
 
48
47
  {% if klass.attributes.size > 0 %}
49
- .{{klass.attributes.size | plus: 1}}+h|Values:
48
+ .{{klass.attributes.size | plus: 1}}+h| Values:
50
49
  | _Name_
51
50
  6+| _Definition_
52
51
 
@@ -56,7 +55,7 @@ h|Abstract: 7+| {{ klass.is_abstract }}
56
55
 
57
56
  {% endfor %}
58
57
  {% else %}
59
- .1+h|Values:
58
+ h| Values:
60
59
  7+| (none)
61
60
  {% endif %}
62
61