metanorma-plugin-lutaml 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +8 -6
- data/lib/metanorma/plugin/lutaml/lutaml_preprocessor.rb +21 -8
- 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: e52ac2333cb4e251e5d531e8909d1a763a6f05960ad886136741676639235e44
|
4
|
+
data.tar.gz: 7f3e2daffb58c5074928121da9f4951f85a704e1cb8d8e666e5cfcfcdff90e7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc3b7a23fef7ba9b8b7537ea94d5b28c548b0f55409e4dbf6e8cac0d35742d2126d4831a9bc1747647ac5d9e3c3f4f1ed3d4b00eb0ffeeae0251b65d6301833e
|
7
|
+
data.tar.gz: e56cad378a1131c70ebc0a47e2d44cbdba2fda3bc4a56f866a4a3e3b45268eeb02fa859e02d48904a8b4b90fe0699fc99c607853e9509b41221953917ed2a0f0
|
data/README.adoc
CHANGED
@@ -154,11 +154,11 @@ per-block via a separate YAML file.
|
|
154
154
|
|
155
155
|
[source,adoc]
|
156
156
|
----
|
157
|
-
:lutaml-express-index:
|
157
|
+
:lutaml-express-index: all_schemas; ../schemas_all.yaml;
|
158
158
|
|
159
|
-
[lutaml_express,
|
159
|
+
[lutaml_express,all_schemas,context,leveloffset=+1,config_yaml=schemas.yaml]
|
160
160
|
---
|
161
|
-
{% assign selected =
|
161
|
+
{% assign selected = context.schemas | where: "selected" %}
|
162
162
|
{% render "templates/resources/schema" for selected as schema %}
|
163
163
|
---
|
164
164
|
----
|
@@ -178,14 +178,16 @@ schemas:
|
|
178
178
|
...
|
179
179
|
----
|
180
180
|
|
181
|
-
And `
|
181
|
+
And `schemas.yaml` only selects 2 schemas:
|
182
182
|
|
183
183
|
[source,yaml]
|
184
184
|
----
|
185
185
|
---
|
186
186
|
schemas:
|
187
|
-
|
188
|
-
|
187
|
+
action_schema:
|
188
|
+
anything: ...
|
189
|
+
application_context_schema:
|
190
|
+
anything: ...
|
189
191
|
----
|
190
192
|
|
191
193
|
The resulting block adds the `select` attribute to every schema of the the
|
@@ -143,11 +143,27 @@ module Metanorma
|
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
-
def
|
147
|
-
return
|
146
|
+
def read_config_yaml_file(document, file_path)
|
147
|
+
return {} if file_path.nil?
|
148
148
|
|
149
149
|
relative_file_path = Utils.relative_file_path(document, file_path)
|
150
|
-
YAML.safe_load(
|
150
|
+
config_yaml = YAML.safe_load(
|
151
|
+
File.read(relative_file_path, encoding: "UTF-8")
|
152
|
+
)
|
153
|
+
|
154
|
+
options = {}
|
155
|
+
if config_yaml["schemas"]
|
156
|
+
unless config_yaml["schemas"].is_a?(Hash)
|
157
|
+
raise StandardError.new(
|
158
|
+
"[lutaml_express] attribute `config_yaml` must point to a YAML " \
|
159
|
+
"file that has the `schema` key containing a hash."
|
160
|
+
)
|
161
|
+
end
|
162
|
+
|
163
|
+
options["selected_schemas"] = config_yaml["schemas"].keys
|
164
|
+
end
|
165
|
+
|
166
|
+
options
|
151
167
|
end
|
152
168
|
|
153
169
|
def decorate_schema_object(schema:, document:, indexes:, index_names:, selected:, options:)
|
@@ -178,11 +194,8 @@ module Metanorma
|
|
178
194
|
def render_template(document:, lines:, context_name:, index_names:, options:, indexes:)
|
179
195
|
|
180
196
|
config_yaml_path = options.delete("config_yaml")
|
181
|
-
|
182
|
-
|
183
|
-
{}
|
184
|
-
|
185
|
-
selected_schemas = config_yaml["schemas"]
|
197
|
+
config = read_config_yaml_file(document, config_yaml_path)
|
198
|
+
selected_schemas = config["selected_schemas"]
|
186
199
|
|
187
200
|
gather_context_items(
|
188
201
|
index_names: index_names,
|
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.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|