mn-requirements 0.5.0 → 0.5.1

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: 0badc555e06715baca7220440eb81778bf749207c6ff43e15e1c8e0417679cd3
4
- data.tar.gz: dff076524388287b831304ea8abb1806880d0e960335991bd27b395f58ffdec8
3
+ metadata.gz: 5d557ae4ed71baabb926e12c579a4c1e07f14f0573caacd8cea6b3f2be33057b
4
+ data.tar.gz: 0f2f09d925e1fbe06fbe782545d21823a34f687345b0993aa0e27c2c27436e1e
5
5
  SHA512:
6
- metadata.gz: 1cb0ad289dd8ffef0bf50e94b70cf8cbb08b52132dd7326fbda1ee4e23c13f3836af0ec23532ef3a88537e1621e82625a0a09d0fcde8e24e30a9eee87dbf0812
7
- data.tar.gz: 1870ea682f4e7120da000da28e6473bf064161bb8c54fcc30e0a8f1679f77a9b6a3981eadca48b5b316ceaa3239f420e0acdd6458f3a365f9d2ec290ee7e299b
6
+ metadata.gz: ee8c23fab75c8bfbfb679942af6053898eb1aa4f0c365fdc7244e6eb39541b05e59b1afa668628d9f6d4a4cb51e61e0d0059446640265717695dbbf61635c29d
7
+ data.tar.gz: 4e84dae849f84ab1392e3f25e571e3c0ff8a6328c885b468e834eec9e287e158a72bc4e59c98effe38eeff86e5185f64b04886436c53fe1e81760cabb52ee8a1
@@ -152,7 +152,8 @@ module Metanorma
152
152
  end
153
153
 
154
154
  def id_attr(node)
155
- node["id"] ? " id='#{node['id']}'" : ""
155
+ id = node["id"] || node["original-id"]
156
+ id ? " id='#{id}'" : ""
156
157
  end
157
158
 
158
159
  # KILL
@@ -219,11 +220,13 @@ module Metanorma
219
220
  "requirement-#{klass}"
220
221
  end
221
222
 
223
+ # KILL
222
224
  def preserve_in_nested_table?(node)
223
225
  %w(recommendation requirement permission
224
226
  table ol dl ul).include?(node.name)
225
227
  end
226
228
 
229
+ # KILL
227
230
  def requirement_component_parse(node, out)
228
231
  node["exclude"] == "true" and return out
229
232
  ret = semx_fmt_dup(node)
@@ -242,6 +245,45 @@ module Metanorma
242
245
  out
243
246
  end
244
247
 
248
+ def preserve_in_nested_table?(node)
249
+ #%w(recommendation requirement permission table ol dl ul hr br p).include?(node.name)
250
+ !%w(subject inherit identifier measurement-target specification verification import description component).include?(node.name)
251
+ end
252
+
253
+ def requirement_component_parse(node, out)
254
+ node["exclude"] == "true" and return out
255
+ ret = semx_fmt_dup(node)
256
+ descr_classif_render(node, ret)
257
+ id = node["id"] || node["original-id"]
258
+ id and attr = " id='#{id}'"
259
+ preserve = preserve_in_nested_table?(node)
260
+ if id == node["id"]
261
+ if node["original-id"]
262
+ attr = " id='#{node["original-id"]}'"
263
+ else
264
+ node["original-id"] = node["id"]
265
+ end
266
+ node.delete("id")
267
+ end
268
+ if preserve
269
+ n = Nokogiri::XML::Node.new(node.name, node.document)
270
+ node.attributes.each { |k, v| n[k] = v }
271
+ node.children.empty? or n << ret
272
+ ret = n
273
+ end
274
+ ret.elements.size == 1 && ret.first_element_child.name == "dl" and
275
+ return reqt_dl(ret.first_element_child, out)
276
+ node.name == "component" and
277
+ return recommendation_attributes1_component(node, ret, out)
278
+ node.name == "description" and
279
+ return requirement_description_parse(node, ret, out)
280
+ #!preserve_in_nested_table?(node) && id and attr = " id='#{id}'"
281
+ out.add_child("<tr#{attr}><td colspan='2'></td></tr>").first
282
+ .at(ns(".//td")) << (%(permission requirement recommendation).include?(node.name) ? node.dup : ret)
283
+ #(preserve_in_nested_table?(node) ? node.dup : ret)
284
+ out
285
+ end
286
+
245
287
  def requirement_description_parse(node, ret, out)
246
288
  lbl = "description"
247
289
  recommend_class(node.parent) == "recommend" and
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  class Requirements
3
- VERSION = "0.5.0".freeze
3
+ VERSION = "0.5.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mn-requirements
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
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-02-13 00:00:00.000000000 Z
11
+ date: 2025-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: isodoc-i18n