metanorma-plugin-lutaml 0.7.32 → 0.7.33

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd1f666910d8626ed3c60a6543c1d0922a1b988941acb672484757dc42e4e1d2
4
- data.tar.gz: f40aa319451eaf3444f9bbb06a45aa2f28281fb81d9bc0db40fa5f2699c52d6d
3
+ metadata.gz: 249c6be1ae1a19967a906113b2142e3608e65ffc784e85bb990a7226b4818982
4
+ data.tar.gz: 405ea5857dab3f2750d0ab8c4a27c9a0abc119f97dccbe0b67f143cfe780e754
5
5
  SHA512:
6
- metadata.gz: '096af413077b87f001e1746914fe05f833c83ff698d60383c57e7daf4aa88aae61244d034836ea01eb66bd787940065c4689210d2e9bf7de69b499e6ee96adf5'
7
- data.tar.gz: 9873bf6b1a5439de6c1aa6480631fc820a0a857e079438fa7ee987cd3fa6a2d069976986d587345bd9e1f4a6466efcae087d06f88647316d3b1afbb46021c0ae
6
+ metadata.gz: 3008f74df51c0ed75b44a87acc302ac0fcecf5e4e2501e7c55de8aac6023a7e247df13e088d554b217280c3329049c826768e3d5557cddbd63570810262d7d45
7
+ data.tar.gz: bf0891bae566ccbeaacd9a98516e2495642d9629c8eed5adc8e9b4025338fe1fcfd7aa2c5555f2f0c4e2795d25a4e7ee98c760b7eaf486c16762efb4318533cb
@@ -0,0 +1,13 @@
1
+ module Metanorma
2
+ module Plugin
3
+ module Lutaml
4
+ module Liquid
5
+ module CustomFilters
6
+ def file_exist(path)
7
+ File.exist?(path)
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -8,74 +8,122 @@
8
8
  [width="100%",cols="a,a,a,a,a,a,a,a"]
9
9
  |===
10
10
 
11
- h|Name: 7+| {{ klass.name }}
11
+ h|Name 7+| {{ klass.name }}
12
12
 
13
- h|Definition: 7+| {{ klass.definition | html2adoc }}
13
+ h|Definition 7+| {{ klass.definition | html2adoc }}
14
14
 
15
- h|Stereotype: 7+| {{ klass.stereotype | default: 'interface' }}
15
+ h|Stereotype 7+| {{ klass.stereotype | default: 'interface' }}
16
16
 
17
17
  {% assign inherited = klass.associations | where: "member_end_type", "inheritance" %}
18
18
  {% if inherited.size > 0 %}
19
- h|Inheritance from: 7+| {{ inherited | map: 'member_end' | join: ", " }}
19
+ h|Inherits from 7+| {{ inherited | map: 'member_end' | join: ", " }}
20
20
  {% endif %}
21
21
 
22
22
  {% assign generalizations = klass.associations | where: "member_end_type", "generalization" %}
23
23
  {% if generalizations.size > 0 %}
24
- h|Generalization of: 7+| {{ generalizations | map: 'member_end' | join: ", " }}
24
+ h|Generalization of 7+| {{ generalizations | map: 'member_end' | join: ", " }}
25
25
  {% endif %}
26
26
 
27
- h|Abstract: 7+| {% if klass.is_abstract %}True{% else %}False{% endif %}
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
30
  {% if aggregations.size > 0 %}
30
- .{{aggregations.size | plus: 1}}+h|Associations:
31
- 4+| _Association with_
32
- | _Obligation_
33
- | _Maximum occurrence_
34
- | _Provides_
31
+
32
+ {% assign associations_colspan = aggregations.size | plus: 1 %}
33
+ {% for assoc in aggregations %}
34
+ {% if assoc.connector && assoc.connector.source %}
35
+ {% assign associations_colspan = associations_colspan | plus: 1 %}
36
+ {% endif %}
37
+ {% if assoc.connector && assoc.connector.target %}
38
+ {% assign associations_colspan = associations_colspan | plus: 1 %}
39
+ {% endif %}
40
+ {% endfor %}
41
+
42
+ .{{associations_colspan}}+h|Associations
43
+ 2+h| _Name_
44
+ 2+h| _Type_
45
+ 3+h| _Definition_
35
46
 
36
47
  {% for assoc in aggregations %}
37
- 4+| {{assoc.member_end}}
38
- | {% if assoc.member_end_cardinality %}{{ assoc.member_end_cardinality.min }}{% endif %}
39
- | {% if assoc.member_end_cardinality %}{{ assoc.member_end_cardinality.max }}{% endif %}
40
- | {{ assoc.member_end_attribute_name }}
48
+
49
+ {% assign member_end_documentation_size = assoc.member_end.definition | size %}
50
+ {% capture member_end_documentation %}{% if member_end_documentation_size > 0 %}{{ assoc.member_end.definition }}{% else %}(none){% endif %}{% endcapture %}
51
+
52
+ 2+| {{ assoc.member_end }}
53
+ 2+| {{ assoc.member_end_attribute_name }}
54
+ 3+| {{ member_end_documentation | html2adoc }}
55
+
56
+ {% if assoc.connector && assoc.connector.source %}
57
+ {% assign source_name_size = assoc.connector.source.name | size %}
58
+ {% capture source_name %}{% if source_name_size > 0 %}{{ assoc.connector.source.name }}{% else %}(self){% endif %}{% endcapture %}
59
+ {% assign source_documentation_size = assoc.connector.source.documentation | size %}
60
+ {% capture source_documentation %}{% if source_documentation_size > 0 %}{{ assoc.connector.source.documentation }}{% else %}(none){% endif %}{% endcapture %}
61
+ {% assign source_multiplicity_size = assoc.connector.source.multiplicity | size %}
62
+ {% capture source_multiplicity %}{% if source_multiplicity_size > 0 %}[{{ assoc.connector.source.multiplicity }}]{% else %}[none]{% endif %}{% endcapture %}
63
+
64
+ 2+| source:{{ source_name }} {{ source_multiplicity }}
65
+ 2+| {{ assoc.connector.source.type }}
66
+ 3+| {{ source_documentation | html2adoc }}
67
+ {% endif %}
68
+
69
+ {% if assoc.connector && assoc.connector.target %}
70
+ {% assign target_name_size = assoc.connector.target.name | size %}
71
+ {% capture target_name %}{% if target_name_size > 0 %}{{ assoc.connector.target.name }}{% else %}(self){% endif %}{% endcapture %}
72
+ {% assign target_documentation_size = assoc.connector.target.documentation | size %}
73
+ {% capture target_documentation %}{% if target_documentation_size > 0 %}{{ assoc.connector.target.documentation }}{% else %}(none){% endif %}{% endcapture %}
74
+ {% assign target_multiplicity_size = assoc.connector.target.multiplicity | size %}
75
+ {% capture target_multiplicity %}{% if target_multiplicity_size > 0 %}[{{ assoc.connector.target.multiplicity }}]{% else %}[none]{% endif %}{% endcapture %}
76
+
77
+ 2+| target:{{ target_name }} {{ target_multiplicity }}
78
+ 2+| {{ assoc.connector.target.type }}
79
+ 3+| {{ target_documentation | html2adoc }}
80
+ {% endif %}
41
81
 
42
82
  {% endfor %}
43
83
  {% else %}
44
- h| Associations: 7+| (none)
84
+ h| Associations 7+| (none)
45
85
  {% endif %}
46
86
 
47
87
  {% if klass.attributes.size > 0 %}
48
- .{{klass.attributes.size | plus: 1}}+h|Public attributes:
49
- | _Name_
50
- 2+| _Definition_
51
- | _Derived_
52
- | _Obligation_
53
- | _Maximum occurrence_
54
- | _Data type_
88
+ .{{klass.attributes.size | plus: 1}}+h|Attributes
89
+ 2+h| _Name_
90
+ 2+h| _Type_
91
+ 3+h| _Definition_
55
92
 
56
93
  {% for attr in klass.attributes %}
57
- | {{attr.name}}
58
- 2+| {{ attr.definition | html2adoc }}
59
- | {{ attr.is_derived }}
60
- | {{attr.cardinality.min}}
61
- | {{attr.cardinality.max}}
62
- | {{attr.type}}
94
+ {% capture attr_cardinality %}[{{attr.cardinality.min}}..{{attr.cardinality.max}}]{% endcapture %}
95
+ {% if attr_cardinality == "[*..*]" or attr_cardinality == "[0..*]" %}
96
+ {% assign attr_cardinality = "[*]" %}
97
+ {% endif %}
98
+ {% if attr_cardinality == "[1..1]" %}
99
+ {% assign attr_cardinality = "[1]" %}
100
+ {% endif %}
101
+ {% if attr_cardinality == "[..]" %}
102
+ {% assign attr_cardinality = "[none]" %}
103
+ {% endif %}
104
+
105
+ {% assign attr_definition_size = attr.definition | size %}
106
+ {% capture attr_definition %}{% if attr_definition_size > 0 %}{{ attr.definition }}{% else %}(none){% endif %}{% endcapture %}
107
+
108
+ 2+| {{ attr.name }} {{ attr_cardinality }}
109
+ 2+| {{ attr.type }}
110
+ 3+| {{ attr_definition | html2adoc }}
63
111
 
64
112
  {% endfor %}
65
113
  {% else %}
66
- h| Public attributes:
114
+ h| Attributes
67
115
  7+| (none)
68
116
  {% endif %}
69
117
 
70
118
  {% if klass.constraints.size > 0 %}
71
- .{{ klass.constraints.size }}+h| Constraints:
119
+ .{{ klass.constraints.size }}+h| Constraints
72
120
  {% for constraint in klass.constraints %}
73
121
  7+| `{{ constraint.body }}`: `{{ constraint.definition | replace: '|', '\|' }}`
74
122
 
75
123
  {% endfor %}
76
124
  {% else %}
77
125
 
78
- h|Constraints: 7+| (none)
126
+ h|Constraints 7+| (none)
79
127
  {% endif %}
80
128
 
81
129
  |===
@@ -33,8 +33,6 @@ module Metanorma
33
33
  reader.lines)
34
34
  input_lines = r.readlines.to_enum
35
35
 
36
- has_lutaml_liquid = input_lines.any? { |line| lutaml_liquid?(line) }
37
-
38
36
  express_indexes = Utils.parse_document_express_indexes(
39
37
  document,
40
38
  input_lines,
@@ -46,19 +44,11 @@ module Metanorma
46
44
  express_indexes: express_indexes,
47
45
  )
48
46
 
49
- log(document, result_content) if has_lutaml_liquid
50
-
51
47
  Asciidoctor::PreprocessorNoIfdefsReader.new(document, result_content)
52
48
  end
53
49
 
54
50
  protected
55
51
 
56
- def log(doc, text)
57
- File.open("#{doc.attr('docfile')}.lutaml.log.txt", "w:UTF-8") do |f|
58
- f.write(text.join("\n"))
59
- end
60
- end
61
-
62
52
  def lutaml_liquid?(line)
63
53
  line.match(EXPRESS_PREPROCESSOR_REGEX)
64
54
  end
@@ -7,6 +7,7 @@ require "metanorma/plugin/lutaml/liquid/custom_filters/html2adoc"
7
7
  require "metanorma/plugin/lutaml/liquid/custom_filters/values"
8
8
  require "metanorma/plugin/lutaml/liquid/custom_filters/replace_regex"
9
9
  require "metanorma/plugin/lutaml/liquid/custom_filters/loadfile"
10
+ require "metanorma/plugin/lutaml/liquid/custom_filters/file_exist"
10
11
 
11
12
  module Metanorma
12
13
  module Plugin
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Lutaml
4
- VERSION = "0.7.32".freeze
4
+ VERSION = "0.7.33".freeze
5
5
  end
6
6
  end
7
7
  end
@@ -29,11 +29,11 @@ Gem::Specification.new do |spec|
29
29
  spec.required_ruby_version = ">= 2.7.0" # rubocop:disable Gemspec/RequiredRubyVersion
30
30
 
31
31
  spec.add_dependency "asciidoctor"
32
- spec.add_dependency "coradoc", "~> 1.1.1"
33
- spec.add_dependency "expressir", "~> 2.1.13"
32
+ spec.add_dependency "coradoc", "~> 1.1"
33
+ spec.add_dependency "expressir", "~> 2.1"
34
34
  spec.add_dependency "isodoc"
35
35
  spec.add_dependency "liquid"
36
- spec.add_dependency "lutaml", "~> 0.9.32"
36
+ spec.add_dependency "lutaml", "~> 0.9"
37
37
  spec.add_dependency "ogc-gml", "~>1.0.0"
38
38
  spec.add_dependency "relaton-cli"
39
39
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-plugin-lutaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.32
4
+ version: 0.7.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-29 00:00:00.000000000 Z
11
+ date: 2025-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.1.1
33
+ version: '1.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.1.1
40
+ version: '1.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: expressir
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.1.13
47
+ version: '2.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.1.13
54
+ version: '2.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: isodoc
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.9.32
89
+ version: '0.9'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.9.32
96
+ version: '0.9'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: ogc-gml
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -161,6 +161,7 @@ files:
161
161
  - lib/metanorma/plugin/lutaml/file_not_found_error.rb
162
162
  - lib/metanorma/plugin/lutaml/json2_text_preprocessor.rb
163
163
  - lib/metanorma/plugin/lutaml/liquid/custom_blocks/key_iterator.rb
164
+ - lib/metanorma/plugin/lutaml/liquid/custom_filters/file_exist.rb
164
165
  - lib/metanorma/plugin/lutaml/liquid/custom_filters/html2adoc.rb
165
166
  - lib/metanorma/plugin/lutaml/liquid/custom_filters/loadfile.rb
166
167
  - lib/metanorma/plugin/lutaml/liquid/custom_filters/replace_regex.rb