metanorma-plugin-lutaml 0.7.54 → 0.7.55.pre.alpha.2

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: b6a443f1152ff2cf6f053744b7750e0e96426bc776cf0cb582b9c93f7d828f55
4
- data.tar.gz: 4f31cad3531f1f38525e2eaacee72917fee007a2a6099a772894ed6159ed5168
3
+ metadata.gz: 4df1a140d2fef0dd3a780ac070ab6f6a3906191da12c6d72b30883ad0217bf25
4
+ data.tar.gz: ad4569a0ce6ae86577978e7358de9e98c1955227755efa699a7182aca38ab428
5
5
  SHA512:
6
- metadata.gz: 4098ac9e010d91d65a98c21eb22abcbd7add8166f7dc93a1f0b2fdeeb790b40c70a274ef8b66f36aaa3402bcc3b481d9283ff4e766586b4a33e4c8dfd75e2463
7
- data.tar.gz: 9ed735f7bd7b870a8be1ad0847e4b9c47a2a411a23de2a7d98874c6d185286e60123d067c8e34be42b3d339ae021cee51190b50c8c0581a5a04c1ad47c64f654
6
+ metadata.gz: 31f6b4b4a670f661412cedc5cdb5538b074054f6618a35e06bfa15080af2dedba5075b237f163e4ba63e8ab99d95b92dc1ed8b99c35111a8abf588616fa62c37
7
+ data.tar.gz: 3edd282734af0e5b2d3f6e74daa6e5b9a310e51b022baca413ab00aac448a186a76d22ffb8e5924bacdf0c9c4aaf08b50ce877e2f63a22f83c3d536b68219258
data/Gemfile CHANGED
@@ -24,3 +24,19 @@ gem "simplecov"
24
24
  gem "timecop"
25
25
  gem "vcr"
26
26
  gem "webmock"
27
+
28
+ # leptris 1.9.367.0 is the highest match for standoc's '~> 1.9.361' but
29
+ # publishes only linux prebuilds plus a ruby gem with no vendored
30
+ # libleptris; windows-latest falls back to that ruby gem and dies on
31
+ # require "metanorma-standoc". 1.9.361.1 is the latest that still ships
32
+ # x64-mingw-ucrt (and darwin) binaries. Lift once upstream packs Windows
33
+ # again.
34
+ gem "leptris", "~> 1.9.361.1"
35
+
36
+ # pre-release line pins (see metanorma release wave)
37
+ gem "isodoc", github: "metanorma/isodoc", branch: "main"
38
+ gem "metanorma-standoc", github: "metanorma/metanorma-standoc", branch: "main"
39
+ gem "suma", github: "metanorma/suma", branch: "main"
40
+ # standoc main (>= 3.5.1.pre.alpha.2) floors metanorma-document at
41
+ # 0.5.2.pre.alpha.1 (SvgmapElement, metanorma-standoc#1303); main carries it
42
+ gem "metanorma-document", github: "metanorma/metanorma-document", branch: "main"
data/Gemfile.devel CHANGED
@@ -1,12 +1,12 @@
1
- gem "metanorma-standoc", github: "metanorma/metanorma-standoc", ref: "5ca49c85bbcc1422e48c4b625a66f7f026dc6832"
1
+ # gem "metanorma-standoc", github: "metanorma/metanorma-standoc", ref: "5ca49c85bbcc1422e48c4b625a66f7f026dc6832"
2
2
  gem "metanorma", github: "metanorma/metanorma", ref: "a899a9a6fc933dca0a53166d6633b609311b14e6"
3
3
  # relaton v3 prerelease line (rubyzip ~> 3.4, matching lutaml-model);
4
4
  # relaton-cli's v2line branch allows relaton 3 while keeping version
5
5
  # 2.1.2 for metanorma-standoc's constraint; the metanorma/standoc
6
6
  # refs are the known-good pair (newer standoc@main needs unreleased
7
7
  # metanorma-document components)
8
- gem "relaton", github: "relaton/relaton", ref: "65742ac31bce9e006072e1ace440c984352201f3"
9
- gem "relaton-cli", github: "relaton/relaton-cli", branch: "feat/allow-relaton-v3-v2line"
8
+ gem "relaton", "~> 3.0.0.pre.alpha"
9
+ gem "relaton-cli", "~> 3.0.0.pre.alpha"
10
10
 
11
11
  # lutaml-lml 0.1.5 adds Lutaml::Lml.parse + Formatter::Graphviz used by
12
12
  # the lutaml_diagram renderer; 0.1.1 (previously resolved) lacks them
data/Rakefile CHANGED
@@ -10,6 +10,7 @@ XMI_HEAVY_SPEC_FILES = %w[
10
10
  ].freeze
11
11
 
12
12
  XMI_SPEC_FILES = %w[
13
+ spec/metanorma/plugin/lutaml/lutaml_ea_uml_preprocessor_spec.rb
13
14
  spec/metanorma/plugin/lutaml/lutaml_klass_table_block_macro_spec.rb
14
15
  spec/metanorma/plugin/lutaml/lutaml_enum_table_block_macro_spec.rb
15
16
  spec/metanorma/plugin/lutaml/lutaml_xmi_index_spec.rb
@@ -208,11 +208,19 @@ classes:
208
208
  used: false
209
209
  guidance: |
210
210
  Drop guidance message here.
211
+ data_types:
212
+ - name: Name Of Datatype
213
+ attributes:
214
+ - name: Name Of Attribute (e.g. Root:value)
215
+ used: false
216
+ guidance: |
217
+ Drop guidance message here.
211
218
  ...
212
219
  ----
213
220
 
214
221
  If you want to define the guidance, you can define the `name` of the class
215
- under `classes`. Then define which `attributes` you want to add guidance by the
222
+ under `classes` (or the datatype under `data_types`). Then define which
223
+ `attributes` you want to add guidance by the
216
224
  `name`. Set `used` to show the attribute is used or not. Drop the message of
217
225
  guidance in `guidance`.
218
226
 
@@ -311,11 +319,19 @@ classes:
311
319
  used: false
312
320
  guidance: |
313
321
  Drop guidance message here.
322
+ data_types:
323
+ - name: "NameOfDatatype"
324
+ attributes:
325
+ - name: Name Of Attribute (e.g. Root:value)
326
+ used: false
327
+ guidance: |
328
+ Drop guidance message here.
314
329
  ...
315
330
  ----
316
331
 
317
332
  If you want to define the guidance, you can define the `name` of the class
318
- under `classes`. Then define which `attributes` you want to add guidance by the
333
+ under `classes` (or the datatype under `data_types`). Then define which
334
+ `attributes` you want to add guidance by the
319
335
  `name`. Set `used` to show the attribute is used or not. Drop the message of
320
336
  guidance in `guidance`.
321
337
 
@@ -7,9 +7,22 @@ module Metanorma
7
7
  class Guidance < ::Lutaml::Model::Serializable
8
8
  attribute :classes, GuidanceKlass, collection: true,
9
9
  initialize_empty: true
10
+ attribute :data_types, GuidanceKlass, collection: true,
11
+ initialize_empty: true
10
12
 
11
13
  yaml do
12
14
  map "classes", to: :classes
15
+ map "data_types", to: :data_types
16
+ end
17
+
18
+ # Drops index into both keys (KlassDrop reads ["classes"],
19
+ # DataTypeDrop reads ["data_types"]); empty collections are
20
+ # omitted from as_yaml, so pin both keys here.
21
+ def to_yaml_hash
22
+ super.tap do |hash|
23
+ hash["classes"] ||= []
24
+ hash["data_types"] ||= []
25
+ end
13
26
  end
14
27
  end
15
28
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "expressir"
4
+ require "pathname"
4
5
 
5
6
  module Metanorma
6
7
  module Plugin
@@ -16,7 +17,17 @@ module Metanorma
16
17
  )
17
18
  resolved = document.path_resolver
18
19
  .system_path(file_path, docfile_directory)
19
- File.expand_path(resolved, docfile_directory)
20
+ # The prefix lands inside emitted image macros, so it must not
21
+ # carry the absolute build path: two builds of the same tree in
22
+ # two directories produced different image/@src values
23
+ # (metanorma/metanorma-plugin-lutaml#325). A path relative to the
24
+ # docfile resolves to the same schema file at render time and is
25
+ # byte-identical across build directories.
26
+ # The docfile directory may be relative ("."): relative_path_from
27
+ # refuses mixed prefixes, so both sides expand first
28
+ Pathname.new(File.expand_path(resolved))
29
+ .relative_path_from(Pathname.new(File.expand_path(docfile_directory)))
30
+ .to_s
20
31
  end
21
32
 
22
33
  def self.for(model)
@@ -47,6 +58,7 @@ module Metanorma
47
58
  end
48
59
 
49
60
  def decorate_remarks(options)
61
+ promote_schema_prose
50
62
  decorate_own_remarks(options)
51
63
  decorate_child_remark_items(options)
52
64
  traverse_children(options)
@@ -54,7 +66,29 @@ module Metanorma
54
66
 
55
67
  private
56
68
 
69
+ # A bare (*"Schema_name" ...*) remark is the schema-level prose:
70
+ # expressir models it in Schema#remarks, not as a RemarkItem, so
71
+ # renders that walk remark_items (every clause-4 template) drop
72
+ # it (iso-10303#720). Promote it to a leading RemarkItem keyed
73
+ # by the schema path, the same way an entity-tagged remark names
74
+ # its target. The prose stays in Schema#remarks too; templates
75
+ # that already render it there keep working unchanged.
76
+ def promote_schema_prose
77
+ return unless @model.is_a?(Expressir::Model::Declarations::Schema)
78
+ return if @model.remarks.to_a.empty?
79
+
80
+ items = @model.remark_items.to_a
81
+ return if items.any? { |ri| ri.id == @model.id }
82
+
83
+ prose = Expressir::Model::Declarations::RemarkItem.new(
84
+ id: @model.id,
85
+ remarks: @model.remarks.dup,
86
+ )
87
+ @model.remark_items = [prose] + items
88
+ end
89
+
57
90
  def decorate_own_remarks(options)
91
+
58
92
  @model.remarks = ExpressRemarksDecorator.decorate_array(
59
93
  @model.remarks, options
60
94
  )
@@ -1,4 +1,8 @@
1
- {%- assign root = klass.generalization -%}
1
+ {%- comment -%}
2
+ parentless types (e.g. Union-stereotyped data types) carry no
3
+ generalization: render the drop itself so members are not lost
4
+ {%- endcomment -%}
5
+ {%- assign root = klass.generalization | default: klass -%}
2
6
 
3
7
  {%- capture upper_klass_name -%}
4
8
  {{ root.general.upper_klass }}:{{ root.general.name }}
@@ -21,57 +25,58 @@ h| Stereotype 2+| {{ stereotype }}
21
25
 
22
26
  3+h| Inherited Properties
23
27
  h| Property Name h| Property Type and Multiplicity h| Definition
24
- {%- for attr in root.inherited_props -%}
25
- {%- unless attr.has_association? -%}
26
- {%- capture name_col -%}
28
+ {% for attr in root.inherited_props %}
29
+ {%- unless attr.has_association? -%}
30
+ {%- capture name_col -%}
27
31
  {{ attr.name_ns }}:{{ attr.name }}
28
32
  ({{ attr.gen_name }})
29
33
  {%- endcapture -%}
30
34
  | {{ name_col | newline_to_br }}
31
35
  | {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
32
36
  | {{ attr.definition }}
33
- {%- endunless -%}
34
- {%- endfor -%}
37
+ {%- endunless -%}
38
+ {% endfor %}
35
39
 
36
40
  3+h| Self-defined Properties
37
41
  h| Property Name h| Property Type and Multiplicity h| Definition
38
- {%- for attr in root.owned_props -%}
39
- {%- unless attr.has_association? -%}
40
- {%- capture name_col -%}
42
+ {%- assign self_props = root.owned_props | default: root.owned_attributes -%}
43
+ {% for attr in self_props %}
44
+ {%- unless attr.has_association? -%}
45
+ {%- capture name_col -%}
41
46
  {{ attr.name_ns }}:{{ attr.name }}
42
47
  ({{ attr.gen_name }})
43
48
  {%- endcapture -%}
44
49
  | {{ name_col | newline_to_br }}
45
50
  | {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
46
51
  | {{ attr.definition }}
47
- {%- endunless -%}
48
- {%- endfor -%}
52
+ {%- endunless -%}
53
+ {% endfor %}
49
54
 
50
55
  3+h| Properties Inherited from Association
51
56
  h| Property Name h| Property Type and Multiplicity h| Definition
52
- {%- for attr in root.inherited_assoc_props -%}
53
- {%- if attr.has_association? -%}
54
- {%- capture name_col -%}
57
+ {% for attr in root.inherited_assoc_props %}
58
+ {%- if attr.has_association? -%}
59
+ {%- capture name_col -%}
55
60
  {{ attr.name_ns }}:{{ attr.name }}
56
61
  ({{ attr.gen_name }})
57
62
  {%- endcapture -%}
58
63
  | {{ name_col | newline_to_br }}
59
64
  | {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
60
65
  | {{ attr.definition }}
61
- {%- endif -%}
62
- {%- endfor -%}
66
+ {%- endif -%}
67
+ {% endfor %}
63
68
 
64
69
  3+h| Properties Defined in Association
65
70
  h| Property Name h| Property Type and Multiplicity h| Definition
66
- {%- for attr in root.assoc_props -%}
67
- {%- if attr.has_association? -%}
68
- {%- capture name_col -%}
71
+ {% for attr in root.assoc_props %}
72
+ {%- if attr.has_association? -%}
73
+ {%- capture name_col -%}
69
74
  {{ attr.name_ns }}:{{ attr.name }}
70
75
  ({{ attr.gen_name }})
71
76
  {%- endcapture -%}
72
77
  | {{ name_col | newline_to_br }}
73
78
  | {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
74
79
  | {{ attr.definition }}
75
- {%- endif -%}
76
- {%- endfor -%}
80
+ {%- endif -%}
81
+ {% endfor %}
77
82
  |===
@@ -117,7 +117,21 @@ module Metanorma
117
117
  parsed_template = template(lines)
118
118
  parsed_template.registers[:file_system] =
119
119
  build_file_system(document, options)
120
- parsed_template.render(context_name => instances.to_h)
120
+ parsed_template.render(context_name => deep_stringify(instances.to_h))
121
+ end
122
+
123
+ # Liquid resolves variable lookups by string keys; the compiled
124
+ # LML models hash with symbols
125
+ def deep_stringify(value)
126
+ case value
127
+ when Hash
128
+ value.transform_keys(&:to_s)
129
+ .transform_values { |v| deep_stringify(v) }
130
+ when Array
131
+ value.map { |v| deep_stringify(v) }
132
+ else
133
+ value
134
+ end
121
135
  end
122
136
 
123
137
  def resolve_data_paths(document, definition_file, instance_file)
@@ -29,7 +29,8 @@ module Metanorma
29
29
  end
30
30
 
31
31
  klass = serialize_klass_or_datatype_drop_by_name(
32
- xmi_path, path, parent.document, guidance)
32
+ xmi_path, path, parent.document, guidance
33
+ )
33
34
 
34
35
  render_table(klass, CONTEXT_NAME, parent, attrs)
35
36
  end
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Lutaml
4
- VERSION = "0.7.54".freeze
4
+ VERSION = "0.7.55.pre.alpha.2".freeze
5
5
  end
6
6
  end
7
7
  end
@@ -34,9 +34,6 @@ yaml_config_path = nil)
34
34
  end
35
35
  end
36
36
 
37
-
38
-
39
-
40
37
  def find_packaged_klass(index, path, root_model_name: nil)
41
38
  segments = path.split("::").reject(&:empty?)
42
39
  if root_model_name && segments.first == root_model_name
@@ -108,7 +105,7 @@ yaml_config_path = nil)
108
105
  def serialize_klass_or_datatype_drop_by_name(xmi_path,
109
106
  name, _document = nil, guidance = nil)
110
107
  serialize_klass_drop_by_name(xmi_path, name, _document, guidance) ||
111
- serialize_datatype_drop_by_name(xmi_path, name, _document)
108
+ serialize_datatype_drop_by_name(xmi_path, name, _document, guidance)
112
109
  end
113
110
 
114
111
  def serialize_klass_drop_by_name(xmi_path,
@@ -127,18 +124,19 @@ yaml_config_path = nil)
127
124
  )
128
125
  end
129
126
 
130
- def serialize_datatype_drop_by_name(xmi_path, name, _document = nil)
127
+ def serialize_datatype_drop_by_name(xmi_path, name, _document = nil,
128
+ guidance = nil)
131
129
  GcBudget.gc_when_bloated!
132
130
  xmi_path, name, slice = XmiPartialLoadRegistry.rewrite(xmi_path, name)
133
131
  parsed = XMI_PARSE_CACHE.fetch(xmi_path, slice: slice)
134
132
  datatype = resolve_packaged_datatype(parsed, name)
135
133
  if datatype.nil?
136
134
  warn "Datatype not found for name: #{name}"
137
- nil
135
+ return nil
138
136
  end
139
137
 
140
138
  ::Ea::Xmi::LiquidDrops::DataTypeDrop.new(
141
- datatype, parsed.drop_options
139
+ datatype, guidance, parsed.drop_options
142
140
  )
143
141
  end
144
142
 
@@ -32,13 +32,11 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "coradoc", "~> 1.1.8"
33
33
  spec.add_dependency "ea", ">= 0.6.41" # Ea::Xmi.load/load_graph (lutaml/ea#86): the partial-load API this gem calls
34
34
  spec.add_dependency "expressir", "~> 2.3", ">= 2.3.5"
35
- spec.add_dependency "isodoc"
36
- spec.add_dependency "liquid"
35
+ spec.add_dependency "isodoc", ">= 3.5.0"
36
+ spec.add_dependency "liquid", "~> 5"
37
37
  spec.add_dependency "lutaml-lml"
38
38
  spec.add_dependency "lutaml-model", "~> 0.8.4"
39
39
  spec.add_dependency "lutaml-uml", ">= 0.5", "< 2"
40
40
  spec.add_dependency "ogc-gml", "~> 1.1"
41
- spec.add_dependency "relaton-cli"
42
-
43
41
  spec.metadata["rubygems_mfa_required"] = "true"
44
42
  end
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.54
4
+ version: 0.7.55.pre.alpha.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-05 00:00:00.000000000 Z
11
+ date: 2026-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -78,28 +78,28 @@ dependencies:
78
78
  requirements:
79
79
  - - ">="
80
80
  - !ruby/object:Gem::Version
81
- version: '0'
81
+ version: 3.5.0
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
- version: '0'
88
+ version: 3.5.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: liquid
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ">="
93
+ - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '0'
95
+ version: '5'
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ">="
100
+ - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '0'
102
+ version: '5'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: lutaml-lml
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -162,20 +162,6 @@ dependencies:
162
162
  - - "~>"
163
163
  - !ruby/object:Gem::Version
164
164
  version: '1.1'
165
- - !ruby/object:Gem::Dependency
166
- name: relaton-cli
167
- requirement: !ruby/object:Gem::Requirement
168
- requirements:
169
- - - ">="
170
- - !ruby/object:Gem::Version
171
- version: '0'
172
- type: :runtime
173
- prerelease: false
174
- version_requirements: !ruby/object:Gem::Requirement
175
- requirements:
176
- - - ">="
177
- - !ruby/object:Gem::Version
178
- version: '0'
179
165
  description: Metanorma plugin for LutaML
180
166
  email:
181
167
  - open.source@ribose.com