metanorma-standoc 2.4.6 → 2.4.8

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: ce54912310b9af4d98ddc7626191a27b3dd982afbcbba47af1f2b1503d1eaac1
4
+ data.tar.gz: db2b1f1bafa6875952c611db4bc4f31568d63102545fb15b9236afd69e77f84b
5
5
  SHA512:
6
- metadata.gz: 62a612cbc8ae3a06c659def78b581ce31f47846aae73417475b7aae1b9648f2ff56db79f0b34f5099db5a09d0b79d7e96dfd2e2c767c465654941b4e6e249b72
7
- data.tar.gz: '08959b3bebcc9a764d8191c68228b7ab77355fec635165b21e1baf84c9908914677845a25b6a0d05d2237ec1135e95e3c222e1194dcd4cf159ddbe938026c48e'
6
+ metadata.gz: 43d771eebc8879517b65e977a74add3008cc6bfc636f8408a48c0761352a31e113cb2a5720406ce0748faccdbad4e6ff1f290b2a4c446fd576f2a0f91c6bb054
7
+ data.tar.gz: 73da28422191e64bd324959c1fa63fc29b82074284fc1dc9a25ea70a5982bdb471d1961a3259d26455c9ea470b9f77ee3cc7c64a03f6e645acd9e8e69aa93787
@@ -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
@@ -22,9 +22,9 @@ module Metanorma
22
22
  Asciidoctor::Extensions.register do
23
23
  preprocessor Metanorma::Standoc::Datamodel::AttributesTablePreprocessor
24
24
  preprocessor Metanorma::Standoc::Datamodel::DiagramPreprocessor
25
- preprocessor Metanorma::Plugin::Glossarist::DatasetPreprocessor
26
25
  preprocessor Metanorma::Plugin::Datastruct::Json2TextPreprocessor
27
26
  preprocessor Metanorma::Plugin::Datastruct::Yaml2TextPreprocessor
27
+ preprocessor Metanorma::Plugin::Glossarist::DatasetPreprocessor
28
28
  inline_macro Metanorma::Standoc::PreferredTermInlineMacro
29
29
  inline_macro Metanorma::Standoc::DateInlineMacro
30
30
  inline_macro Metanorma::Standoc::SpanInlineMacro
@@ -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.8".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.8
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-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor