metanorma-plugin-lutaml 0.4.8 → 0.4.12

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 +112 -51
  3. data/lib/metanorma/plugin/lutaml/liquid/custom_filters.rb +9 -0
  4. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages.liquid +110 -10
  5. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_class.liquid +4 -5
  6. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_data_dictionary.liquid +232 -62
  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 -63
  9. data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_data_type.liquid +2 -3
  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 +3 -4
  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 +8 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 202335c2a56ade17a5bdfedd489b6c39363b256ebbaa2e2cbfe812a6bb6995e5
4
- data.tar.gz: 9637bc5a68bbbe8cda105e74a537ae7e41d5676f584e64e907ad26ba6cf50082
3
+ metadata.gz: 2a10016110c0403f8925e080c1f29cf8a4b81e9d2f52c1e986bf26c3d9754d0c
4
+ data.tar.gz: 81f3c21e207bde438c076f11aa7d2fc109732999351a99431785f4323c3d749c
5
5
  SHA512:
6
- metadata.gz: 7e183219067f431d7b839d59ab3e5c8a8b3f54b335cb1e232297f1fa997e7f7abafa4a0858d5398a034c2a025d46feef240f3e71b14db7730fb1789b2dd11afb
7
- data.tar.gz: 400132cae1b7b1b3f03414f4c4ab8b16edde68ab285cd192bd0894d913bee26985182aaf880c2a4ddac1935541bac62913679424e433d88bacc8242c7fcabede
6
+ metadata.gz: 0ba4c445dc6254628dd8184bddecf6dd5394496694ff6493572b8b30479c62e92275d4af33d6f5015862ec6dad39be0a438e2dd2d75353882b6820dffef613b5
7
+ data.tar.gz: c1258f09dd31d96424b2b63bb039c424042248e0cdd84b7215c48a817f25c326b0dc75a0f439db97716d1a1e8f712685c736d0c1ac9149a7a35c3dde66aaf17d
data/README.adoc CHANGED
@@ -28,7 +28,7 @@ LutaML supports accessing EXPRESS models via the
28
28
  https://github.com/lutaml/expressir[Expressir] parser.
29
29
 
30
30
 
31
- === Usage of the `lutaml_express` EXPRESS macro
31
+ === Usage of the `lutaml` macro
32
32
 
33
33
  Given an `example.exp` EXPRESS file with the content:
34
34
 
@@ -57,11 +57,11 @@ SCHEMA test_schema 'test';
57
57
  END_SCHEMA;
58
58
  ----
59
59
 
60
- And the `lutaml_express` macro block:
60
+ And the `lutaml` macro block:
61
61
 
62
62
  [source,adoc]
63
63
  -----
64
- [lutaml_express,example.exp,my_context]
64
+ [lutaml,example.exp,my_context]
65
65
  ----
66
66
 
67
67
  {% for schema in my_context.schemas %}
@@ -82,7 +82,7 @@ Where:
82
82
  * `{example.exp}` is the location of the EXPRESS schema file (`*.exp`) that
83
83
  contains data to be loaded. Location of the file is computed relative to the
84
84
  source directory that `[lutaml]` is used (e.g., if
85
- `[lutaml_express,example.exp,my_context]` is invoked in an `.adoc` file located at
85
+ `[lutaml,example.exp,my_context]` is invoked in an `.adoc` file located at
86
86
  `/foo/bar/doc.adoc`, the data file is expected to be found at
87
87
  `/foo/bar/example.exp`);
88
88
 
@@ -97,8 +97,7 @@ https://github.com/lutaml/expressir/blob/master/lib/expressir/model/schema.rb[sc
97
97
 
98
98
  Will produce this output:
99
99
 
100
- [source,adoc]
101
- -----
100
+ ____
102
101
  == test_schema
103
102
 
104
103
  === my_type1
@@ -106,9 +105,9 @@ Will produce this output:
106
105
  === my_type3
107
106
  === my_type4
108
107
  === my_type5
109
- -----
108
+ ____
110
109
 
111
- This macro also supports `.lutaml` files.
110
+ This command also supports `.lutaml` files.
112
111
 
113
112
  Instead of using the direct path to the file one can use `lutaml-express-index`
114
113
  document attribute to supply directory with express files or YAML index file to
@@ -137,19 +136,22 @@ Example of usage:
137
136
  -----
138
137
  = Document title
139
138
  Author
140
- :lutaml-express-index: my_custom_name; /path/to/express_files; cache=/path/to/cache_file.yaml
141
- [lutaml_express,my_custom_name,my_context]
139
+ :lutaml-express-index: index_name; /path/to/express_files; cache=/path/to/cache_file.yaml
140
+ [lutaml,index_name,context]
142
141
  ----
143
- {% for schema in my_context.schemas %}
142
+ {% for schema in context.schemas %}
144
143
  == {{schema.id}}
145
144
  {% endfor %}
146
145
  ----
147
146
  -----
148
147
 
149
- === Usage, `lutaml_diagram` macro
148
+ == Usage with UML
150
149
 
151
- This macro allows to quickly render lutaml file as diagram image.
152
- Given `example.lutaml` file with the content:
150
+ === Rendering a LutaML view: `lutaml_diagram`
151
+
152
+ This command allows to quickly render a LutaML view as an image file.
153
+
154
+ Given a file `example.lutaml` file with content:
153
155
 
154
156
  [source,java]
155
157
  ----
@@ -173,16 +175,17 @@ diagram MyView {
173
175
  }
174
176
  ----
175
177
 
176
- And the `lutaml_diagram` macro:
178
+ The `lutaml_diagram` command will add the image to the document.
177
179
 
178
180
  [source,adoc]
179
181
  -----
180
182
  lutaml_diagram::example.lutaml[]
181
183
  -----
182
184
 
183
- Will add diagram image to the document
185
+ The `lutaml_diagram` command can also be used to denote a block with an embedded
186
+ LutaML view.
184
187
 
185
- Also one can use `lutaml_diagram` block with embed lutaml code instead of block macro. Example:
188
+ For example:
186
189
 
187
190
  [source,java]
188
191
  ----
@@ -193,9 +196,9 @@ diagram MyView {
193
196
 
194
197
  enum AddressClassProfile {
195
198
  imlicistAttributeProfile: CharacterString [0..1] {
196
- definition
197
- this is multiline with `ascidoc`
198
- end definition
199
+ definition {
200
+ This is multiline AsciiDoc content.
201
+ }
199
202
  }
200
203
  }
201
204
 
@@ -210,9 +213,9 @@ diagram MyView {
210
213
  ----
211
214
 
212
215
 
213
- === Usage of `lutaml_uml_attributes_table` macro
216
+ === `lutaml_uml_attributes_table`
214
217
 
215
- This macro allows to quickly render data model attributes/values tables.
218
+ This command allows rendering definition tables for a UML model.
216
219
 
217
220
  Given `example.lutaml` file with the content:
218
221
 
@@ -247,21 +250,20 @@ And the `lutaml_uml_attributes_table` macro:
247
250
 
248
251
  Will produce this output:
249
252
 
250
- [source,adoc]
251
- -----
253
+ ____
252
254
  === AttributeProfile
253
255
 
254
-
255
256
  .AttributeProfile attributes
256
257
  |===
257
258
  |Name |Definition |Mandatory/ Optional/ Conditional |Max Occur |Data Type
258
259
 
259
- |addressClassProfile |TODO: enum 's definition |M |1 | `CharacterString`
260
+ |addressClassProfile |TODO: enum's definition |M |1 | `CharacterString`
260
261
 
261
262
  |imlicistAttributeProfile |this is attribute definition with multiply lines |M |1 | `CharacterString`
262
263
 
263
264
  |===
264
- -----
265
+ ____
266
+
265
267
 
266
268
  In case of "enumeration" (AddressClassProfile) entity:
267
269
 
@@ -272,11 +274,9 @@ In case of "enumeration" (AddressClassProfile) entity:
272
274
 
273
275
  Will produce this output:
274
276
 
275
- [source,adoc]
276
- -----
277
+ ____
277
278
  === AddressClassProfile
278
279
 
279
-
280
280
  .AddressClassProfile values
281
281
  |===
282
282
  |Name |Definition
@@ -284,11 +284,11 @@ Will produce this output:
284
284
  |imlicistAttributeProfile |this is multiline with `asciidoc`
285
285
 
286
286
  |===
287
- -----
287
+ ____
288
288
 
289
289
  === Usage of `lutaml_uml_datamodel_description` macro
290
290
 
291
- This macro allows to quickly render data model packages and its dependent
291
+ This command allows to quickly render data model packages and its dependent
292
292
  objects for supplied XMI file.
293
293
 
294
294
  Given an Enterprise Architect `example.xmi` file with 2 packages:
@@ -349,13 +349,19 @@ Where:
349
349
 
350
350
  * `path/to/example.xmi` - required, path to the XMI file to render
351
351
 
352
- * `[.before]` - macro to add additional text before the rendered output, can be used only once, additional occurrences of macro will overwrite text, not that `literal` block style must be used in there(eg `....`)
352
+ * `[.before]` - block text that adds additional text before the rendered output, can be used only once, additional occurrences of macro will overwrite text, not that `literal` block style must be used in there(eg `....`)
353
353
 
354
- * `[.after]` - macro to add additional text after the rendered output, can be used only once, additional occurrences of macro will overwrite text
354
+ * `[.after]` - block text that adds additional text after the rendered output, can be used only once, additional occurrences of macro will overwrite text
355
355
 
356
- * `[.after, package="Another"]` - macro with text to be inserted before(after in case of `.before` name) the package
356
+ * `[.after, package="Another"]` - block text to be inserted before(after in case of `.before` name) the package
357
357
 
358
- * `[.diagram_include_block]` - macro to automatically include diagram images. Attribute `base_path` is a required attribute to supply path prefix where to look for a diagram image. `format` is an optional attribute that tells what file extension to use when including diagram file. The logic is as follows:
358
+ * `[.package_text, position="after", package="Another"]` - include custom adoc code into package rendered body, `position` is a arequired attribute which tells where to insert the code.
359
+
360
+ * `[.package_text, package="Another"]` - same as above, but include block will be included only for supplied package name
361
+
362
+ * `[.diagram_include_block]` - block text to automatically include diagram images. Attribute `base_path` is a required attribute to supply path prefix where to look for a diagram image. `format` is an optional attribute that tells what file extension to use when including diagram file.
363
+ +
364
+ The logic is as follows:
359
365
  [source,adoc]
360
366
  -----
361
367
  {% for diagram in package.diagrams %}
@@ -377,11 +383,30 @@ For instance, the script will take package diagrams supplied in the XMI file and
377
383
 
378
384
  * `[.include_block, package="Another", base_path="spec/fixtures"]` - same as above, but include block will be included only for supplied package name
379
385
 
380
- In addition to the macros listed above that can be used only inside `lutaml_uml_datamodel_description` macro there is another macro called `lutaml_figure`. `lutaml_figure` is used to lookup and reference xmi package diagrams. The syntax is as follows:
386
+
387
+ NOTE: .after, .before, package_text and include_block macroses all can be used with additional option - `liquid`, if this option is supplied then the code inside block will be interpolated in liquid context
388
+
389
+
390
+ There are two other commands that are used to refer to LutaML generated document elements:
391
+
392
+ * `lutaml_figure`. Provides a reference anchor to a figure defined in the XMI
393
+ file, using its XMI ID for reference.
394
+
395
+ * `lutaml_table`. Provides a reference anchor to the definition tables of a
396
+ particular package, class, enumeration or data type object in the XMI.
397
+
398
+ The syntax is as follows:
381
399
 
382
400
  [source,adoc]
383
401
  -----
402
+ // For lutaml_figure
384
403
  This is lutaml_figure::[package="Wrapper root package", name="Fig B1 Full model"] figure
404
+
405
+ // For lutaml_table
406
+ This is lutaml_table::[package="Wrapper root package"] package
407
+ This is lutaml_table::[package="Wrapper root package", class="my name"] class
408
+ This is lutaml_table::[package="Wrapper root package", enum="my name"] enumeration
409
+ This is lutaml_table::[package="Wrapper root package", data_type="my name"] data type
385
410
  -----
386
411
 
387
412
  This code will be transformed into `<<figure-{diagram.xmi_id}>>` and will point to diagram figure. One can only use this macro when document rendered `lutaml_uml_datamodel_description` macro as it needs diagram lookup table in order to reference package diagram.
@@ -418,9 +443,9 @@ Content for CityGML package
418
443
 
419
444
  ==== Defining tables
420
445
 
421
- .<<tab-P-another-C-{XMI_ID}>> -- Elements of &#8220;Another::AbstractAtomicTimeseries&#8221; (class)
446
+ .<<section-EAPK_9C96A88B_E98B_490b_8A9C_24AEDAC64293>> -- Elements of &#8220;Another::AbstractAtomicTimeseries&#8221; (class)
422
447
 
423
- [[tab-P-another-C-{XMI_ID}]]
448
+ [[section-EAPK_9C96A88B_E98B_490b_8A9C_24AEDAC64293]]
424
449
  .Elements of &#8220;Another::AbstractAtomicTimeseries&#8221; (class)
425
450
  [width="100%",cols="a,a,a,a,a,a,a,a"]
426
451
  |===
@@ -462,13 +487,20 @@ h|Constraints: 7+| (none)
462
487
  text after CityGML package
463
488
  -----
464
489
 
465
- In addition to just supplying an XMI file, this macro also supports a YAML
466
- configuration file.
490
+ In addition to the XMI file, this macro also supports a YAML configuration file
491
+ that specifies:
492
+
493
+ * What packages to include in the render;
467
494
 
468
- The format for using YAML is this:
495
+ * What render style is desired;
496
+
497
+ * Location of the root package (which package should the iterative process start
498
+ at).
499
+
500
+ The format for using the YAML configuration file:
469
501
 
470
502
  [source,yaml]
471
- -----
503
+ ----
472
504
  ---
473
505
  packages:
474
506
  # includes these packages
@@ -477,21 +509,49 @@ packages:
477
509
  - three
478
510
  # skips these packages
479
511
  - skip: four
480
- render_style: entity_list|data_dictionary|default
512
+ render_style: entity_list | data_dictionary | default
481
513
  section_depth: 2
482
- -----
514
+ ----
483
515
 
484
516
  Where:
485
517
 
486
518
  * `packages` - required, root element with the list of strings or objects
519
+
487
520
  * `Package *` - pattern matching, specifies lookup condition for packages to
488
521
  render.
489
522
  +
490
523
  NOTE: In this example, it is equal to the following regular expression: `/^Package.*$/`
491
524
 
492
525
  * `skip: four` - object with package name to skip
493
- * `render_style` - what template to use to render packages, can be: entity_list, data_dictionary or default
494
- * `section_depth` - what package to use as root package for render, eg `section_depth` equal to 2 tells processor to use first nested package of the first root packages in xmi file. Example: if xmi file has this package structure: [{ name: 'One', packages: [{ name: 'one-1' }, { name: 'one-2' }] }, { name: 'Two', packages: [{ name: 'two-1' }, { name: 'two-2' }] }] and we have `section_depth` equal to 2, root package will be `one-1`
526
+
527
+ * `render_style` - what template to use to render packages, can be one of:
528
+
529
+ ** `entity_list`
530
+
531
+ ** `data_dictionary`; or
532
+
533
+ ** `default`
534
+
535
+ * `section_depth` - what package to use as root package for render.
536
+ e.g., a `section_depth` equal to `2` tells the processor to use the first
537
+ nested package of the first root packages in XMI file.
538
+ +
539
+ EXAMPLE: If the XMI file has this package structure, and we have `section_depth`
540
+ equal to 2, root package will be `one-1`.
541
+ +
542
+ [source,json]
543
+ ----
544
+ [
545
+ {
546
+ name: 'One',
547
+ packages: [{ name: 'one-1' }, { name: 'one-2' }]
548
+ },
549
+ {
550
+ name: 'Two',
551
+ packages: [{ name: 'two-1' }, { name: 'two-2' }]
552
+ }
553
+ ]
554
+ ----
495
555
 
496
556
  Usage with macro:
497
557
 
@@ -505,10 +565,11 @@ Usage with macro:
505
565
  ----
506
566
  --
507
567
 
508
- The macro processor will read supplied YAML file and arrange packages according
509
- to the order supplied in the config file, also all packages supplied as `skip`
510
- will be skipped during render
568
+ The processor will read the supplied YAML config file (`path/to/config.yml`),
569
+ and iterate through packages according to the order supplied in the file. All
570
+ packages that matches `skip` in the YAML config file will be skipped during
571
+ render.
511
572
 
512
573
  == Documentation
513
574
 
514
- Please refer to https://www.metanorma.com.
575
+ Please refer to https://www.metanorma.oeg.
@@ -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
@@ -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 %}
@@ -10,17 +17,56 @@
10
17
  {% elsif is_package_spare == 'Spare' %}{% continue %}
11
18
  {% endif %}
12
19
 
13
- {% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}
20
+ {% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}{{equalsigns}} {{ package.name }} package
21
+ [[section-{{ package.xmi_id }}]]
22
+ {{equalsigns}}= {{ package.name }} overview
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 %}
14
34
 
15
- [[lutaml-section-{{ package_name }}]]
16
- {{equalsigns}} {{ package.name }} package
35
+ {% if block.liquid %}
36
+ {{ block.text | interpolate }}
37
+ {% else %}
38
+ {{ block.text }}
39
+ {% endif %}
40
+ {% endif %}
17
41
 
18
- {{equalsigns}}= {{ package.name }} overview
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 %}
19
58
 
20
59
  {% assign before_package_key = 'before;' | append: package.name %}
21
60
  {% if additional_context[before_package_key] and additional_context[before_package_key].size > 0 %}
22
61
  {% for before in additional_context[before_package_key] %}
62
+ {% if before.text %}
63
+
64
+ {% if before.liquid %}
65
+ {{ before.text | interpolate }}
66
+ {% else %}
23
67
  {{ before.text }}
68
+ {% endif %}
69
+ {% endif %}
24
70
  {% endfor %}
25
71
  {% endif %}
26
72
  {% if additional_context.diagram_include_block %}
@@ -54,8 +100,8 @@
54
100
  {% elsif is_klass_spare == 'Spare' %}{% continue %}
55
101
  {% endif %}
56
102
  {% assign klass_name = klass.name | downcase | replace: ':', '' | replace: ' ', '_' %}
57
- {% assign klass_xid = klass.xmi_id %}
58
- .<<tab-P-{{ package_name }}-C-{{ klass_xid }}>> -- Elements of "{{ package.name }}::{{ klass.name }}"
103
+ [[section-{{ klass.xmi_id }}]]
104
+ .Elements of &#8220;{{ package.name }}::{{ klass.name }}&#8221; ({{ klass.stereotype }})
59
105
 
60
106
  {% endfor %}
61
107
  {% for enum in package.enums %}
@@ -64,8 +110,8 @@
64
110
  {% elsif is_enum_spare == 'Spare' %}{% continue %}
65
111
  {% endif %}
66
112
  {% assign enum_name = enum.name | downcase | replace: ':', '' | replace: ' ', '_' %}
67
- {% assign enum_xid = enum.xmi_id %}
68
- .<<tab-P-{{ package_name }}-E-{{ enum_xid }}>> -- Elements of "{{ package.name }}::{{ enum.name }}"
113
+ [[section-{{ enum.xmi_id }}]]
114
+ .Elements of &#8220;{{ package.name }}::{{ enum.name }}&#8221; ({{ enum.stereotype }})
69
115
 
70
116
  {% endfor %}
71
117
  {% for data_type in package.data_types %}
@@ -74,8 +120,8 @@
74
120
  {% elsif is_data_type_spare == 'Spare' %}{% continue %}
75
121
  {% endif %}
76
122
  {% assign data_type_name = data_type.name | downcase | replace: ':', '' | replace: ' ', '_' %}
77
- {% assign data_type_xid = data_type.xmi_id %}
78
- .<<tab-P-{{ package_name }}-DT-{{ data_type_xid }}>> -- 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 }})
79
125
 
80
126
  {% endfor %}
81
127
 
@@ -113,18 +159,65 @@
113
159
  {% capture block_content %}{% include block_filename %}{% endcapture %}
114
160
  {% unless block_content contains "Liquid error" %}
115
161
  {% if block.text %}
162
+
163
+ {% if block.liquid %}
164
+ {{ block.text | interpolate }}
165
+ {% else %}
116
166
  {{ block.text }}
117
167
  {% endif %}
168
+ {% endif %}
118
169
  {{ block_content }}
119
170
  {% endunless %}
120
171
  {% endfor %}
121
172
  {% endif %}
122
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 %}
188
+ {{ block.text }}
189
+ {% endif %}
190
+ {% endif %}
191
+
192
+ {{ block_content }}
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 %}
206
+ {% endfor %}
207
+ {% endif %}
208
+
123
209
  {% assign after_package_key = 'after;' | append: package.name %}
124
210
  {% if additional_context[after_package_key] %}
125
211
  {{equalsigns}}= Additional information
126
212
  {% for after in additional_context[after_package_key] %}
213
+ {% if after.text %}
214
+
215
+ {% if after.liquid %}
216
+ {{ after.text | interpolate }}
217
+ {% else %}
127
218
  {{ after.text }}
219
+ {% endif %}
220
+ {% endif %}
128
221
  {% endfor %}
129
222
  {% endif %}
130
223
  {% if package.packages.size > 0 and render_nested_packages %}
@@ -134,6 +227,13 @@
134
227
 
135
228
  {% if additional_context.after and additional_context.after.size > 0 %}
136
229
  {% for after in additional_context.after %}
230
+ {% if after.text %}
231
+
232
+ {% if after.liquid %}
233
+ {{ after.text | interpolate }}
234
+ {% else %}
137
235
  {{ after.text }}
236
+ {% endif %}
237
+ {% endif %}
138
238
  {% endfor %}
139
239
  {% endif %}
@@ -3,9 +3,8 @@
3
3
  {% elsif is_klass_spare == 'Spare' %}{% continue %}
4
4
  {% endif %}
5
5
  {% assign klass_name = klass.name | downcase | replace: ':', '' | replace: ' ', '_' %}
6
- {% assign klass_xid = klass.xmi_id %}
7
- [[tab-P-{{ package_name }}-C-{{ klass_xid }}]]
8
- .Elements of "{{ package.name }}::{{ klass.name }}" (class)
6
+ [[section-{{ klass.xmi_id }}]]
7
+ .Elements of &#8220;{{ package.name }}::{{ klass.name }}&#8221; ({{ klass.stereotype }})
9
8
  [width="100%",cols="a,a,a,a,a,a,a,a"]
10
9
  |===
11
10
 
@@ -70,8 +69,8 @@ h| Public attributes:
70
69
 
71
70
  {% if klass.constraints.size > 0 %}
72
71
  .{{ klass.constraints.size }}+h| Constraints:
73
- {% for constr in klass.constraints %}
74
- 7+| `{{ constr.body }}`
72
+ {% for constraint in klass.constraints %}
73
+ 7+| `{{ constraint.body }}`: `{{ constraint.definition | replace: '|', '\|' }}`
75
74
 
76
75
  {% endfor %}
77
76
  {% else %}