metanorma-plugin-datastruct 0.3.8 → 0.3.9
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b1a1aff3342ca19d9bad692c321719cc381a1d74d98b2827c23bb1da7f6d2de
|
4
|
+
data.tar.gz: 3c5f60aba996ac9e1f8924439e60d453c847da10189025917334fbcb200d1d85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e69b0df873ef7d4bb9db7fa7d998c8eb5ee943d14d153e472368087ee55afbcd62db101f3791f530f5cc7f7619eff5514ef92a66a8ea8b2ea5a7ef58e94a66e
|
7
|
+
data.tar.gz: f3746f6e9d3e917dd2ac0e861eb837d8fc6d665699737e41244c427b54112863dd29e5134b23ea3f3b2d7b228f93840ab29935c5da08c471638e7a75e1268ef3
|
@@ -108,21 +108,21 @@ module Metanorma
|
|
108
108
|
transform_line_liquid(x)
|
109
109
|
end
|
110
110
|
|
111
|
-
if block_match[1].include?("=")
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
111
|
+
contexts = if block_match[1].include?("=")
|
112
|
+
content_from_multiple_contexts(
|
113
|
+
document, block_match
|
114
|
+
)
|
115
|
+
elsif block_match[1].start_with?("#")
|
116
|
+
{
|
117
|
+
block_match[2].strip =>
|
118
|
+
content_from_anchor(document, block_match[1][1..-1]),
|
119
|
+
}
|
120
|
+
else
|
121
|
+
{
|
122
|
+
block_match[2].strip =>
|
123
|
+
content_from_file(document, block_match[1]),
|
124
|
+
}
|
125
|
+
end
|
126
126
|
|
127
127
|
parse_context_block(document: document,
|
128
128
|
context_lines: transformed_liquid_lines,
|
@@ -133,8 +133,7 @@ module Metanorma
|
|
133
133
|
[]
|
134
134
|
end
|
135
135
|
|
136
|
-
def content_from_multiple_contexts(document, block_match
|
137
|
-
transformed_liquid_lines)
|
136
|
+
def content_from_multiple_contexts(document, block_match) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
138
137
|
contexts = {}
|
139
138
|
(1..block_match.size - 1).each do |i|
|
140
139
|
context_and_paths = block_match[i].strip
|
@@ -146,13 +145,7 @@ module Metanorma
|
|
146
145
|
end
|
147
146
|
end
|
148
147
|
|
149
|
-
|
150
|
-
context_lines: transformed_liquid_lines,
|
151
|
-
contexts: contexts)
|
152
|
-
rescue StandardError => e
|
153
|
-
::Metanorma::Util.log("Failed to parse #{config[:block_name]} \
|
154
|
-
block: #{e.message}", :error)
|
155
|
-
[]
|
148
|
+
contexts
|
156
149
|
end
|
157
150
|
|
158
151
|
def transform_line_liquid(line) # rubocop:disable Metrics/MethodLength
|
@@ -182,7 +175,7 @@ module Metanorma
|
|
182
175
|
render_result.split("\n")
|
183
176
|
end
|
184
177
|
|
185
|
-
def render_liquid_string(template_string:, contexts:, document:)
|
178
|
+
def render_liquid_string(template_string:, contexts:, document:) # rubocop:disable Metrics/MethodLength
|
186
179
|
liquid_template = ::Liquid::Template
|
187
180
|
.parse(template_string, environment: create_liquid_environment)
|
188
181
|
|
@@ -202,7 +195,7 @@ module Metanorma
|
|
202
195
|
::Liquid::Environment.new.tap do |liquid_env|
|
203
196
|
liquid_env.register_tag(
|
204
197
|
"keyiterator",
|
205
|
-
::Metanorma::Plugin::Datastruct::Liquid::CustomBlocks::KeyIterator,
|
198
|
+
::Metanorma::Plugin::Datastruct::Liquid::CustomBlocks::KeyIterator, # rubocop:disable Layout/LineLength
|
206
199
|
)
|
207
200
|
liquid_env.register_filter(
|
208
201
|
::Metanorma::Plugin::Datastruct::Liquid::CustomFilters,
|
@@ -51,8 +51,9 @@ module Metanorma
|
|
51
51
|
|
52
52
|
def load_content_from_file(resolved_file_path)
|
53
53
|
unless File.exist?(resolved_file_path)
|
54
|
-
::Metanorma::Util
|
55
|
-
"Failed to load content from file: #{resolved_file_path}",
|
54
|
+
::Metanorma::Util
|
55
|
+
.log("Failed to load content from file: #{resolved_file_path}",
|
56
|
+
:error)
|
56
57
|
end
|
57
58
|
|
58
59
|
if json_file?(resolved_file_path)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-plugin-datastruct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
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-05-
|
11
|
+
date: 2025-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|