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 +4 -4
- data/lib/metanorma/plugin/lutaml/lutaml_ea_diagram_block_macro.rb +1 -3
- data/lib/metanorma/plugin/lutaml/lutaml_ea_xmi_base.rb +0 -9
- data/lib/metanorma/plugin/lutaml/lutaml_preprocessor.rb +4 -15
- data/lib/metanorma/plugin/lutaml/utils.rb +6 -14
- data/lib/metanorma/plugin/lutaml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2141a34ad005450e66a18defc983c59a7178b83260713cd2565dcb4ed1e8cc2a
|
4
|
+
data.tar.gz: 004eecc5e8640fe07f06344a7a60163d875e6da502dffdf8824f478c1a57780f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
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][:
|
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
|
-
|
121
|
+
express_model = load_express_lutaml_file(document, path)
|
124
122
|
indexes[path] = {
|
125
|
-
liquid_drop:
|
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
|
-
|
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
|
-
|
81
|
+
lutaml_doc,
|
89
82
|
document,
|
90
83
|
)
|
91
84
|
end
|
92
85
|
|
93
|
-
|
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
|
-
|
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
|
181
|
+
if lutaml_expressir_model
|
189
182
|
express_indexes[name] = {
|
190
|
-
|
191
|
-
serialized_hash: nil,
|
183
|
+
model: lutaml_expressir_model,
|
192
184
|
}
|
193
185
|
end
|
194
186
|
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.
|
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-
|
11
|
+
date: 2025-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|