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 +4 -4
- data/lib/metanorma/standoc/cleanup_boilerplate.rb +15 -4
- data/lib/metanorma/standoc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66a2d55d6c29842acb1b636afe7cf434c1769692a4b81ddee42fe77abf706f2a
|
4
|
+
data.tar.gz: 77cc311b6679b34314274cb136807747a2e029eb7ced3bdd5830c16732a15d28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2023-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|