metanorma-plugin-lutaml 0.7.21 → 0.7.22

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: 7aeee60e0c387e0cd418623ff3c351097286d574235e6846e107f89d044b4342
4
- data.tar.gz: 5010ee69d52a4ba1d06169224c876734111e9d035aa510565593a67bb997b0f5
3
+ metadata.gz: 2141a34ad005450e66a18defc983c59a7178b83260713cd2565dcb4ed1e8cc2a
4
+ data.tar.gz: 004eecc5e8640fe07f06344a7a60163d875e6da502dffdf8824f478c1a57780f
5
5
  SHA512:
6
- metadata.gz: f0e6eade28bb226a39bb2af4adcf45aeb4ed5dbd61385224cfa4c74946990a25da00ce97083fca98903fcaeae4259a0ed20861b6372d81d128e9befa9f36a129
7
- data.tar.gz: 762f6d288c6dad65aa3e9f73ba1c0185cb93c4af0308d8816f4c672f9d297d7ab764c32f3c6f6ed2b437bae3a5e355407267ac52447a7e6573e3eaaeb6387b50
6
+ metadata.gz: d1fedd8cf68d1bdbbbdee4ad12e892d8986f8f9d12f9135651e65460b6c7101a59ed76c70cef55ec28293a61445375381813b28d11ad7cd68dc735bdb63a68d7
7
+ data.tar.gz: '092a888203f0e03f77fa73dbd33fdd20e411a77d110cf1cae99e9bf89df3b16fca27c6070c014a1918a5b4cdac2079dea15be706e98a38f573e0d527da2f2cac'
@@ -42,9 +42,7 @@ module Metanorma
42
42
  end
43
43
 
44
44
  doc ||= parent.document.attributes["lutaml_xmi_cache"].values.first
45
- return doc if doc.instance_of?(::Lutaml::XMI::RootDrop)
46
-
47
- doc.original_document
45
+ doc
48
46
  end
49
47
 
50
48
  def get_path_from_index(parent, index_name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
@@ -162,16 +162,8 @@ module Metanorma
162
162
  [lutaml_document, yaml_config]
163
163
  end
164
164
 
165
- def get_original_document(wrapper)
166
- doc = wrapper
167
- return doc if doc.instance_of?(::Lutaml::XMI::RootDrop)
168
-
169
- doc.original_document
170
- end
171
-
172
165
  def fill_in_entities_refs_attributes(document, # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
173
166
  lutaml_document, _options)
174
- lutaml_document = get_original_document(lutaml_document)
175
167
  # render_style = options.fetch(RENDER_STYLE_ATTRIBUTE, "default")
176
168
  all_children_packages = lutaml_document.packages
177
169
  .map(&:children_packages).flatten
@@ -201,7 +193,6 @@ module Metanorma
201
193
  end
202
194
 
203
195
  def fill_in_diagrams_attributes(document, lutaml_document) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
204
- lutaml_document = get_original_document(lutaml_document)
205
196
  package_flat_diagrams = lambda do |pks|
206
197
  pks.each_with_object({}) do |package, res|
207
198
  package.diagrams.map do |diag|
@@ -49,7 +49,7 @@ module Metanorma
49
49
  line.match(/^\[(?:\blutaml\b|\blutaml_express\b|\blutaml_express_liquid\b),(?<index_names>[^,]+)?,?(?<context_name>[^,]+)?(?<options>,.*)?\]/) # rubocop:disable Layout/LineLength
50
50
  end
51
51
 
52
- def load_lutaml_file(document, file_path)
52
+ def load_express_lutaml_file(document, file_path)
53
53
  ::Lutaml::Parser.parse(
54
54
  File.new(
55
55
  Utils.relative_file_path(document, file_path),
@@ -108,9 +108,7 @@ module Metanorma
108
108
  index_names.map do |path|
109
109
  if indexes[path]
110
110
  indexes[path][:liquid_drop] ||=
111
- indexes[path][:wrapper].original_document.to_liquid(
112
- options: options,
113
- )
111
+ indexes[path][:model].to_liquid(options: options)
114
112
  else
115
113
  full_path = Utils.relative_file_path(document, path)
116
114
  unless File.file?(full_path)
@@ -120,11 +118,9 @@ module Metanorma
120
118
  "the full path.",
121
119
  )
122
120
  end
123
- wrapper = load_lutaml_file(document, path)
121
+ express_model = load_express_lutaml_file(document, path)
124
122
  indexes[path] = {
125
- liquid_drop: wrapper.original_document.to_liquid(
126
- options: options,
127
- ),
123
+ liquid_drop: express_model.to_liquid(options: options),
128
124
  }
129
125
  end
130
126
 
@@ -155,13 +151,6 @@ module Metanorma
155
151
  options
156
152
  end
157
153
 
158
- def get_original_document(wrapper)
159
- doc = wrapper
160
- return doc if doc.instance_of?(::Lutaml::XMI::RootDrop)
161
-
162
- doc.original_document
163
- end
164
-
165
154
  def render_liquid_template(document:, lines:, context_name:, # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/ParameterLists
166
155
  index_names:, options:, indexes:)
167
156
  config_yaml_path = options.delete("config_yaml")
@@ -61,13 +61,6 @@ module Metanorma
61
61
  end
62
62
  end
63
63
 
64
- def get_original_document(wrapper)
65
- doc = wrapper
66
- return doc if doc.instance_of?(::Lutaml::XMI::RootDrop)
67
-
68
- doc.original_document
69
- end
70
-
71
64
  def load_express_repositories(path:, cache_path:, document:,
72
65
  force_read: false)
73
66
  cache_full_path = cache_path &&
@@ -80,17 +73,17 @@ force_read: false)
80
73
 
81
74
  # If there is no cache or "force read" is set.
82
75
  full_path = Utils.relative_file_path(document, path)
83
- lutaml_wrapper = load_express_repo_from_path(document, full_path)
76
+ lutaml_doc = load_express_repo_from_path(document, full_path)
84
77
 
85
78
  if cache_full_path && !File.file?(cache_full_path)
86
79
  save_express_repo_to_cache(
87
80
  cache_full_path,
88
- get_original_document(lutaml_wrapper),
81
+ lutaml_doc,
89
82
  document,
90
83
  )
91
84
  end
92
85
 
93
- lutaml_wrapper
86
+ lutaml_doc
94
87
  rescue Expressir::Error
95
88
  FileUtils.rm_rf(cache_full_path)
96
89
 
@@ -179,16 +172,15 @@ force_read: false)
179
172
  raise StandardError.new("No name and path set in `:lutaml-express-index:` attribute.")
180
173
  end
181
174
 
182
- lutaml_expressir_wrapper = load_express_repositories(
175
+ lutaml_expressir_model = load_express_repositories(
183
176
  path: path,
184
177
  cache_path: cache,
185
178
  document: document,
186
179
  )
187
180
 
188
- if lutaml_expressir_wrapper
181
+ if lutaml_expressir_model
189
182
  express_indexes[name] = {
190
- wrapper: lutaml_expressir_wrapper,
191
- serialized_hash: nil,
183
+ model: lutaml_expressir_model,
192
184
  }
193
185
  end
194
186
  end
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Lutaml
4
- VERSION = "0.7.21".freeze
4
+ VERSION = "0.7.22".freeze
5
5
  end
6
6
  end
7
7
  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.21
4
+ version: 0.7.22
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-02-20 00:00:00.000000000 Z
11
+ date: 2025-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor