metanorma-standoc 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/standoc/cleanup_block.rb +9 -9
- data/lib/asciidoctor/standoc/cleanup_ref.rb +2 -1
- data/lib/asciidoctor/standoc/validate.rb +2 -2
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -1
- data/spec/asciidoctor-standoc/cleanup_spec.rb +4 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4827ca730cad759d95fc6d9a2cde854fc4579bb0554cdf3c4cbb8b6139d67d5
|
4
|
+
data.tar.gz: 3b591c74d89dc060f0f88e98ef7de25a38e558a66b8dfa31561931ba5ecf1e99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88ec93016754b952a3cc289f49a38d45734dfc628ed320d8de080b790323d752b86e8d2902754ee713984bd247a07f3a0cc624b4e4320421ebdcdbb58f596924
|
7
|
+
data.tar.gz: 2ecae2ef176588738cc0f95306cd9868c52a3699e6a192bfea16cb307abfbe98d6d6c5ec6392c167ac07eab724545e35ee7cc98a68d42ed4636458eb15ec5ad6
|
@@ -21,10 +21,10 @@ module Asciidoctor
|
|
21
21
|
|
22
22
|
# move Key dl after table footer
|
23
23
|
def dl_table_cleanup(xmldoc)
|
24
|
-
q = "//table/following-sibling::*[1]"
|
25
|
-
"[self::p and normalize-space() = 'Key']"
|
24
|
+
q = "//table/following-sibling::*[1][self::p]"
|
26
25
|
xmldoc.xpath(q).each do |s|
|
27
|
-
if
|
26
|
+
if s.text =~ /^\s*key[^a-z]*$/i && !s.next_element.nil? &&
|
27
|
+
s.next_element.name == "dl"
|
28
28
|
s.previous_element << s.next_element.remove
|
29
29
|
s.remove
|
30
30
|
end
|
@@ -73,10 +73,10 @@ module Asciidoctor
|
|
73
73
|
|
74
74
|
# include where definition list inside stem block
|
75
75
|
def formula_cleanup(x)
|
76
|
-
q = "//formula/following-sibling::*[1]"
|
77
|
-
"[self::p and text() = 'where']"
|
76
|
+
q = "//formula/following-sibling::*[1][self::p]"
|
78
77
|
x.xpath(q).each do |s|
|
79
|
-
if
|
78
|
+
if s.text =~ /^\s*where[^a-z]*$/i && !s.next_element.nil? &&
|
79
|
+
s.next_element.name == "dl"
|
80
80
|
s.previous_element << s.next_element.remove
|
81
81
|
s.remove
|
82
82
|
end
|
@@ -85,10 +85,10 @@ module Asciidoctor
|
|
85
85
|
|
86
86
|
# include key definition list inside figure
|
87
87
|
def figure_dl_cleanup(xmldoc)
|
88
|
-
q = "//figure/following-sibling::*"
|
89
|
-
"[self::p and normalize-space() = 'Key']"
|
88
|
+
q = "//figure/following-sibling::*[self::p]"
|
90
89
|
xmldoc.xpath(q).each do |s|
|
91
|
-
if
|
90
|
+
if s.text =~ /^\s*key[^a-z]*$/i && !s.next_element.nil? &&
|
91
|
+
s.next_element.name == "dl"
|
92
92
|
s.previous_element << s.next_element.remove
|
93
93
|
s.remove
|
94
94
|
end
|
@@ -137,6 +137,7 @@ module Asciidoctor
|
|
137
137
|
m = /^(\d+)/.match cl || next
|
138
138
|
parts << m[0]
|
139
139
|
x["citeas"] = x["citeas"].sub(/60050/, "60050-#{m[0]}")
|
140
|
+
x["bibitemid"] = x["bibitemid"].sub(/IEV/, "IEC60050-#{m[0]}")
|
140
141
|
end
|
141
142
|
parts
|
142
143
|
end
|
@@ -148,7 +149,7 @@ module Asciidoctor
|
|
148
149
|
parts.sort.each do |p|
|
149
150
|
hit = @bibdb&.fetch("IEC 60050-#{p}", nil, keep_year: true)
|
150
151
|
next if hit.nil?
|
151
|
-
new_iev += hit.to_xml
|
152
|
+
new_iev += hit.to_xml.sub(/ id="[^"]+"/, %{ id="IEC60050-#{p}"})
|
152
153
|
end
|
153
154
|
iev.replace(new_iev)
|
154
155
|
end
|
@@ -9,11 +9,11 @@ module Asciidoctor
|
|
9
9
|
module Standoc
|
10
10
|
module Validate
|
11
11
|
|
12
|
-
SOURCELOCALITY = "
|
12
|
+
SOURCELOCALITY = "./termsource/origin/locality[@type = 'clause']/referenceFrom".freeze
|
13
13
|
|
14
14
|
def iev_validate(xmldoc)
|
15
15
|
xmldoc.xpath("//term").each do |t|
|
16
|
-
/^IEC 60050-/.match(t&.at("
|
16
|
+
/^IEC 60050-/.match(t&.at("./termsource/origin/@citeas")&.text) or next
|
17
17
|
pref = t.xpath("./preferred").inject([]) { |m, x| m << x&.text&.downcase }
|
18
18
|
locality = t.xpath(SOURCELOCALITY)&.text or next
|
19
19
|
iev = @iev.fetch(locality, xmldoc&.at("//language")&.text || "en") or next
|
data/metanorma-standoc.gemspec
CHANGED
@@ -44,5 +44,5 @@ Gem::Specification.new do |spec|
|
|
44
44
|
spec.add_development_dependency "timecop", "~> 0.9"
|
45
45
|
spec.add_development_dependency "metanorma", "~> 0.2.6"
|
46
46
|
spec.add_development_dependency "isobib", "~> 0.3.0"
|
47
|
-
spec.add_development_dependency "ietfbib", "~> 0.
|
47
|
+
spec.add_development_dependency "ietfbib", "~> 0.4.0"
|
48
48
|
end
|
@@ -517,7 +517,7 @@ r = 1 %</stem>
|
|
517
517
|
Formula
|
518
518
|
++++
|
519
519
|
|
520
|
-
|
520
|
+
Where,
|
521
521
|
|
522
522
|
a:: b
|
523
523
|
INPUT
|
@@ -565,7 +565,7 @@ r = 1 %</stem>
|
|
565
565
|
#{ASCIIDOC_BLANK_HDR}
|
566
566
|
image::spec/examples/rice_images/rice_image1.png[]
|
567
567
|
|
568
|
-
|
568
|
+
key:
|
569
569
|
|
570
570
|
a:: b
|
571
571
|
INPUT
|
@@ -852,7 +852,7 @@ r = 1 %</stem>
|
|
852
852
|
</termsource>
|
853
853
|
</term></terms></sections><bibliography><references id="_" obligation="informative">
|
854
854
|
<title>Normative References</title>
|
855
|
-
<bibitem type="international-standard" id="IEC60050-102
|
855
|
+
<bibitem type="international-standard" id="IEC60050-102">
|
856
856
|
<title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
|
857
857
|
<docidentifier>IEC 60050-102:2011</docidentifier>
|
858
858
|
<date type="published">
|
@@ -882,7 +882,7 @@ r = 1 %</stem>
|
|
882
882
|
</organization>
|
883
883
|
</owner>
|
884
884
|
</copyright>
|
885
|
-
</bibitem><bibitem type="international-standard" id="IEC60050-103
|
885
|
+
</bibitem><bibitem type="international-standard" id="IEC60050-103">
|
886
886
|
<title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
|
887
887
|
<docidentifier>IEC 60050-103:2011</docidentifier>
|
888
888
|
<date type="published">
|
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: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -254,14 +254,14 @@ dependencies:
|
|
254
254
|
requirements:
|
255
255
|
- - "~>"
|
256
256
|
- !ruby/object:Gem::Version
|
257
|
-
version: 0.
|
257
|
+
version: 0.4.0
|
258
258
|
type: :development
|
259
259
|
prerelease: false
|
260
260
|
version_requirements: !ruby/object:Gem::Requirement
|
261
261
|
requirements:
|
262
262
|
- - "~>"
|
263
263
|
- !ruby/object:Gem::Version
|
264
|
-
version: 0.
|
264
|
+
version: 0.4.0
|
265
265
|
description: |
|
266
266
|
metanorma-standoc realises standards following the Metanorma standoc model
|
267
267
|
|