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: cb16d70bcdf9de2b0f0102d7b2595b68cfd6685f9d2acc2b5a5e5ee03978dce4
4
- data.tar.gz: 36daea0b7f715dffee09247a2f8fa72bdaaef978dd1819dee2eaf4cccb12c57c
3
+ metadata.gz: 8b1a1aff3342ca19d9bad692c321719cc381a1d74d98b2827c23bb1da7f6d2de
4
+ data.tar.gz: 3c5f60aba996ac9e1f8924439e60d453c847da10189025917334fbcb200d1d85
5
5
  SHA512:
6
- metadata.gz: 57e4a1b9a54cfd46031df6d9106bc0f4fdcde8579f750a8c0a8ff48de8c947078640d8a4c126bb15a9d68347c6f545e71ab9595947539d9b4058c0d694d2c9a9
7
- data.tar.gz: 7057a4777722a52932a9e2dae5a223ceb9d2e9a0e6041def91c515c99fbf4da2bfd42da7c35101d702817cd554cbf01096f6dc710be751758a2a88b8b6cc103c
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
- return content_from_multiple_contexts(
113
- document, block_match, transformed_liquid_lines
114
- )
115
- end
116
-
117
- context_items = if block_match[1].start_with?("#")
118
- content_from_anchor(document, block_match[1][1..-1])
119
- else
120
- content_from_file(document, block_match[1])
121
- end
122
-
123
- return if context_items.nil?
124
-
125
- contexts = { block_match[2].strip => context_items }
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, # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
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
- parse_context_block(document: document,
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.log(
55
- "Failed to load content from file: #{resolved_file_path}", :error)
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)
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Datastruct
4
- VERSION = "0.3.8".freeze
4
+ VERSION = "0.3.9".freeze
5
5
  end
6
6
  end
7
7
  end
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.8
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-09 00:00:00.000000000 Z
11
+ date: 2025-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor