metanorma-standoc 2.4.6 → 2.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93ecb6aeaf9ddd1f6d695e84bdc1e0fc3a916da96ec174dd2a39045c58ac3b8d
4
- data.tar.gz: ef76e529c8d445e62e7d0d9a1ad847c91607c050d84ba3f270709968acc90116
3
+ metadata.gz: 66a2d55d6c29842acb1b636afe7cf434c1769692a4b81ddee42fe77abf706f2a
4
+ data.tar.gz: 77cc311b6679b34314274cb136807747a2e029eb7ced3bdd5830c16732a15d28
5
5
  SHA512:
6
- metadata.gz: 62a612cbc8ae3a06c659def78b581ce31f47846aae73417475b7aae1b9648f2ff56db79f0b34f5099db5a09d0b79d7e96dfd2e2c767c465654941b4e6e249b72
7
- data.tar.gz: '08959b3bebcc9a764d8191c68228b7ab77355fec635165b21e1baf84c9908914677845a25b6a0d05d2237ec1135e95e3c222e1194dcd4cf159ddbe938026c48e'
6
+ metadata.gz: c65b3f99e33a4ad4452b05cc3c0d6c9e545179d50bc5e6bf8ff8a718287a3dfa2b344c233c7fb3adf1c95835aa0370910740b0262c8266f26dd9b8920ea074bc
7
+ data.tar.gz: 347dbf45508a7ab22323e24ba46abc08c1c4f1d091b17823fe941d844726774b85c0fa9c82a8399c08ac763fbb6d2cf5bb3e5e9f554e21d6e2a3e0abf39dc7e4
@@ -145,15 +145,26 @@ module Metanorma
145
145
  # If Asciidoctor, convert top clauses to tags and wrap in <boilerplate>
146
146
  def boilerplate_file_restructure(file)
147
147
  ret = adoc2xml(file, backend.to_sym)
148
- ns = ret.namespace.href
149
- ret.traverse do |n|
150
- n.element? and n.namespace.href == ns and n.namespace = nil
151
- end
148
+ boilerplate_xml_cleanup(ret)
152
149
  ret.name = "boilerplate"
153
150
  boilerplate_top_elements(ret)
154
151
  ret
155
152
  end
156
153
 
154
+ # remove Metanorma namespace, so generated doc containing boilerplate
155
+ # can be queried consistently
156
+ # _\d+ anchor is assigned to titleless clauses, will clash with main doc
157
+ # instances of same
158
+ def boilerplate_xml_cleanup(xml)
159
+ ns = xml.namespace.href
160
+ xml.traverse do |n|
161
+ n.element? or next
162
+ n.namespace.href == ns and n.namespace = nil
163
+ /^_\d+$/.match?(n["id"]) and
164
+ n["id"] = "_#{UUIDTools::UUID.random_create}"
165
+ end
166
+ end
167
+
157
168
  def boilerplate_top_elements(xml)
158
169
  xml.elements.each do |e|
159
170
  (t = e.at("./title") and /-statement$/.match?(t.text)) or next
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "2.4.6".freeze
22
+ VERSION = "2.4.7".freeze
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-standoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.6
4
+ version: 2.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-19 00:00:00.000000000 Z
11
+ date: 2023-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor