metanorma-plugin-lutaml 0.7.58 → 0.7.60
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/.github/workflows/rake.yml +0 -4
- data/Gemfile +1 -1
- data/README.adoc +2 -0
- data/docs/usages/lutaml-data.adoc +227 -0
- data/lib/metanorma/plugin/lutaml/express_remark_adapter.rb +5 -8
- data/lib/metanorma/plugin/lutaml/express_remarks_decorator.rb +9 -13
- data/lib/metanorma/plugin/lutaml/version.rb +1 -1
- data/metanorma-plugin-lutaml.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f5ef12f726ddd0652ca444c52965d62604e536653145aee6d8cc52f583f33fe6
|
|
4
|
+
data.tar.gz: 20709ad0a41b47e039b1c715d185d23d1d5d85d38d897c4ee9d98a7b9d068b5c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3d0f8b08306c2cf0b67f005159516dcf13e60cdc485ab1e38fd5eda1795efe5675716bbec1d4ab05c201603efb7a14b2f41d655656dd6074dbc8278b42a8c309
|
|
7
|
+
data.tar.gz: ed9ba9ec4ef3e7314a4b57e01f1e050841edb58f9657c780cde93daa85c63f7c5dbaf9209d73eb245ec7f6cc4d02dbff49ac2165aa7037f3a1c43151ade0f3aa
|
data/.github/workflows/rake.yml
CHANGED
|
@@ -17,10 +17,6 @@ jobs:
|
|
|
17
17
|
rake:
|
|
18
18
|
uses: metanorma/ci/.github/workflows/generic-rake.yml@v1
|
|
19
19
|
with:
|
|
20
|
-
# svg_conform 0.2.5 was re-pushed with corrected metadata; the
|
|
21
|
-
# compact-index line cached in ~/.bundle still carries the old
|
|
22
|
-
# (lens_core) record and fails every install against it.
|
|
23
|
-
before-setup-ruby: rm -rf ~/.bundle/cache/compact_index vendor/bundle/cache && mkdir -p vendor/bundle/cache && curl -sfL https://rubygems.org/gems/svg_conform-0.2.5.gem -o vendor/bundle/cache/svg_conform-0.2.5.gem
|
|
24
20
|
setup-tools: graphviz
|
|
25
21
|
submodules: true
|
|
26
22
|
choco-cache: true
|
data/Gemfile
CHANGED
|
@@ -42,4 +42,4 @@ gem "metanorma-document", github: "metanorma/metanorma-document", branch: "main"
|
|
|
42
42
|
# re-pushed build carries a lens_core dependency that is not published);
|
|
43
43
|
# 0.2.4 is the last clean release and rides moxml ~> 0.5 (= satisfied by
|
|
44
44
|
# the 0.6 line). Lift when a clean 0.2.6 ships.
|
|
45
|
-
gem "svg_conform", "0.2.
|
|
45
|
+
gem "svg_conform", "~> 0.2.6"
|
data/README.adoc
CHANGED
|
@@ -39,6 +39,8 @@ link:docs/usages/lutaml-gml.adoc[Usage with LutaML GML Dictionary by lutaml_gml_
|
|
|
39
39
|
|
|
40
40
|
link:docs/usages/json_yaml.adoc[Usage with JSON or YAML files by data2text, yaml2text or json2text]
|
|
41
41
|
|
|
42
|
+
link:docs/usages/lutaml-data.adoc[Usage with LutaML data files by lutaml_data]
|
|
43
|
+
|
|
42
44
|
link:docs/usages/lutaml-xsd.adoc[Usage with XML Schema files by lutaml_xsd]
|
|
43
45
|
|
|
44
46
|
== Documentation
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
== Usage with LutaML data files by lutaml_data
|
|
2
|
+
|
|
3
|
+
=== General
|
|
4
|
+
|
|
5
|
+
The `lutaml_data` block command loads data that is defined with LutaML models
|
|
6
|
+
and makes it available to a Liquid template in the block.
|
|
7
|
+
|
|
8
|
+
The data consists of two parts:
|
|
9
|
+
|
|
10
|
+
* the *data definitions*: LutaML models, always written in a `.lml` file; and
|
|
11
|
+
* the *data instances*: values of those models, written in `.lml`, `.yaml`,
|
|
12
|
+
`.yml` or `.json`.
|
|
13
|
+
|
|
14
|
+
=== Defining a block
|
|
15
|
+
|
|
16
|
+
Data definitions and data instances in separate files:
|
|
17
|
+
|
|
18
|
+
[source,asciidoc]
|
|
19
|
+
------
|
|
20
|
+
[lutaml_data,{definition_file},{instance_file},{context_name},options={...}]
|
|
21
|
+
----
|
|
22
|
+
...Liquid template...
|
|
23
|
+
----
|
|
24
|
+
------
|
|
25
|
+
|
|
26
|
+
Data definitions and data instances in the same `.lml` file:
|
|
27
|
+
|
|
28
|
+
[source,asciidoc]
|
|
29
|
+
------
|
|
30
|
+
[lutaml_data,{definition_file},{context_name},options={...}]
|
|
31
|
+
----
|
|
32
|
+
...Liquid template...
|
|
33
|
+
----
|
|
34
|
+
------
|
|
35
|
+
|
|
36
|
+
`definition_file`:: (required) Path to the `.lml` file that holds the LutaML
|
|
37
|
+
models. Relative paths are resolved from the directory of the Metanorma
|
|
38
|
+
document. When this is the only file given, the same file must also contain
|
|
39
|
+
the instances.
|
|
40
|
+
|
|
41
|
+
`instance_file`:: (optional) Path to the file that holds the data instances,
|
|
42
|
+
with extension `.lml`, `.yaml`, `.yml` or `.json`. The `.lml` instance file
|
|
43
|
+
usually starts with `require "<definition_file>"`.
|
|
44
|
+
|
|
45
|
+
`context_name`:: (optional) The name under which the data is exposed to the
|
|
46
|
+
Liquid template. Defaults to `lutaml_data`.
|
|
47
|
+
|
|
48
|
+
`options`:: (optional) Rendering options, given either as a JSON object
|
|
49
|
+
(`options={"include_path":"templates"}`) or as inline `key=value` pairs
|
|
50
|
+
(`include_path=templates`). The supported option is `include_path`, a
|
|
51
|
+
comma-separated list of directories searched by the Liquid `include` tag.
|
|
52
|
+
|
|
53
|
+
NOTE: A segment is taken as the instance file when its extension is one of
|
|
54
|
+
`.lml`, `.yaml`, `.yml` or `.json`; any other segment is taken as the context
|
|
55
|
+
name.
|
|
56
|
+
|
|
57
|
+
=== Data in the Liquid context
|
|
58
|
+
|
|
59
|
+
The data is exposed under `context_name`, then the name of the instance.
|
|
60
|
+
|
|
61
|
+
* For `.lml` instances, the key is the instance name (`instance S158Checks { ... }`
|
|
62
|
+
is `S158Checks`).
|
|
63
|
+
* For `.yaml` and `.json` instances, the key is the model name given by the
|
|
64
|
+
required `type` entry (`type: Widgets` is `Widgets`). A file may hold one
|
|
65
|
+
object or a list of objects.
|
|
66
|
+
|
|
67
|
+
Attributes are read by name (`check.dev_id`), collections are iterated with
|
|
68
|
+
`for`, and enum values expose the attributes defined in the model
|
|
69
|
+
(`check.classification.description`).
|
|
70
|
+
|
|
71
|
+
=== Example
|
|
72
|
+
|
|
73
|
+
Data definitions, `s102_models.lml`:
|
|
74
|
+
|
|
75
|
+
[source]
|
|
76
|
+
----
|
|
77
|
+
models IhoS102Check {
|
|
78
|
+
enum CheckClassification {
|
|
79
|
+
critical_error {
|
|
80
|
+
description "Critical Error"
|
|
81
|
+
}
|
|
82
|
+
warning {
|
|
83
|
+
description "Warning"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
class ValidationChecks {
|
|
88
|
+
attribute checks {
|
|
89
|
+
type ValidationCheck
|
|
90
|
+
cardinality 0..n
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
class ValidationCheck {
|
|
95
|
+
attribute dev_id {
|
|
96
|
+
type String
|
|
97
|
+
cardinality 1
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
attribute classification {
|
|
101
|
+
type CheckClassification
|
|
102
|
+
cardinality 1
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
attribute check_message {
|
|
106
|
+
type String
|
|
107
|
+
cardinality 1
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
----
|
|
112
|
+
|
|
113
|
+
Data instances, `s102_checks.lml`:
|
|
114
|
+
|
|
115
|
+
[source]
|
|
116
|
+
----
|
|
117
|
+
// s102_checks.lml
|
|
118
|
+
require "s102_models.lml"
|
|
119
|
+
instance S158Checks {
|
|
120
|
+
type ValidationChecks
|
|
121
|
+
|
|
122
|
+
checks = [
|
|
123
|
+
instance IhoS102Check::ValidationCheck {
|
|
124
|
+
dev_id = "S102_Dev1001"
|
|
125
|
+
classification = CheckClassification::critical_error
|
|
126
|
+
check_message = "No feature information group"
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
instance IhoS102Check::ValidationCheck {
|
|
130
|
+
dev_id = "S102_Dev1002"
|
|
131
|
+
classification = CheckClassification::warning
|
|
132
|
+
check_message = "Mandatory metadata attribute missing"
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
----
|
|
137
|
+
|
|
138
|
+
NOTE: In `.lml` files, comments start with `//`. A `#` comment is rejected by
|
|
139
|
+
the instance parser.
|
|
140
|
+
|
|
141
|
+
The Metanorma document:
|
|
142
|
+
|
|
143
|
+
[source,asciidoc]
|
|
144
|
+
------
|
|
145
|
+
[lutaml_data,s102_models.lml,s102_checks.lml,lml]
|
|
146
|
+
----
|
|
147
|
+
{% for check in lml.S158Checks.checks %}
|
|
148
|
+
=== S-102 Validation Check `{{ check.dev_id }}`
|
|
149
|
+
|
|
150
|
+
classification: {{ check.classification.description }}
|
|
151
|
+
|
|
152
|
+
check message: {{ check.check_message }}
|
|
153
|
+
|
|
154
|
+
{% endfor %}
|
|
155
|
+
----
|
|
156
|
+
------
|
|
157
|
+
|
|
158
|
+
renders as:
|
|
159
|
+
|
|
160
|
+
[source,asciidoc]
|
|
161
|
+
----
|
|
162
|
+
=== S-102 Validation Check `S102_Dev1001`
|
|
163
|
+
|
|
164
|
+
classification: Critical Error
|
|
165
|
+
|
|
166
|
+
check message: No feature information group
|
|
167
|
+
|
|
168
|
+
=== S-102 Validation Check `S102_Dev1002`
|
|
169
|
+
|
|
170
|
+
classification: Warning
|
|
171
|
+
|
|
172
|
+
check message: Mandatory metadata attribute missing
|
|
173
|
+
----
|
|
174
|
+
|
|
175
|
+
=== Instances in YAML or JSON
|
|
176
|
+
|
|
177
|
+
The same data can be given as YAML (`s102_checks.yaml`):
|
|
178
|
+
|
|
179
|
+
[source,yaml]
|
|
180
|
+
----
|
|
181
|
+
type: ValidationChecks
|
|
182
|
+
checks:
|
|
183
|
+
- dev_id: S102_Dev1001
|
|
184
|
+
check_message: No feature information group
|
|
185
|
+
----
|
|
186
|
+
|
|
187
|
+
NOTE: Enum-typed attributes (such as `classification` above) cannot currently
|
|
188
|
+
be set from YAML or JSON instances; loading fails. Use `.lml` instances for
|
|
189
|
+
data that has enum values.
|
|
190
|
+
|
|
191
|
+
The key in the template is the type name:
|
|
192
|
+
|
|
193
|
+
[source,asciidoc]
|
|
194
|
+
------
|
|
195
|
+
[lutaml_data,s102_models.lml,s102_checks.yaml,lml]
|
|
196
|
+
----
|
|
197
|
+
{% for check in lml.ValidationChecks.checks %}
|
|
198
|
+
{{ check.dev_id }}
|
|
199
|
+
{% endfor %}
|
|
200
|
+
----
|
|
201
|
+
------
|
|
202
|
+
|
|
203
|
+
=== Instances in the definition file
|
|
204
|
+
|
|
205
|
+
If the instances are in the definition file, omit the instance file:
|
|
206
|
+
|
|
207
|
+
[source,asciidoc]
|
|
208
|
+
------
|
|
209
|
+
[lutaml_data,widgets.lml,store]
|
|
210
|
+
----
|
|
211
|
+
{% for widget in store.AllWidgets.widgets %}
|
|
212
|
+
{{ widget.id }}: {{ widget.name }}
|
|
213
|
+
{% endfor %}
|
|
214
|
+
----
|
|
215
|
+
------
|
|
216
|
+
|
|
217
|
+
=== Options
|
|
218
|
+
|
|
219
|
+
Directories for Liquid `include` can be set with `options`:
|
|
220
|
+
|
|
221
|
+
[source,asciidoc]
|
|
222
|
+
------
|
|
223
|
+
[lutaml_data,widgets.lml,store,options={"include_path":"templates"}]
|
|
224
|
+
----
|
|
225
|
+
{% include 'heading' %}
|
|
226
|
+
----
|
|
227
|
+
------
|
|
@@ -17,22 +17,19 @@ module Metanorma
|
|
|
17
17
|
)
|
|
18
18
|
resolved = document.path_resolver
|
|
19
19
|
.system_path(file_path, docfile_directory)
|
|
20
|
-
# The decorator expands emitted paths against this base: relative
|
|
21
|
-
# prefixes alone get re-anchored by asciidoctor's imagesdir
|
|
22
|
-
# handling (images/../../schemas collapses a level), so the
|
|
23
|
-
# decoration must produce paths that resolve from the docfile.
|
|
24
|
-
options["relative_path_base"] =
|
|
25
|
-
File.expand_path(docfile_directory)
|
|
26
20
|
# The prefix lands inside emitted image macros, so it must not
|
|
27
21
|
# carry the absolute build path: two builds of the same tree in
|
|
28
22
|
# two directories produced different image/@src values
|
|
29
23
|
# (metanorma/metanorma-plugin-lutaml#325). A path relative to the
|
|
30
24
|
# docfile resolves to the same schema file at render time and is
|
|
31
|
-
# byte-identical across build directories
|
|
25
|
+
# byte-identical across build directories; the decorator joins it
|
|
26
|
+
# as written rather than expanding it.
|
|
32
27
|
# The docfile directory may be relative ("."): relative_path_from
|
|
33
28
|
# refuses mixed prefixes, so both sides expand first
|
|
34
29
|
Pathname.new(File.expand_path(resolved))
|
|
35
|
-
.relative_path_from(
|
|
30
|
+
.relative_path_from(
|
|
31
|
+
Pathname.new(File.expand_path(docfile_directory)),
|
|
32
|
+
)
|
|
36
33
|
.to_s
|
|
37
34
|
end
|
|
38
35
|
|
|
@@ -68,19 +68,15 @@ module Metanorma
|
|
|
68
68
|
return line if path_prefix && line.include?(path_prefix)
|
|
69
69
|
|
|
70
70
|
line.gsub(RELATIVE_PREFIX_MACRO_REGEXP) do |_match|
|
|
71
|
-
#
|
|
72
|
-
#
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
|
|
80
|
-
File.join(path_prefix, $3.strip),
|
|
81
|
-
options["relative_path_base"] || Dir.pwd,
|
|
82
|
-
)
|
|
83
|
-
"#{$1}#{$2}#{full_path}#{$4}"
|
|
71
|
+
# The prefix is already docfile-relative (see
|
|
72
|
+
# ExpressRemarkAdapter.relative_path_prefix), so joining it
|
|
73
|
+
# keeps the emitted path relative to the docfile too. Expanding
|
|
74
|
+
# to an absolute path embedded the build directory in the
|
|
75
|
+
# output, making semantic XML, presentation XML and HTML differ
|
|
76
|
+
# between two builds of the same tree (#325). Resolution is the
|
|
77
|
+
# renderer's job: a relative target joined with imagesdir still
|
|
78
|
+
# resolves against the docfile at render time.
|
|
79
|
+
"#{$1}#{$2}#{File.join(path_prefix, $3.strip)}#{$4}"
|
|
84
80
|
end
|
|
85
81
|
end
|
|
86
82
|
end
|
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
|
35
35
|
spec.add_dependency "isodoc", ">= 3.5.0"
|
|
36
36
|
spec.add_dependency "liquid", "~> 5"
|
|
37
37
|
spec.add_dependency "lutaml-lml"
|
|
38
|
-
spec.add_dependency "lutaml-model", "~> 0.8.
|
|
38
|
+
spec.add_dependency "lutaml-model", "~> 0.8.156"
|
|
39
39
|
spec.add_dependency "lutaml-uml", ">= 0.5", "< 2"
|
|
40
40
|
spec.add_dependency "ogc-gml", "~> 1.1"
|
|
41
41
|
spec.metadata["rubygems_mfa_required"] = "true"
|
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.60
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: asciidoctor
|
|
@@ -120,14 +120,14 @@ dependencies:
|
|
|
120
120
|
requirements:
|
|
121
121
|
- - "~>"
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: 0.8.
|
|
123
|
+
version: 0.8.156
|
|
124
124
|
type: :runtime
|
|
125
125
|
prerelease: false
|
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
|
127
127
|
requirements:
|
|
128
128
|
- - "~>"
|
|
129
129
|
- !ruby/object:Gem::Version
|
|
130
|
-
version: 0.8.
|
|
130
|
+
version: 0.8.156
|
|
131
131
|
- !ruby/object:Gem::Dependency
|
|
132
132
|
name: lutaml-uml
|
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -187,6 +187,7 @@ files:
|
|
|
187
187
|
- docs/usages/enterprise_architect_uml.adoc
|
|
188
188
|
- docs/usages/express.adoc
|
|
189
189
|
- docs/usages/json_yaml.adoc
|
|
190
|
+
- docs/usages/lutaml-data.adoc
|
|
190
191
|
- docs/usages/lutaml-gml.adoc
|
|
191
192
|
- docs/usages/lutaml-uml.adoc
|
|
192
193
|
- docs/usages/lutaml-xsd.adoc
|