metanorma-plugin-lutaml 0.7.16 → 0.7.18
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 +516 -278
- data/lib/metanorma/plugin/lutaml/liquid_templates/_klass_table.liquid +4 -4
- data/lib/metanorma/plugin/lutaml/lutaml_ea_diagram_block_macro.rb +50 -8
- data/lib/metanorma/plugin/lutaml/lutaml_ea_xmi_base.rb +57 -5
- data/lib/metanorma/plugin/lutaml/lutaml_preprocessor.rb +36 -130
- data/lib/metanorma/plugin/lutaml/utils.rb +6 -1
- data/lib/metanorma/plugin/lutaml/version.rb +1 -1
- data/metanorma-plugin-lutaml.gemspec +2 -2
- metadata +11 -12
- data/lib/metanorma/plugin/lutaml/express_remarks_decorator.rb +0 -78
@@ -28,7 +28,7 @@ h| Property Name h| Property Type and Multiplicity h| Definition
|
|
28
28
|
({{ attr.gen_name }})
|
29
29
|
{%- endcapture -%}
|
30
30
|
| {{ name_col | newline_to_br }}
|
31
|
-
| {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
|
31
|
+
| {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
|
32
32
|
| {{ attr.definition }}
|
33
33
|
{%- endif -%}
|
34
34
|
{% endfor %}
|
@@ -42,7 +42,7 @@ h| Property Name h| Property Type and Multiplicity h| Definition
|
|
42
42
|
({{ attr.gen_name }})
|
43
43
|
{%- endcapture -%}
|
44
44
|
| {{ name_col | newline_to_br }}
|
45
|
-
| {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
|
45
|
+
| {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
|
46
46
|
| {{ attr.definition }}
|
47
47
|
{%- endif -%}
|
48
48
|
{% endfor %}
|
@@ -56,7 +56,7 @@ h| Property Name h| Property Type and Multiplicity h| Definition
|
|
56
56
|
({{ attr.gen_name }})
|
57
57
|
{%- endcapture -%}
|
58
58
|
| {{ name_col | newline_to_br }}
|
59
|
-
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
|
59
|
+
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
|
60
60
|
| {{ attr.definition }}
|
61
61
|
{%- endif -%}
|
62
62
|
{% endfor %}
|
@@ -70,7 +70,7 @@ h| Property Name h| Property Type and Multiplicity h| Definition
|
|
70
70
|
({{ attr.gen_name }})
|
71
71
|
{%- endcapture -%}
|
72
72
|
| {{ name_col | newline_to_br }}
|
73
|
-
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
|
73
|
+
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
|
74
74
|
| {{ attr.definition }}
|
75
75
|
{%- endif -%}
|
76
76
|
{% endfor %}
|
@@ -7,13 +7,14 @@ module Metanorma
|
|
7
7
|
module Lutaml
|
8
8
|
class LutamlEaDiagramBlockMacro < ::Asciidoctor::Extensions::BlockMacroProcessor
|
9
9
|
include LutamlDiagramBase
|
10
|
+
include LutamlEaXmiBase
|
10
11
|
|
11
12
|
use_dsl
|
12
13
|
named :lutaml_ea_diagram
|
13
14
|
|
14
15
|
def process(parent, _target, attrs)
|
15
|
-
orig_doc = get_original_document(parent)
|
16
|
-
diagram = fetch_diagram_by_name(orig_doc, attrs
|
16
|
+
orig_doc = get_original_document(parent, attrs["index"])
|
17
|
+
diagram = fetch_diagram_by_name(orig_doc, attrs)
|
17
18
|
return if diagram.nil?
|
18
19
|
|
19
20
|
through_attrs = generate_attrs(attrs)
|
@@ -26,13 +27,43 @@ module Metanorma
|
|
26
27
|
|
27
28
|
private
|
28
29
|
|
29
|
-
def
|
30
|
-
|
30
|
+
def parse_result_document(full_path, guidance = nil)
|
31
|
+
::Lutaml::XMI::Parsers::XML.serialize_xmi_to_liquid(
|
32
|
+
File.new(full_path, encoding: "UTF-8"),
|
33
|
+
guidance,
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
def get_original_document(parent, index = nil)
|
38
|
+
path = get_path_from_index(parent, index) if index
|
39
|
+
|
40
|
+
if index && path
|
41
|
+
doc = lutaml_document_from_file_or_cache(parent.document, path, {})
|
42
|
+
end
|
43
|
+
|
44
|
+
doc ||= parent.document.attributes["lutaml_xmi_cache"].values.first
|
31
45
|
return doc if doc.instance_of?(::Lutaml::XMI::RootDrop)
|
32
46
|
|
33
47
|
doc.original_document
|
34
48
|
end
|
35
49
|
|
50
|
+
def get_path_from_index(parent, index_name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
51
|
+
lutaml_xmi_index = parent.document
|
52
|
+
.attributes["lutaml_xmi_index"][index_name]
|
53
|
+
|
54
|
+
if lutaml_xmi_index.nil? || lutaml_xmi_index[:path].nil?
|
55
|
+
::Metanorma::Util.log(
|
56
|
+
"[metanorma-plugin-lutaml] lutaml_xmi_index error: " \
|
57
|
+
"XMI index #{index_name} path not found!",
|
58
|
+
:error,
|
59
|
+
)
|
60
|
+
|
61
|
+
return nil
|
62
|
+
end
|
63
|
+
|
64
|
+
lutaml_xmi_index[:path]
|
65
|
+
end
|
66
|
+
|
36
67
|
def img_src_path(document, attrs, diagram)
|
37
68
|
base_path = attrs["base_path"]
|
38
69
|
format = attrs["format"] || "png"
|
@@ -41,19 +72,30 @@ module Metanorma
|
|
41
72
|
"#{img_path}/#{diagram.xmi_id}.#{format}"
|
42
73
|
end
|
43
74
|
|
44
|
-
def fetch_diagram_by_name(orig_doc,
|
75
|
+
def fetch_diagram_by_name(orig_doc, attrs)
|
76
|
+
name = attrs["name"]
|
77
|
+
package_name = attrs["package"]
|
45
78
|
found_diagrams = []
|
46
|
-
|
79
|
+
|
80
|
+
loop_sub_packages(
|
81
|
+
orig_doc.packages.first, name, found_diagrams, package_name
|
82
|
+
)
|
83
|
+
|
47
84
|
found_diagrams.first
|
48
85
|
end
|
49
86
|
|
50
|
-
def loop_sub_packages(package, name, found_diagrams)
|
87
|
+
def loop_sub_packages(package, name, found_diagrams, package_name) # rubocop:disable Metrics/CyclomaticComplexity
|
51
88
|
found_diagram = package.diagrams.find { |diag| diag.name == name }
|
52
89
|
|
90
|
+
if found_diagram && package_name &&
|
91
|
+
found_diagram.package_name != package_name
|
92
|
+
found_diagram = nil
|
93
|
+
end
|
94
|
+
|
53
95
|
found_diagrams << found_diagram if found_diagram
|
54
96
|
|
55
97
|
package.packages.each do |sub_package|
|
56
|
-
loop_sub_packages(sub_package, name, found_diagrams)
|
98
|
+
loop_sub_packages(sub_package, name, found_diagrams, package_name)
|
57
99
|
end
|
58
100
|
end
|
59
101
|
end
|
@@ -27,6 +27,7 @@ module Metanorma
|
|
27
27
|
SUPPORTED_NESTED_MACRO = %w[
|
28
28
|
before diagram_include_block after include_block package_text
|
29
29
|
].freeze
|
30
|
+
XMI_INDEX_REGEXP = /^:lutaml-xmi-index:(?<index_name>.+?);(?<index_path>.+?);?(\s*config=(?<config_path>.+))?$/.freeze # rubocop:disable Lint/MixedRegexpCaptureTypes,Layout/LineLength
|
30
31
|
|
31
32
|
# search document for block `lutaml_ea_xmi`
|
32
33
|
# or `lutaml_uml_datamodel_description`
|
@@ -92,16 +93,38 @@ module Metanorma
|
|
92
93
|
self.class.const_get(:MACRO_REGEXP)
|
93
94
|
end
|
94
95
|
|
95
|
-
def
|
96
|
+
def process_xmi_index_lines(document, line)
|
97
|
+
block_match = line.match(XMI_INDEX_REGEXP)
|
98
|
+
|
99
|
+
return if block_match.nil?
|
100
|
+
|
101
|
+
name = block_match[:index_name]&.strip
|
102
|
+
path = block_match[:index_path]&.strip
|
103
|
+
config = block_match[:config_path]&.strip
|
104
|
+
|
105
|
+
document.attributes["lutaml_xmi_index"] ||= {}
|
106
|
+
document.attributes["lutaml_xmi_index"][name] = {
|
107
|
+
path: path,
|
108
|
+
config: config,
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
def process_text_blocks(document, input_lines) # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
|
96
113
|
line = input_lines.next
|
114
|
+
process_xmi_index_lines(document, line)
|
97
115
|
block_match = line.match(get_macro_regexp)
|
98
116
|
|
99
117
|
return [line] if block_match.nil?
|
100
118
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
119
|
+
config_yaml_path = block_match[2]&.strip
|
120
|
+
xmi_or_index = block_match[1]&.strip
|
121
|
+
|
122
|
+
lutaml_document, yaml_config = load_lutaml_doc_and_config(
|
123
|
+
document,
|
124
|
+
xmi_or_index,
|
125
|
+
config_yaml_path,
|
126
|
+
)
|
127
|
+
|
105
128
|
fill_in_diagrams_attributes(document, lutaml_document)
|
106
129
|
model_representation(
|
107
130
|
lutaml_document, document,
|
@@ -110,6 +133,35 @@ module Metanorma
|
|
110
133
|
)
|
111
134
|
end
|
112
135
|
|
136
|
+
def load_lutaml_doc_and_config(document, xmi_or_index, config_yaml_path)
|
137
|
+
index = xmi_or_index.match(/index=(.*)/)
|
138
|
+
|
139
|
+
if index
|
140
|
+
# load lutaml index
|
141
|
+
index_name = index[1]
|
142
|
+
|
143
|
+
if document.attributes["lutaml_xmi_index"][index_name].nil? ||
|
144
|
+
document.attributes["lutaml_xmi_index"][index_name][:path].nil?
|
145
|
+
::Metanorma::Util.log(
|
146
|
+
"[metanorma-plugin-lutaml] lutaml_xmi_index error: " \
|
147
|
+
"XMI index #{index_name} path not found!",
|
148
|
+
:error,
|
149
|
+
)
|
150
|
+
end
|
151
|
+
|
152
|
+
xmi_or_index = document
|
153
|
+
.attributes["lutaml_xmi_index"][index_name][:path]
|
154
|
+
config_yaml_path = document
|
155
|
+
.attributes["lutaml_xmi_index"][index_name][:config]
|
156
|
+
end
|
157
|
+
|
158
|
+
yaml_config = parse_yaml_config_file(document, config_yaml_path)
|
159
|
+
lutaml_document = lutaml_document_from_file_or_cache(document,
|
160
|
+
xmi_or_index,
|
161
|
+
yaml_config)
|
162
|
+
[lutaml_document, yaml_config]
|
163
|
+
end
|
164
|
+
|
113
165
|
def get_original_document(wrapper)
|
114
166
|
doc = wrapper
|
115
167
|
return doc if doc.instance_of?(::Lutaml::XMI::RootDrop)
|
@@ -5,7 +5,6 @@ require "asciidoctor"
|
|
5
5
|
require "asciidoctor/reader"
|
6
6
|
require "lutaml"
|
7
7
|
require "metanorma/plugin/lutaml/utils"
|
8
|
-
require "metanorma/plugin/lutaml/express_remarks_decorator"
|
9
8
|
require "metanorma/plugin/lutaml/asciidoctor/preprocessor"
|
10
9
|
|
11
10
|
module Metanorma
|
@@ -15,12 +14,12 @@ module Metanorma
|
|
15
14
|
class LutamlPreprocessor < ::Asciidoctor::Extensions::Preprocessor
|
16
15
|
REMARKS_ATTRIBUTE = "remarks"
|
17
16
|
|
18
|
-
def process(document, reader)
|
17
|
+
def process(document, reader) # rubocop:disable Metrics/MethodLength
|
19
18
|
r = Asciidoctor::PreprocessorNoIfdefsReader.new(document,
|
20
19
|
reader.lines)
|
21
20
|
input_lines = r.readlines.to_enum
|
22
21
|
|
23
|
-
|
22
|
+
has_lutaml_liquid = input_lines.any? { |line| lutaml_liquid?(line) }
|
24
23
|
|
25
24
|
express_indexes = Utils.parse_document_express_indexes(
|
26
25
|
document,
|
@@ -33,7 +32,7 @@ module Metanorma
|
|
33
32
|
express_indexes: express_indexes,
|
34
33
|
)
|
35
34
|
|
36
|
-
log(document, result_content) if
|
35
|
+
log(document, result_content) if has_lutaml_liquid
|
37
36
|
|
38
37
|
Asciidoctor::PreprocessorNoIfdefsReader.new(document, result_content)
|
39
38
|
end
|
@@ -46,8 +45,8 @@ module Metanorma
|
|
46
45
|
end
|
47
46
|
end
|
48
47
|
|
49
|
-
def
|
50
|
-
line.match(/^\[(?:\blutaml\b|\blutaml_express\b),(?<index_names>[^,]+)?,?(?<context_name>[^,]+)?(?<options>,.*)?\]/)
|
48
|
+
def lutaml_liquid?(line)
|
49
|
+
line.match(/^\[(?:\blutaml\b|\blutaml_express\b|\blutaml_express_liquid\b),(?<index_names>[^,]+)?,?(?<context_name>[^,]+)?(?<options>,.*)?\]/) # rubocop:disable Layout/LineLength
|
51
50
|
end
|
52
51
|
|
53
52
|
def load_lutaml_file(document, file_path)
|
@@ -61,28 +60,19 @@ module Metanorma
|
|
61
60
|
|
62
61
|
private
|
63
62
|
|
64
|
-
def process_input_lines(
|
65
|
-
document:,
|
66
|
-
input_lines:,
|
67
|
-
express_indexes:
|
68
|
-
)
|
69
|
-
|
63
|
+
def process_input_lines(document:, input_lines:, express_indexes:)
|
70
64
|
result = []
|
71
65
|
loop do
|
72
66
|
result.push(
|
73
|
-
*process_text_blocks(
|
74
|
-
document,
|
75
|
-
input_lines,
|
76
|
-
express_indexes,
|
77
|
-
),
|
67
|
+
*process_text_blocks(document, input_lines, express_indexes),
|
78
68
|
)
|
79
69
|
end
|
80
70
|
result
|
81
71
|
end
|
82
72
|
|
83
|
-
def process_text_blocks(document, input_lines, express_indexes)
|
73
|
+
def process_text_blocks(document, input_lines, express_indexes) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
|
84
74
|
line = input_lines.next
|
85
|
-
block_header_match =
|
75
|
+
block_header_match = lutaml_liquid?(line)
|
86
76
|
|
87
77
|
return [line] if block_header_match.nil?
|
88
78
|
|
@@ -94,7 +84,7 @@ module Metanorma
|
|
94
84
|
|
95
85
|
end_mark = input_lines.next
|
96
86
|
|
97
|
-
|
87
|
+
render_liquid_template(
|
98
88
|
document: document,
|
99
89
|
lines: extract_block_lines(input_lines, end_mark),
|
100
90
|
index_names: index_names,
|
@@ -112,19 +102,16 @@ module Metanorma
|
|
112
102
|
block
|
113
103
|
end
|
114
104
|
|
115
|
-
def
|
105
|
+
def gather_context_liquid_items(index_names:, document:, indexes:, # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
106
|
+
selected_schemas:, options:)
|
116
107
|
index_names.map do |path|
|
117
|
-
# TODO: Rephrase of the below TODO message.
|
118
|
-
# ::Lutaml::Parser.parse(file_list) can return an Array or just one.
|
119
|
-
# TODO: decide how to handle expressir multiply file parse as one
|
120
|
-
# object and lutaml
|
121
|
-
|
122
|
-
# Does this condition ever happen? That is only if the
|
123
|
-
# `lutaml-express-index` condition is not set
|
124
108
|
if indexes[path]
|
125
|
-
indexes[path][:
|
109
|
+
indexes[path][:liquid_drop] ||=
|
110
|
+
indexes[path][:wrapper].original_document.to_liquid(
|
111
|
+
selected_schemas: selected_schemas,
|
112
|
+
options: options,
|
113
|
+
)
|
126
114
|
else
|
127
|
-
|
128
115
|
full_path = Utils.relative_file_path(document, path)
|
129
116
|
unless File.file?(full_path)
|
130
117
|
raise StandardError.new(
|
@@ -135,8 +122,10 @@ module Metanorma
|
|
135
122
|
end
|
136
123
|
wrapper = load_lutaml_file(document, path)
|
137
124
|
indexes[path] = {
|
138
|
-
|
139
|
-
|
125
|
+
liquid_drop: wrapper.original_document.to_liquid(
|
126
|
+
selected_schemas: selected_schemas,
|
127
|
+
options: options,
|
128
|
+
),
|
140
129
|
}
|
141
130
|
end
|
142
131
|
|
@@ -144,7 +133,7 @@ module Metanorma
|
|
144
133
|
end
|
145
134
|
end
|
146
135
|
|
147
|
-
def read_config_yaml_file(document, file_path)
|
136
|
+
def read_config_yaml_file(document, file_path) # rubocop:disable Metrics/MethodLength
|
148
137
|
return {} if file_path.nil?
|
149
138
|
|
150
139
|
relative_file_path = Utils.relative_file_path(document, file_path)
|
@@ -156,8 +145,8 @@ module Metanorma
|
|
156
145
|
if config_yaml["schemas"]
|
157
146
|
unless config_yaml["schemas"].is_a?(Hash)
|
158
147
|
raise StandardError.new(
|
159
|
-
"[
|
160
|
-
"file that has the `schema` key containing a hash.",
|
148
|
+
"[lutaml_express_liquid] attribute `config_yaml` must point " \
|
149
|
+
"to a YAML file that has the `schema` key containing a hash.",
|
161
150
|
)
|
162
151
|
end
|
163
152
|
|
@@ -167,35 +156,6 @@ module Metanorma
|
|
167
156
|
options
|
168
157
|
end
|
169
158
|
|
170
|
-
def decorate_schema_object(schema:, document:, indexes:, index_names:, # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/ParameterLists
|
171
|
-
selected:, options:)
|
172
|
-
# Mark a schema as "selected" with `.selected`
|
173
|
-
schema["selected"] = true if selected
|
174
|
-
|
175
|
-
# Provide pretty-formatted code under `.formatted`
|
176
|
-
_index_found_key, index_found_value = indexes.detect do |k, v|
|
177
|
-
_found = get_original_document(v[:wrapper]).schemas.detect do |s|
|
178
|
-
s.id == schema["id"]
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
schema["formatted"] = get_original_document(
|
183
|
-
index_found_value[:wrapper],
|
184
|
-
).schemas.detect do |s|
|
185
|
-
s.id == schema["id"]
|
186
|
-
end.to_s(no_remarks: true)
|
187
|
-
|
188
|
-
# Decorate the remaining things
|
189
|
-
decorate_context_items(
|
190
|
-
schema,
|
191
|
-
options.merge(
|
192
|
-
"relative_path_prefix" =>
|
193
|
-
Utils.relative_file_path(document,
|
194
|
-
File.dirname(schema["file"])),
|
195
|
-
),
|
196
|
-
) || {}
|
197
|
-
end
|
198
|
-
|
199
159
|
def get_original_document(wrapper)
|
200
160
|
doc = wrapper
|
201
161
|
return doc if doc.instance_of?(::Lutaml::XMI::RootDrop)
|
@@ -203,38 +163,26 @@ selected:, options:)
|
|
203
163
|
doc.original_document
|
204
164
|
end
|
205
165
|
|
206
|
-
def
|
207
|
-
options:, indexes:)
|
166
|
+
def render_liquid_template(document:, lines:, context_name:, # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/ParameterLists
|
167
|
+
index_names:, options:, indexes:)
|
208
168
|
config_yaml_path = options.delete("config_yaml")
|
209
169
|
config = read_config_yaml_file(document, config_yaml_path)
|
210
170
|
selected_schemas = config["selected_schemas"]
|
211
171
|
|
212
|
-
|
172
|
+
all_items = gather_context_liquid_items(
|
213
173
|
index_names: index_names,
|
214
174
|
document: document,
|
215
175
|
indexes: indexes,
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
serialized_hash["schemas"]&.map! do |schema|
|
220
|
-
decorate_schema_object(
|
221
|
-
schema: schema,
|
222
|
-
document: document,
|
223
|
-
index_names: index_names,
|
224
|
-
indexes: indexes,
|
225
|
-
selected: selected_schemas && selected_schemas.include?(
|
226
|
-
schema["id"],
|
227
|
-
),
|
228
|
-
options: options,
|
229
|
-
)
|
230
|
-
end
|
176
|
+
selected_schemas: selected_schemas,
|
177
|
+
options: options.merge("document" => document),
|
178
|
+
)
|
231
179
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
180
|
+
all_items.map do |item|
|
181
|
+
repo_drop = item[:liquid_drop]
|
182
|
+
template = ::Liquid::Template.parse(lines.join("\n"))
|
183
|
+
template.assigns[context_name] = repo_drop
|
184
|
+
template.assigns["selected_schemas"] = selected_schemas
|
185
|
+
template.render
|
238
186
|
end.flatten
|
239
187
|
rescue StandardError => e
|
240
188
|
::Metanorma::Util.log(
|
@@ -252,48 +200,6 @@ options:, indexes:)
|
|
252
200
|
.map { |elem| elem.map(&:strip) }
|
253
201
|
.to_h
|
254
202
|
end
|
255
|
-
|
256
|
-
def decorate_context_item(key, val, options)
|
257
|
-
if key == REMARKS_ATTRIBUTE
|
258
|
-
return [
|
259
|
-
key,
|
260
|
-
val&.map do |remark|
|
261
|
-
Metanorma::Plugin::Lutaml::ExpressRemarksDecorator
|
262
|
-
.call(remark, options)
|
263
|
-
end,
|
264
|
-
]
|
265
|
-
end
|
266
|
-
|
267
|
-
case val
|
268
|
-
when Hash
|
269
|
-
[key, decorate_context_items(val, options)]
|
270
|
-
when Array
|
271
|
-
[key, val.map { |n| decorate_context_items(n, options) }]
|
272
|
-
else
|
273
|
-
[key, val]
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
|
-
def decorate_context_items(item, options)
|
278
|
-
return item unless item.is_a?(Hash)
|
279
|
-
|
280
|
-
item.map do |(key, val)|
|
281
|
-
decorate_context_item(key, val, options)
|
282
|
-
end.to_h
|
283
|
-
end
|
284
|
-
|
285
|
-
def render_block(block_lines:, context_items:, context_name:, document:)
|
286
|
-
render_result, errors = Utils.render_liquid_string(
|
287
|
-
template_string: block_lines.join("\n"),
|
288
|
-
context_items: context_items,
|
289
|
-
context_name: context_name,
|
290
|
-
document: document,
|
291
|
-
)
|
292
|
-
|
293
|
-
Utils.notify_render_errors(document, errors)
|
294
|
-
|
295
|
-
render_result.split("\n")
|
296
|
-
end
|
297
203
|
end
|
298
204
|
end
|
299
205
|
end
|
@@ -4,7 +4,12 @@ require "expressir/express/cache"
|
|
4
4
|
require "metanorma/plugin/lutaml/liquid/custom_filters"
|
5
5
|
require "metanorma/plugin/lutaml/liquid/multiply_local_file_system"
|
6
6
|
|
7
|
-
|
7
|
+
liquid_klass = if Object.const_defined?("Liquid::Environment")
|
8
|
+
Object.const_get("Liquid::Environment").default
|
9
|
+
else
|
10
|
+
Object.const_get("Liquid::Template")
|
11
|
+
end
|
12
|
+
liquid_klass.register_filter(Metanorma::Plugin::Lutaml::Liquid::CustomFilters)
|
8
13
|
|
9
14
|
module Metanorma
|
10
15
|
module Plugin
|
@@ -27,9 +27,9 @@ Gem::Specification.new do |spec|
|
|
27
27
|
|
28
28
|
spec.add_dependency "asciidoctor"
|
29
29
|
spec.add_dependency "coradoc", "~> 1.1.1"
|
30
|
-
spec.add_dependency "expressir", "~> 2.1.
|
30
|
+
spec.add_dependency "expressir", "~> 2.1.6"
|
31
31
|
spec.add_dependency "liquid"
|
32
|
-
spec.add_dependency "lutaml", "
|
32
|
+
spec.add_dependency "lutaml", "~> 0.9.25"
|
33
33
|
spec.add_dependency "ogc-gml", "1.0.0"
|
34
34
|
spec.add_dependency "relaton-cli"
|
35
35
|
|
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.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.1.
|
47
|
+
version: 2.1.6
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.1.
|
54
|
+
version: 2.1.6
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: liquid
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: lutaml
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.9.
|
75
|
+
version: 0.9.25
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.9.
|
82
|
+
version: 0.9.25
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: ogc-gml
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -313,7 +313,6 @@ files:
|
|
313
313
|
- bin/setup
|
314
314
|
- lib/metanorma-plugin-lutaml.rb
|
315
315
|
- lib/metanorma/plugin/lutaml/asciidoctor/preprocessor.rb
|
316
|
-
- lib/metanorma/plugin/lutaml/express_remarks_decorator.rb
|
317
316
|
- lib/metanorma/plugin/lutaml/liquid/custom_filters.rb
|
318
317
|
- lib/metanorma/plugin/lutaml/liquid/multiply_local_file_system.rb
|
319
318
|
- lib/metanorma/plugin/lutaml/liquid_drops/gml_dictionary_drop.rb
|
@@ -354,7 +353,7 @@ homepage: https://github.com/metanorma/metanorma-plugin-lutaml
|
|
354
353
|
licenses:
|
355
354
|
- BSD-2-Clause
|
356
355
|
metadata: {}
|
357
|
-
post_install_message:
|
356
|
+
post_install_message:
|
358
357
|
rdoc_options: []
|
359
358
|
require_paths:
|
360
359
|
- lib
|
@@ -370,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
370
369
|
version: '0'
|
371
370
|
requirements: []
|
372
371
|
rubygems_version: 3.3.27
|
373
|
-
signing_key:
|
372
|
+
signing_key:
|
374
373
|
specification_version: 4
|
375
374
|
summary: Metanorma plugin for LutaML
|
376
375
|
test_files: []
|