metanorma-plugin-lutaml 0.7.21 → 0.7.23
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 +10 -14
- 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 +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86941bc530959fd2a6023671bfac6d46e18ac1095db5903b67b3be22f411372d
|
4
|
+
data.tar.gz: f4cbcf8affd7ffffb7773ad3a9e7c6d008d176dfe3a507a2ba146cd38ba57e88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a2dc0a28276e48230002049ba5946821c81d231be38494f978e5ad7298836b3ea1852be10314a8cfe7a86f775a097407c67a541f6f3c633e4a1dc32d6206702
|
7
|
+
data.tar.gz: 0eda7cedc08c10bb6b0da49cfabb0f72e6a3a22355b784d9f633217be0f7bdec1946fe269deeb7d460a468f91d7004cc08df747018217239580e2d8566337791
|
@@ -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
|
@@ -42,7 +42,7 @@ module Metanorma
|
|
42
42
|
|
43
43
|
private
|
44
44
|
|
45
|
-
def lutaml_document_from_file_or_cache(document, file_path, yaml_config) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
45
|
+
def lutaml_document_from_file_or_cache(document, file_path, yaml_config, yaml_config_path = nil) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Layout/LineLength
|
46
46
|
full_path = Utils.relative_file_path(document, file_path)
|
47
47
|
if document.attributes["lutaml_xmi_cache"] &&
|
48
48
|
document.attributes["lutaml_xmi_cache"][full_path]
|
@@ -50,8 +50,10 @@ module Metanorma
|
|
50
50
|
end
|
51
51
|
|
52
52
|
yaml_config["ea_extension"]&.each do |ea_extension_path|
|
53
|
+
# resolve paths of ea extensions based on the location of
|
54
|
+
# config yaml file
|
53
55
|
ea_extension_full_path = File.expand_path(
|
54
|
-
ea_extension_path, File.dirname(
|
56
|
+
ea_extension_path, File.dirname(yaml_config_path)
|
55
57
|
)
|
56
58
|
Xmi::EaRoot.load_extension(ea_extension_full_path)
|
57
59
|
end
|
@@ -156,22 +158,17 @@ module Metanorma
|
|
156
158
|
end
|
157
159
|
|
158
160
|
yaml_config = parse_yaml_config_file(document, config_yaml_path)
|
159
|
-
lutaml_document = lutaml_document_from_file_or_cache(
|
160
|
-
|
161
|
-
|
161
|
+
lutaml_document = lutaml_document_from_file_or_cache(
|
162
|
+
document,
|
163
|
+
xmi_or_index,
|
164
|
+
yaml_config,
|
165
|
+
Utils.relative_file_path(document, config_yaml_path),
|
166
|
+
)
|
162
167
|
[lutaml_document, yaml_config]
|
163
168
|
end
|
164
169
|
|
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
170
|
def fill_in_entities_refs_attributes(document, # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
|
173
171
|
lutaml_document, _options)
|
174
|
-
lutaml_document = get_original_document(lutaml_document)
|
175
172
|
# render_style = options.fetch(RENDER_STYLE_ATTRIBUTE, "default")
|
176
173
|
all_children_packages = lutaml_document.packages
|
177
174
|
.map(&:children_packages).flatten
|
@@ -201,7 +198,6 @@ module Metanorma
|
|
201
198
|
end
|
202
199
|
|
203
200
|
def fill_in_diagrams_attributes(document, lutaml_document) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
204
|
-
lutaml_document = get_original_document(lutaml_document)
|
205
201
|
package_flat_diagrams = lambda do |pks|
|
206
202
|
pks.each_with_object({}) do |package, res|
|
207
203
|
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.23
|
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-
|
11
|
+
date: 2025-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -366,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
366
366
|
- !ruby/object:Gem::Version
|
367
367
|
version: '0'
|
368
368
|
requirements: []
|
369
|
-
rubygems_version: 3.
|
369
|
+
rubygems_version: 3.5.22
|
370
370
|
signing_key:
|
371
371
|
specification_version: 4
|
372
372
|
summary: Metanorma plugin for LutaML
|