metanorma-plugin-lutaml 0.7.27 → 0.7.28
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/README.adoc +10 -9
- data/lib/metanorma/plugin/lutaml/lutaml_preprocessor.rb +22 -16
- 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: 54d77b60de59ac664edec38812678d7ebd0c994afaf9f7d4ef60a7bad36046bf
|
4
|
+
data.tar.gz: fd77fded1a6aae8ecfcf2b3b15b0389e3ee74e785a5f181050e027c4b5720f37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebfe9b260d0a4630bbf8a3c41ca70b998f5c23be260e494f53adc02e0ec29521cf4fcb18e436147823b4854a1a8a2c6020b9ca1116be22086b55855e95d44b38
|
7
|
+
data.tar.gz: 73404de51765b8f5190de28ede422d3f9c398029d49f43071b1e5ec53c297a7f06ce3adecfaa6b7050529da677cef5e38d51488f11a63d07f5f13ae733c251f4
|
data/README.adoc
CHANGED
@@ -252,8 +252,8 @@ per-block via a separate YAML file.
|
|
252
252
|
|
253
253
|
[lutaml_express_liquid,all_schemas,context,config_yaml=schemas.yaml]
|
254
254
|
---
|
255
|
-
{% assign
|
256
|
-
{% render "templates/resources/schema" for
|
255
|
+
{% assign all_schemas = repo.schemas %}
|
256
|
+
{% render "templates/resources/schema" for ordered_schemas as schema %}
|
257
257
|
----
|
258
258
|
-----
|
259
259
|
|
@@ -284,16 +284,16 @@ schemas:
|
|
284
284
|
anything: ...
|
285
285
|
----
|
286
286
|
|
287
|
-
The resulting block adds the `
|
288
|
-
|
289
|
-
via Liquid:
|
287
|
+
The resulting block adds the `ordered_schemas` context to allows you to filter
|
288
|
+
out the schemas you want to render according to the order in the config_yaml.
|
290
289
|
|
291
290
|
[source,liquid]
|
292
291
|
----
|
293
292
|
[lutaml_express_liquid,schemas_1,repo,config_yaml=select.yaml]
|
294
293
|
---
|
295
|
-
{% assign
|
296
|
-
|
294
|
+
{% assign all_schemas = repo.schemas %}
|
295
|
+
{% render "templates/resources/schema" for ordered_schemas as schema %}
|
296
|
+
...
|
297
297
|
---
|
298
298
|
----
|
299
299
|
|
@@ -311,8 +311,9 @@ from the paths other than the location of the document.
|
|
311
311
|
|
312
312
|
[lutaml_express_liquid,all_schemas,context,config_yaml=schemas.yaml,include_path=../templates]
|
313
313
|
---
|
314
|
-
{% assign
|
315
|
-
{% render "templates/resources/schema" for
|
314
|
+
{% assign all_schemas = repo.schemas %}
|
315
|
+
{% render "templates/resources/schema" for ordered_schemas as schema %}
|
316
|
+
...
|
316
317
|
----
|
317
318
|
-----
|
318
319
|
|
@@ -137,7 +137,6 @@ module Metanorma
|
|
137
137
|
|
138
138
|
# Process each schema
|
139
139
|
repo.schemas.each do |schema|
|
140
|
-
update_schema_selection(schema, options)
|
141
140
|
options["relative_path_prefix"] =
|
142
141
|
relative_path_prefix(options, schema)
|
143
142
|
update_remarks(schema, options)
|
@@ -146,13 +145,6 @@ module Metanorma
|
|
146
145
|
repo
|
147
146
|
end
|
148
147
|
|
149
|
-
def update_schema_selection(schema, options)
|
150
|
-
return unless options["selected_schemas"]
|
151
|
-
|
152
|
-
schema.selected = options["selected_schemas"].include?(schema.file_basename) ||
|
153
|
-
options["selected_schemas"].include?(schema.id)
|
154
|
-
end
|
155
|
-
|
156
148
|
def update_remarks(model, options)
|
157
149
|
model.remarks = decorate_remarks(options, model.remarks)
|
158
150
|
model.remark_items&.each do |ri|
|
@@ -215,10 +207,8 @@ module Metanorma
|
|
215
207
|
|
216
208
|
# Get all context items in one go
|
217
209
|
all_items = gather_context_liquid_items(
|
218
|
-
index_names: index_names,
|
219
|
-
|
220
|
-
indexes: indexes,
|
221
|
-
options: options.merge("document" => document),
|
210
|
+
index_names: index_names, document: document, indexes: indexes,
|
211
|
+
options: options.merge("document" => document)
|
222
212
|
)
|
223
213
|
|
224
214
|
# Setup include paths for liquid templates
|
@@ -238,17 +228,33 @@ module Metanorma
|
|
238
228
|
# Render for each item
|
239
229
|
all_items.map do |item|
|
240
230
|
template.assigns[context_name] = item[:liquid_drop]
|
231
|
+
template.assigns["ordered_schemas"] = reorder_schemas(
|
232
|
+
item[:liquid_drop], options
|
233
|
+
)
|
241
234
|
template.assigns["schemas_order"] = options["selected_schemas"]
|
242
235
|
template.render
|
243
236
|
end.flatten
|
244
237
|
rescue StandardError => e
|
245
|
-
::Metanorma::Util
|
246
|
-
"[LutamlPreprocessor] Failed to parse LutaML block:
|
247
|
-
|
248
|
-
)
|
238
|
+
::Metanorma::Util
|
239
|
+
.log("[LutamlPreprocessor] Failed to parse LutaML block: " \
|
240
|
+
"#{e.message}", :error)
|
249
241
|
raise e
|
250
242
|
end
|
251
243
|
|
244
|
+
def reorder_schemas(repo_liquid, options)
|
245
|
+
return repo_liquid.schemas unless options["selected_schemas"]
|
246
|
+
|
247
|
+
ordered_schemas = []
|
248
|
+
options["selected_schemas"].each do |schema_name|
|
249
|
+
ordered_schema = repo_liquid.schemas.find do |schema|
|
250
|
+
schema.id == schema_name || schema.file_basename == schema_name
|
251
|
+
end
|
252
|
+
ordered_schemas.push(ordered_schema)
|
253
|
+
end
|
254
|
+
|
255
|
+
ordered_schemas
|
256
|
+
end
|
257
|
+
|
252
258
|
def process_options(document, options)
|
253
259
|
# Process config file if specified
|
254
260
|
if (config_yaml_path = options.delete("config_yaml"))
|
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.28
|
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-04-
|
11
|
+
date: 2025-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|