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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6975d55ed93f086ff54367a880fe6cd997da1040dd5266d3c5c2f5c984370801
4
- data.tar.gz: fa336cbe86550862521a4fe051a69dfdd8e809cc3ba652c07482ab6f9d5bb7ac
3
+ metadata.gz: c3ac25c64f997af2bb3228af3816a9aafe2ea0b62a8c80eaa58f598cba8085e2
4
+ data.tar.gz: 824ab598854889b1a7079d872d96f515757719436eba95850eb7a85d924e23fc
5
5
  SHA512:
6
- metadata.gz: bf4817cf9ec3c41195ae30425bf4462f58dffce5773f4f07e146915a13fc7c1f9e46be8285c5f4814a673a7558aacb937b7e0dfb3939c644ad9b8cb438c1a580
7
- data.tar.gz: e987082dd620fcf4b455204e86607df45632c5ce9bdca7dfd30815c1c720a6facab339a436d90cc8b78809c608c2271a8f7cb3e32dbad66205a25e3f11c525a7
6
+ metadata.gz: 68246a6140b1a29548a77c10e7949058652c4be9e1ec2ee150d698f777e0bb91c2c4d75abaac3f69b8d09089f945cc24fff150a9ac83acf6ff36c521bd8c1c97
7
+ data.tar.gz: a8c60e3c539d000334fafa9b43d3e89a144dd327f9c212445aae35a547f1dd6ce0214df15b3223d8306829d3e3f938318331b1581c9220ff330e8cfd5817f0fb
data/README.adoc CHANGED
@@ -1,21 +1,36 @@
1
- = metanorma-plugin-lutaml
1
+ = Metanorma LutaML plugin (metanorma-plugin-lutaml)
2
2
 
3
3
  image:https://github.com/metanorma/metanorma-plugin-lutaml/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-plugin-lutaml/actions?workflow=rake"]
4
4
 
5
- == Functionality
5
+ == Purpose
6
6
 
7
- Metanorma plugin that allows you to access lutaml objects from a Metanorma document
7
+ LutaML is a data model accessor that supports various data model formats,
8
+ including:
8
9
 
9
- === Installation
10
+ * EXPRESS (`*.exp` files)
11
+ * OMG UML in XMI format (`*.xmi` files)
12
+
13
+ This plugin allows you to access LutaML models from within a Metanorma document.
14
+
15
+ == Installation
10
16
 
11
17
  [source,console]
12
18
  ----
13
19
  $ gem install metanorma-plugin-lutaml
14
20
  ----
15
21
 
16
- === Usage, `lutaml` macro
17
22
 
18
- Given `example.exp` file with the content:
23
+ == Usage with EXPRESS
24
+
25
+ === General
26
+
27
+ LutaML supports accessing EXPRESS models via the
28
+ https://github.com/lutaml/expressir[Expressir] parser.
29
+
30
+
31
+ === Usage of the `lutaml` macro
32
+
33
+ Given an `example.exp` EXPRESS file with the content:
19
34
 
20
35
  [source,exp]
21
36
  ----
@@ -71,17 +86,18 @@ source directory that `[lutaml]` is used (e.g., if
71
86
  `/foo/bar/doc.adoc`, the data file is expected to be found at
72
87
  `/foo/bar/example.exp`);
73
88
 
74
- * `{my_context}` is the name where the EXPRESS Repository read from the .exp
75
- file can be accessed with. Context object is a serialized
76
- `Expressir::Model::Repository` object with all variable names available. See
89
+ * `{my_context}` is the name where the EXPRESS Repository read from the `.exp`
90
+ file can be accessed with.
91
+
92
+ ** The `context` object is a serialized `Expressir::Model::Repository` object
93
+ with all variable names available. See
77
94
  https://github.com/lutaml/expressir[Expressir] docs for reference.
78
95
  `{my_context}` has `schemas` method to access Expressir
79
96
  https://github.com/lutaml/expressir/blob/master/lib/expressir/model/schema.rb[schemas]
80
97
 
81
98
  Will produce this output:
82
99
 
83
- [source,adoc]
84
- -----
100
+ ____
85
101
  == test_schema
86
102
 
87
103
  === my_type1
@@ -89,9 +105,9 @@ Will produce this output:
89
105
  === my_type3
90
106
  === my_type4
91
107
  === my_type5
92
- -----
108
+ ____
93
109
 
94
- This macro also supports `.lutaml` files.
110
+ This command also supports `.lutaml` files.
95
111
 
96
112
  Instead of using the direct path to the file one can use `lutaml-express-index`
97
113
  document attribute to supply directory with express files or YAML index file to
@@ -120,19 +136,22 @@ Example of usage:
120
136
  -----
121
137
  = Document title
122
138
  Author
123
- :lutaml-express-index: my_custom_name; /path/to/express_files; cache=/path/to/cache_file.yaml
124
- [lutaml,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]
125
141
  ----
126
- {% for schema in my_context.schemas %}
142
+ {% for schema in context.schemas %}
127
143
  == {{schema.id}}
128
144
  {% endfor %}
129
145
  ----
130
146
  -----
131
147
 
132
- === Usage, `lutaml_diagram` macro
148
+ == Usage with UML
133
149
 
134
- This macro allows to quickly render lutaml file as diagram image.
135
- 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:
136
155
 
137
156
  [source,java]
138
157
  ----
@@ -142,7 +161,7 @@ diagram MyView {
142
161
  enum AddressClassProfile {
143
162
  imlicistAttributeProfile: CharacterString [0..1] {
144
163
  definition
145
- this is multiline with `ascidoc`
164
+ this is multiline with `asciidoc`
146
165
  end definition
147
166
  }
148
167
  }
@@ -156,16 +175,17 @@ diagram MyView {
156
175
  }
157
176
  ----
158
177
 
159
- And the `lutaml_diagram` macro:
178
+ The `lutaml_diagram` command will add the image to the document.
160
179
 
161
180
  [source,adoc]
162
181
  -----
163
182
  lutaml_diagram::example.lutaml[]
164
183
  -----
165
184
 
166
- 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.
167
187
 
168
- Also one can use `lutaml_diagram` block with embed lutaml code instead of block macro. Example:
188
+ For example:
169
189
 
170
190
  [source,java]
171
191
  ----
@@ -176,9 +196,9 @@ diagram MyView {
176
196
 
177
197
  enum AddressClassProfile {
178
198
  imlicistAttributeProfile: CharacterString [0..1] {
179
- definition
180
- this is multiline with `ascidoc`
181
- end definition
199
+ definition {
200
+ This is multiline AsciiDoc content.
201
+ }
182
202
  }
183
203
  }
184
204
 
@@ -193,9 +213,9 @@ diagram MyView {
193
213
  ----
194
214
 
195
215
 
196
- === Usage, `lutaml_uml_attributes_table` macro
216
+ === `lutaml_uml_attributes_table`
197
217
 
198
- This macro allows to quickly render data model attributes/values tables.
218
+ This command allows rendering definition tables for a UML model.
199
219
 
200
220
  Given `example.lutaml` file with the content:
201
221
 
@@ -230,23 +250,22 @@ And the `lutaml_uml_attributes_table` macro:
230
250
 
231
251
  Will produce this output:
232
252
 
233
- [source,adoc]
234
- -----
253
+ ____
235
254
  === AttributeProfile
236
255
 
237
-
238
256
  .AttributeProfile attributes
239
257
  |===
240
258
  |Name |Definition |Mandatory/ Optional/ Conditional |Max Occur |Data Type
241
259
 
242
- |addressClassProfile |TODO: enum 's definition |M |1 | `CharacterString`
260
+ |addressClassProfile |TODO: enum's definition |M |1 | `CharacterString`
243
261
 
244
262
  |imlicistAttributeProfile |this is attribute definition with multiply lines |M |1 | `CharacterString`
245
263
 
246
264
  |===
247
- -----
265
+ ____
248
266
 
249
- In case of "enumeration"(AddressClassProfile) entity:
267
+
268
+ In case of "enumeration" (AddressClassProfile) entity:
250
269
 
251
270
  [source,adoc]
252
271
  -----
@@ -255,23 +274,21 @@ In case of "enumeration"(AddressClassProfile) entity:
255
274
 
256
275
  Will produce this output:
257
276
 
258
- [source,adoc]
259
- -----
277
+ ____
260
278
  === AddressClassProfile
261
279
 
262
-
263
280
  .AddressClassProfile values
264
281
  |===
265
282
  |Name |Definition
266
283
 
267
- |imlicistAttributeProfile |this is multiline with `ascidoc`
284
+ |imlicistAttributeProfile |this is multiline with `asciidoc`
268
285
 
269
286
  |===
270
- -----
287
+ ____
271
288
 
272
- === Usage, `lutaml_uml_datamodel_description` macro
289
+ === Usage of `lutaml_uml_datamodel_description` macro
273
290
 
274
- 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
275
292
  objects for supplied XMI file.
276
293
 
277
294
  Given an Enterprise Architect `example.xmi` file with 2 packages:
@@ -332,13 +349,19 @@ Where:
332
349
 
333
350
  * `path/to/example.xmi` - required, path to the XMI file to render
334
351
 
335
- * `[.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
+
354
+ * `[.after]` - block text that adds additional text after the rendered output, can be used only once, additional occurrences of macro will overwrite text
336
355
 
337
- * `[.after]` - macro to add additional text after the rendered output, can be used only once, additional occurrences of macro will overwrite text
356
+ * `[.after, package="Another"]` - block text to be inserted before(after in case of `.before` name) the package
338
357
 
339
- * `[.after, package="Another"]` - macro with text to be inserted before(after in case of `.before` name) the package
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.
340
359
 
341
- * `[.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 digram image. `format` is an optional attribute that tells what file extention to use when including diagram file. The logic is as follows:
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:
342
365
  [source,adoc]
343
366
  -----
344
367
  {% for diagram in package.diagrams %}
@@ -351,22 +374,42 @@ image::{{ image_base_path }}/{{ diagram.xmi_id }}.{{ format | default: 'png' }}[
351
374
  {% endif %}
352
375
  {% endfor %}
353
376
  -----
354
- Eg: script will take package diagrams supplied in xmi file and will try to include `image` with the name equal to diagram' xmi_id attribute plus `.png`. Also one can add any text to the macro text, it will be added as paragraph before each image include.
377
+
378
+ For instance, the script will take package diagrams supplied in the XMI file and will try to include `image` with the name equal to diagram' xmi_id attribute plus `.png`. Also one can add any text to the macro text, it will be added as paragraph before each image include.
355
379
 
356
380
  * `[.diagram_include_block, package="Another"]` - same as above, but diagram will be included only for supplied package name
357
381
 
358
- * `[.include_block, base_path="spec/fixtures"]` - macro to inlude files(adoc/liquid) for each package name. Attribute `base_path` is a required attribute to supply path prefix where to look for file to include. Macro will look for a file called `base_path` + `/` `_package_name`(downcase, replace : -> '', ' ' -> '_') + `.adoc`[`.liquid`], eg for package 'My Package name' and `base_path` eq to `my/path`, macro will look for the following file path: `my/path/_my_package_name.adoc`.
382
+ * `[.include_block, base_path="spec/fixtures"]` - macro to include files (`*.adoc` or `*.liquid`) for each package name. Attribute `base_path` is a required attribute to supply path prefix where to look for file to include. Macro will look for a file called `base_path` + `/` `_package_name`(downcase, replace : -> '', ' ' -> '_') + `.adoc`[`.liquid`], eg for package 'My Package name' and `base_path` eq to `my/path`, macro will look for the following file path: `my/path/_my_package_name.adoc`.
359
383
 
360
384
  * `[.include_block, package="Another", base_path="spec/fixtures"]` - same as above, but include block will be included only for supplied package name
361
385
 
362
- In addition to macroses 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:
363
399
 
364
400
  [source,adoc]
365
401
  -----
402
+ // For lutaml_figure
366
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
367
410
  -----
368
411
 
369
- 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 refernce package diagram.
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.
370
413
 
371
414
  Will produce this output:
372
415
 
@@ -380,18 +423,17 @@ Diagram text
380
423
 
381
424
  [[figure-EAID_ACBB5EE3_3428_40f5_9C7C_E41923419F29]]
382
425
  .CityGML Package Diagram
383
- image::requirements//EAID_ACBB5EE3_3428_40f5_9C7C_E41923419F29.png[]
426
+ image::requirements/EAID_ACBB5EE3_3428_40f5_9C7C_E41923419F29.png[]
384
427
 
385
428
  BuildingFurnitureFunctionValue is a code list that enumerates the different purposes of a BuildingFurniture.
386
429
 
387
430
  [[figure-EAID_938AE961_1C57_4052_B964_997D1894A58D]]
388
431
  .Use of ISO and OASIS standards in CityGML
389
- image::requirements//EAID_938AE961_1C57_4052_B964_997D1894A58D.png[]
432
+ image::requirements/EAID_938AE961_1C57_4052_B964_997D1894A58D.png[]
390
433
 
391
434
  The CityGML package is organized into
392
435
  2 packages with 1 modules:
393
436
 
394
- [arabic]
395
437
  . Another package
396
438
  . CityTML package
397
439
 
@@ -401,18 +443,17 @@ Content for CityGML package
401
443
 
402
444
  ==== Defining tables
403
445
 
404
- [arabic]
405
- .<<tab-P-another-C-abstractatomictimeseries>> -- Elements of Another::AbstractAtomicTimeseries
446
+ .<<section-EAPK_9C96A88B_E98B_490b_8A9C_24AEDAC64293>> -- Elements of &#8220;Another::AbstractAtomicTimeseries&#8221; (class)
406
447
 
407
- [[tab-P-another-C-abstractatomictimeseries]]
408
- .Elements of Another::AbstractAtomicTimeseries
448
+ [[section-EAPK_9C96A88B_E98B_490b_8A9C_24AEDAC64293]]
449
+ .Elements of &#8220;Another::AbstractAtomicTimeseries&#8221; (class)
409
450
  [width="100%",cols="a,a,a,a,a,a,a,a"]
410
451
  |===
411
452
  h|Name: 7+| AbstractAtomicTimeseries
412
453
  h|Definition: 7+|
413
454
  h|Stereotype: 7+| interface
414
455
  h|Abstract: 7+|
415
- .1+h|Associations: 7+| (none)
456
+ h|Associations: 7+| (none)
416
457
  .4+h|Public attributes:
417
458
  | _Name_
418
459
  2+| _Definition_
@@ -446,13 +487,20 @@ h|Constraints: 7+| (none)
446
487
  text after CityGML package
447
488
  -----
448
489
 
449
- In addition to just supplying XMI file, this macro also supports YAML
450
- 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;
494
+
495
+ * What render style is desired;
451
496
 
452
- The format for using YAML is this:
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:
453
501
 
454
502
  [source,yaml]
455
- -----
503
+ ----
456
504
  ---
457
505
  packages:
458
506
  # includes these packages
@@ -461,34 +509,67 @@ packages:
461
509
  - three
462
510
  # skips these packages
463
511
  - skip: four
464
- render_style: entity_list|data_dictionary|default
512
+ render_style: entity_list | data_dictionary | default
465
513
  section_depth: 2
466
- -----
514
+ ----
467
515
 
468
516
  Where:
469
517
 
470
518
  * `packages` - required, root element with the list of strings or objects
519
+
471
520
  * `Package *` - pattern matching, specifies lookup condition for packages to
472
521
  render.
473
522
  +
474
523
  NOTE: In this example, it is equal to the following regular expression: `/^Package.*$/`
475
524
 
476
525
  * `skip: four` - object with package name to skip
477
- * `render_style` - what template to use to render packages, can be: entity_list, data_dictionary or default
478
- * `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
+ ----
479
555
 
480
556
  Usage with macro:
481
557
 
482
558
  [source,adoc]
483
- -----
559
+ --
484
560
  [lutaml_uml_datamodel_description, path/to/example.xmi, path/to/config.yml]
485
- ....
486
- -----
561
+ ----
562
+ [.diagram_include_block, base_path="models/Images", format="png"]
563
+ ...
564
+ ...
565
+ ----
566
+ --
487
567
 
488
- The macro processor will read supplied YAML file and arrange packages according
489
- to the order supplied in the config file, also all packages supplied as `skip`
490
- 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.
491
572
 
492
573
  == Documentation
493
574
 
494
- 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 %}
@@ -11,12 +18,55 @@
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 %}
@@ -28,7 +78,7 @@
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 %}