metanorma-standoc 2.4.9 → 2.5.0
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 +4 -4
- data/lib/metanorma/standoc/blocks.rb +1 -1
- data/lib/metanorma/standoc/cleanup.rb +21 -19
- data/lib/metanorma/standoc/cleanup_inline.rb +18 -4
- data/lib/metanorma/standoc/cleanup_maths.rb +34 -21
- data/lib/metanorma/standoc/cleanup_symbols.rb +3 -20
- data/lib/metanorma/standoc/cleanup_text.rb +0 -1
- data/lib/metanorma/standoc/inline.rb +13 -11
- data/lib/metanorma/standoc/isodoc.rng +26 -4
- data/lib/metanorma/standoc/term_lookup_cleanup.rb +21 -11
- data/lib/metanorma/standoc/utils.rb +23 -4
- data/lib/metanorma/standoc/validate.rb +3 -3
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -1
- 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: 1d6a56b88b9f58482764ff6aede297e389577151d0d112a215b2215d5cfb41cf
|
4
|
+
data.tar.gz: cb0a1a1d73930e89169a27185bcce3d19130f1150a22fd7345da61a73dbd759f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 158547c563e269b769f39123cbd03f749a4891f7e4c772e9462ea40a9221ee4b58839991b2580fc40d9a24007387866d2741867ee6a8f5f39770fa3d38a57138
|
7
|
+
data.tar.gz: ba7b26ed9ebfae0f92dedc50750aad4e31c53b5e5b16defe3e2a2ea6583049fab738f07449846ac62aa74af06944d725389fed9d54357bf9ff9c33b3196cac2f
|
@@ -1,24 +1,24 @@
|
|
1
1
|
require "nokogiri"
|
2
2
|
require "pathname"
|
3
3
|
require "html2doc"
|
4
|
-
require_relative "
|
5
|
-
require_relative "
|
6
|
-
require_relative "
|
7
|
-
require_relative "
|
8
|
-
require_relative "
|
9
|
-
require_relative "
|
10
|
-
require_relative "
|
11
|
-
require_relative "
|
12
|
-
require_relative "
|
13
|
-
require_relative "
|
14
|
-
require_relative "
|
15
|
-
require_relative "
|
16
|
-
require_relative "
|
17
|
-
require_relative "
|
18
|
-
require_relative "
|
19
|
-
require_relative "
|
20
|
-
require_relative "
|
21
|
-
require_relative "
|
4
|
+
require_relative "cleanup_block"
|
5
|
+
require_relative "cleanup_table"
|
6
|
+
require_relative "cleanup_footnotes"
|
7
|
+
require_relative "cleanup_ref"
|
8
|
+
require_relative "cleanup_asciibib"
|
9
|
+
require_relative "cleanup_boilerplate"
|
10
|
+
require_relative "cleanup_bibdata"
|
11
|
+
require_relative "cleanup_section"
|
12
|
+
require_relative "cleanup_terms"
|
13
|
+
require_relative "cleanup_symbols"
|
14
|
+
require_relative "cleanup_xref"
|
15
|
+
require_relative "cleanup_inline"
|
16
|
+
require_relative "cleanup_amend"
|
17
|
+
require_relative "cleanup_maths"
|
18
|
+
require_relative "cleanup_image"
|
19
|
+
require_relative "cleanup_reqt"
|
20
|
+
require_relative "cleanup_text"
|
21
|
+
require_relative "cleanup_toc"
|
22
22
|
require "relaton_iev"
|
23
23
|
|
24
24
|
module Metanorma
|
@@ -51,6 +51,7 @@ module Metanorma
|
|
51
51
|
normref_cleanup(xmldoc)
|
52
52
|
biblio_cleanup(xmldoc)
|
53
53
|
reference_names(xmldoc)
|
54
|
+
asciimath_cleanup(xmldoc) # feeds: mathml_cleanup, termdef_cleanup, symbols_cleanup
|
54
55
|
symbols_cleanup(xmldoc) # feeds: termdef_cleanup
|
55
56
|
xref_cleanup(xmldoc) # feeds: concept_cleanup, origin_cleanup
|
56
57
|
concept_cleanup(xmldoc) # feeds: related_cleanup, termdef_cleanup
|
@@ -79,6 +80,7 @@ module Metanorma
|
|
79
80
|
empty_element_cleanup(xmldoc)
|
80
81
|
img_cleanup(xmldoc)
|
81
82
|
anchor_cleanup(xmldoc)
|
83
|
+
link_cleanup(xmldoc)
|
82
84
|
xmldoc
|
83
85
|
end
|
84
86
|
|
@@ -107,7 +109,7 @@ module Metanorma
|
|
107
109
|
end
|
108
110
|
|
109
111
|
def element_name_cleanup(xmldoc)
|
110
|
-
xmldoc.traverse { |n| n.name = n.name.gsub(
|
112
|
+
xmldoc.traverse { |n| n.name = n.name.gsub("_", "-") }
|
111
113
|
end
|
112
114
|
|
113
115
|
# allows us to deal with doc relation localities,
|
@@ -78,7 +78,7 @@ module Metanorma
|
|
78
78
|
def concept_cleanup1(elem)
|
79
79
|
elem.children.remove if elem&.children&.text&.strip&.empty?
|
80
80
|
key_extract_locality(elem)
|
81
|
-
if
|
81
|
+
if elem["key"].include?(":") then concept_termbase_cleanup(elem)
|
82
82
|
elsif refid? elem["key"] then concept_eref_cleanup(elem)
|
83
83
|
else concept_xref_cleanup(elem)
|
84
84
|
end
|
@@ -95,15 +95,14 @@ module Metanorma
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def key_extract_locality(elem)
|
98
|
-
|
99
|
-
|
98
|
+
elem["key"].include?(",") or return
|
100
99
|
elem.add_child("<locality>#{elem['key'].sub(/^[^,]+,/, '')}</locality>")
|
101
100
|
elem["key"] = elem["key"].sub(/,.*$/, "")
|
102
101
|
end
|
103
102
|
|
104
103
|
def concept_termbase_cleanup(elem)
|
105
104
|
t = elem&.at("./xrefrender")&.remove&.children
|
106
|
-
termbase, key = elem["key"].split(
|
105
|
+
termbase, key = elem["key"].split(":", 2)
|
107
106
|
elem.add_child(%(<termref base="#{termbase}" target="#{key}">) +
|
108
107
|
"#{t&.to_xml}</termref>")
|
109
108
|
end
|
@@ -207,6 +206,21 @@ module Metanorma
|
|
207
206
|
end
|
208
207
|
end
|
209
208
|
|
209
|
+
def link_cleanup(xmldoc)
|
210
|
+
xmldoc.xpath("//link[@target]").each do |l|
|
211
|
+
l["target"] = URI.parse(l["target"]).to_s
|
212
|
+
rescue StandardError
|
213
|
+
err = "Malformed URI: #{l['target']}"
|
214
|
+
@log.add("Anchors", l, err)
|
215
|
+
@fatalerror << err
|
216
|
+
warn err
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
def uri_component_encode(comp)
|
221
|
+
CGI.escape(comp).gsub("+", "%20")
|
222
|
+
end
|
223
|
+
|
210
224
|
private
|
211
225
|
|
212
226
|
# skip ZWNJ inserted to prevent regexes operating in asciidoctor
|
@@ -3,17 +3,28 @@ require "asciimath2unitsml"
|
|
3
3
|
module Metanorma
|
4
4
|
module Standoc
|
5
5
|
module Cleanup
|
6
|
-
def
|
7
|
-
|
8
|
-
|
6
|
+
def asciimath_cleanup(xml)
|
7
|
+
!@keepasciimath and asciimath2mathml(xml)
|
8
|
+
end
|
9
|
+
|
10
|
+
def asciimath2mathml(xml)
|
11
|
+
xpath = xml.xpath("//stem[@type = 'AsciiMath']")
|
12
|
+
xpath.each_with_index do |x, i|
|
13
|
+
progress_conv(i, 500, xpath.size, 1000, "AsciiMath")
|
14
|
+
asciimath2mathml_indiv(x)
|
9
15
|
end
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
16
|
+
asciimath2mathml_wrap(xml)
|
17
|
+
end
|
18
|
+
|
19
|
+
def asciimath2mathml_indiv(elem)
|
20
|
+
elem["type"] = "MathML"
|
21
|
+
expr = @c.decode(elem.text)
|
22
|
+
ret = Plurimath::Math.parse(expr, "asciimath")
|
23
|
+
.to_mathml(display_style: elem["block"])
|
24
|
+
ret += "<asciimath>#{@c.encode(@c.decode(expr), :basic)}</asciimath>"
|
25
|
+
elem.children = ret
|
14
26
|
rescue StandardError => e
|
15
|
-
asciimath2mathml_err(
|
16
|
-
text
|
27
|
+
asciimath2mathml_err(elem.to_xml, e)
|
17
28
|
end
|
18
29
|
|
19
30
|
def asciimath2mathml_err(text, expr)
|
@@ -23,25 +34,27 @@ module Metanorma
|
|
23
34
|
warn err
|
24
35
|
end
|
25
36
|
|
26
|
-
def asciimath2mathml_wrap(
|
27
|
-
|
28
|
-
x.xpath("//*[local-name() = 'math'][@display]").each do |y|
|
37
|
+
def asciimath2mathml_wrap(xml)
|
38
|
+
xml.xpath("//*[local-name() = 'math'][@display]").each do |y|
|
29
39
|
y.delete("display")
|
30
40
|
end
|
31
|
-
x.xpath("
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
41
|
+
# x.xpath("//stem").each do |y|
|
42
|
+
# y.next_element&.name == "asciimath" and y << y.next_element
|
43
|
+
# end
|
44
|
+
xml
|
45
|
+
end
|
46
|
+
|
47
|
+
def progress_conv(idx, step, total, threshold, msg)
|
48
|
+
return unless (idx % step).zero? && total > threshold && idx.positive?
|
49
|
+
|
50
|
+
warn "#{msg} #{idx} of #{total}"
|
38
51
|
end
|
39
52
|
|
40
53
|
def xml_unescape_mathml(xml)
|
41
54
|
return if xml.children.any?(&:element?)
|
42
55
|
|
43
|
-
math = xml.text.gsub(
|
44
|
-
.gsub(
|
56
|
+
math = xml.text.gsub("<", "<").gsub(">", ">")
|
57
|
+
.gsub(""", '"').gsub("'", "'").gsub("&", "&")
|
45
58
|
.gsub(/<[^: \r\n\t\/]+:/, "<").gsub(/<\/[^ \r\n\t:]+:/, "</")
|
46
59
|
xml.children = math
|
47
60
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "metanorma/standoc/utils"
|
2
|
+
|
1
3
|
module Metanorma
|
2
4
|
module Standoc
|
3
5
|
module Cleanup
|
@@ -8,31 +10,12 @@ module Metanorma
|
|
8
10
|
def symbol_key(sym)
|
9
11
|
@c.decode(asciimath_key(sym).text)
|
10
12
|
.gsub(/[\[\]{}<>()]/, "").gsub(/\s/m, "")
|
11
|
-
.gsub(/[[:punct:]]|[_^]/, ":\\0").gsub(
|
13
|
+
.gsub(/[[:punct:]]|[_^]/, ":\\0").gsub("`", "")
|
12
14
|
.gsub(/[0-9]+/, "þ\\0")
|
13
15
|
.tr("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz",
|
14
16
|
"ABCFEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
|
15
17
|
end
|
16
18
|
|
17
|
-
def asciimath_key(sym)
|
18
|
-
key = sym.dup
|
19
|
-
key.traverse do |n|
|
20
|
-
if n.name == "stem" && a = n.at(".//asciimath")
|
21
|
-
n.children = @c.encode(
|
22
|
-
@c.decode(grkletters(a.text)), :basic
|
23
|
-
)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
key.xpath(".//asciimath").each(&:remove)
|
27
|
-
Nokogiri::XML(key.to_xml)
|
28
|
-
end
|
29
|
-
|
30
|
-
def grkletters(text)
|
31
|
-
text.gsub(/\b(alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|
|
32
|
-
lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|
|
33
|
-
psi|omega)\b/xi, "&\\1;")
|
34
|
-
end
|
35
|
-
|
36
19
|
def extract_symbols_list(dlist)
|
37
20
|
dl_out = []
|
38
21
|
dlist.xpath("./dt | ./dd").each do |dtd|
|
@@ -3,7 +3,6 @@ module Metanorma
|
|
3
3
|
module Cleanup
|
4
4
|
def textcleanup(result)
|
5
5
|
text = result.flatten.map { |l| l.sub(/\s*\Z/, "") } * "\n"
|
6
|
-
!@keepasciimath and text = asciimath2mathml(text)
|
7
6
|
text = text.gsub(/\s+<fn /, "<fn ")
|
8
7
|
%w(passthrough passthrough-inline).each do |v|
|
9
8
|
text.gsub!(%r{<#{v}\s+formats="metanorma">([^<]*)
|
@@ -138,9 +138,10 @@ module Metanorma
|
|
138
138
|
noko { |xml| xml.hr }.join
|
139
139
|
end
|
140
140
|
|
141
|
-
def latex_parse1(text)
|
141
|
+
def latex_parse1(text, block)
|
142
142
|
lxm_input = Unicode2LaTeX.unicode2latex(@c.decode(text))
|
143
|
-
results = Plurimath::Math.parse(lxm_input, "latex")
|
143
|
+
results = Plurimath::Math.parse(lxm_input, "latex")
|
144
|
+
.to_mathml(display_style: block)
|
144
145
|
if results.nil?
|
145
146
|
@log.add("Math", nil,
|
146
147
|
"latexmlmath failed to process equation:\n#{lxm_input}")
|
@@ -149,22 +150,23 @@ module Metanorma
|
|
149
150
|
results.sub(%r{<math ([^>]+ )?display="block"}, "<math \\1")
|
150
151
|
end
|
151
152
|
|
152
|
-
def stem_parse(text, xml, style)
|
153
|
+
def stem_parse(text, xml, style, block)
|
153
154
|
if /<([^:>&]+:)?math(\s+[^>&]+)?> |
|
154
155
|
<([^:>&]+:)?math(\s+[^>&]+)?>/x.match? text
|
155
156
|
math = xml_encode(text)
|
156
|
-
xml.stem type: "MathML" do |s|
|
157
|
+
xml.stem type: "MathML", block: block do |s|
|
157
158
|
s << math
|
158
159
|
end
|
159
|
-
elsif style == :latexmath then latex_parse(text, xml)
|
160
|
+
elsif style == :latexmath then latex_parse(text, xml, block)
|
160
161
|
else
|
161
|
-
xml.stem text&.gsub(
|
162
|
+
xml.stem text&.gsub("&#", "&#"), type: "AsciiMath", block: block
|
162
163
|
end
|
163
164
|
end
|
164
165
|
|
165
|
-
def latex_parse(text, xml)
|
166
|
-
latex = latex_parse1(text) or
|
167
|
-
|
166
|
+
def latex_parse(text, xml, block)
|
167
|
+
latex = latex_parse1(text, block) or
|
168
|
+
return xml.stem type: "MathML", block: block
|
169
|
+
xml.stem type: "MathML", block: block do |s|
|
168
170
|
math = Nokogiri::XML.fragment(latex.sub(/<\?[^>]+>/, ""))
|
169
171
|
.elements[0]
|
170
172
|
math.delete("alttext")
|
@@ -187,8 +189,8 @@ module Metanorma
|
|
187
189
|
when :single then xml << "'#{node.text}'"
|
188
190
|
when :superscript then xml.sup { |s| s << node.text }
|
189
191
|
when :subscript then xml.sub { |s| s << node.text }
|
190
|
-
when :asciimath then stem_parse(node.text, xml, :asciimath)
|
191
|
-
when :latexmath then stem_parse(node.text, xml, :latexmath)
|
192
|
+
when :asciimath then stem_parse(node.text, xml, :asciimath, false)
|
193
|
+
when :latexmath then stem_parse(node.text, xml, :latexmath, false)
|
192
194
|
when :mark then highlight_parse(node.text, xml)
|
193
195
|
else
|
194
196
|
case node.role
|
@@ -17,7 +17,7 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
-
<!-- VERSION v1.2.
|
20
|
+
<!-- VERSION v1.2.3 -->
|
21
21
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
22
22
|
<include href="reqt.rng"/>
|
23
23
|
<include href="basicdoc.rng">
|
@@ -192,9 +192,11 @@
|
|
192
192
|
</attribute>
|
193
193
|
</optional>
|
194
194
|
<attribute name="citeas"/>
|
195
|
-
<
|
196
|
-
<
|
197
|
-
|
195
|
+
<optional>
|
196
|
+
<attribute name="type">
|
197
|
+
<ref name="ReferenceFormat"/>
|
198
|
+
</attribute>
|
199
|
+
</optional>
|
198
200
|
<optional>
|
199
201
|
<attribute name="alt"/>
|
200
202
|
</optional>
|
@@ -836,6 +838,26 @@
|
|
836
838
|
<ref name="paragraph"/>
|
837
839
|
</element>
|
838
840
|
</define>
|
841
|
+
<define name="stem">
|
842
|
+
<element name="stem">
|
843
|
+
<attribute name="type">
|
844
|
+
<choice>
|
845
|
+
<value>MathML</value>
|
846
|
+
<value>AsciiMath</value>
|
847
|
+
<value>LatexMath</value>
|
848
|
+
</choice>
|
849
|
+
</attribute>
|
850
|
+
<attribute name="block">
|
851
|
+
<data type="boolean"/>
|
852
|
+
</attribute>
|
853
|
+
<oneOrMore>
|
854
|
+
<choice>
|
855
|
+
<text/>
|
856
|
+
<ref name="AnyElement"/>
|
857
|
+
</choice>
|
858
|
+
</oneOrMore>
|
859
|
+
</element>
|
860
|
+
</define>
|
839
861
|
<define name="em">
|
840
862
|
<element name="em">
|
841
863
|
<zeroOrMore>
|
@@ -49,7 +49,8 @@ module Metanorma
|
|
49
49
|
def concept_cleanup
|
50
50
|
xmldoc.xpath("//concept").each do |n|
|
51
51
|
refterm = n.at("./refterm") or next
|
52
|
-
|
52
|
+
lookup = normalize_ref_id_text(refterm.text.strip)
|
53
|
+
p = @termlookup[:secondary2primary][lookup] and
|
53
54
|
refterm.children = @c.encode(p)
|
54
55
|
end
|
55
56
|
end
|
@@ -61,7 +62,7 @@ module Metanorma
|
|
61
62
|
def related_cleanup
|
62
63
|
xmldoc.xpath("//related").each do |n|
|
63
64
|
refterm = n.at("./refterm") or next
|
64
|
-
lookup =
|
65
|
+
lookup = normalize_ref_id_text(refterm.text.strip)
|
65
66
|
p = @termlookup[:secondary2primary][lookup] and
|
66
67
|
refterm.children = @c.encode(p)
|
67
68
|
p || @termlookup[:term][lookup] and
|
@@ -133,7 +134,7 @@ module Metanorma
|
|
133
134
|
end
|
134
135
|
|
135
136
|
def remove_missing_ref_msg1(_node, target, ret)
|
136
|
-
target2 = "_#{target.downcase.gsub(
|
137
|
+
target2 = "_#{target.downcase.gsub('-', '_')}"
|
137
138
|
if @terms_tags[target] || @terms_tags[target2]
|
138
139
|
ret.strip!
|
139
140
|
ret += ". Did you mean to point to a subterm?"
|
@@ -185,17 +186,20 @@ module Metanorma
|
|
185
186
|
|
186
187
|
def pref_secondary2primary_preferred(term, res, primary)
|
187
188
|
term.xpath("./preferred//name").each_with_index do |p, i|
|
188
|
-
|
189
|
-
|
190
|
-
res[
|
189
|
+
t = p.text.strip
|
190
|
+
i.positive? and
|
191
|
+
res[normalize_ref_id_text(domain_prefix(term, t))] = primary
|
192
|
+
@unique_designs[t] && term.at(".//domain") and
|
193
|
+
res[normalize_ref_id_text(t)] = primary
|
191
194
|
end
|
192
195
|
end
|
193
196
|
|
194
197
|
def pref_secondary2primary_admitted(term, res, primary)
|
195
198
|
term.xpath("./admitted//name").each do |p|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
+
t = p.text.strip
|
200
|
+
res[normalize_ref_id_text(domain_prefix(term, t))] = primary
|
201
|
+
@unique_designs[t] && term.at(".//domain") and
|
202
|
+
res[normalize_ref_id_text(t)] = primary
|
199
203
|
end
|
200
204
|
end
|
201
205
|
|
@@ -234,9 +238,13 @@ module Metanorma
|
|
234
238
|
def normalize_ref_id1(term, node = nil)
|
235
239
|
t = term.dup
|
236
240
|
t.xpath(".//index").map(&:remove)
|
237
|
-
ret = t.text.strip
|
241
|
+
ret = asciimath_key(t).text.strip
|
238
242
|
node and ret = domain_prefix(node, ret)
|
239
|
-
|
243
|
+
normalize_ref_id_text(ret)
|
244
|
+
end
|
245
|
+
|
246
|
+
def normalize_ref_id_text(text)
|
247
|
+
Metanorma::Utils::to_ncname(text.gsub(/[[:space:]]+/, "-"))
|
240
248
|
end
|
241
249
|
|
242
250
|
def unique_text_id(text, prefix)
|
@@ -248,6 +256,8 @@ module Metanorma
|
|
248
256
|
end
|
249
257
|
end
|
250
258
|
end
|
259
|
+
|
260
|
+
include ::Metanorma::Standoc::Utils
|
251
261
|
end
|
252
262
|
end
|
253
263
|
end
|
@@ -70,10 +70,10 @@ module Metanorma
|
|
70
70
|
|
71
71
|
def xml_encode(text)
|
72
72
|
@c.encode(text, :basic, :hexadecimal)
|
73
|
-
.gsub(
|
74
|
-
.gsub(
|
75
|
-
.gsub(
|
76
|
-
.gsub(
|
73
|
+
.gsub("&gt;", ">").gsub("&lt;", "<").gsub("&amp;", "&")
|
74
|
+
.gsub(">", ">").gsub("<", "<").gsub("&", "&")
|
75
|
+
.gsub(""", '"').gsub("
", "\n").gsub("&#", "&#")
|
76
|
+
.gsub("'", "'")
|
77
77
|
end
|
78
78
|
|
79
79
|
# wrapped in <sections>
|
@@ -85,6 +85,25 @@ module Metanorma
|
|
85
85
|
Nokogiri::XML(c).at("//xmlns:sections")
|
86
86
|
end
|
87
87
|
|
88
|
+
def asciimath_key(sym)
|
89
|
+
key = sym.dup
|
90
|
+
key.traverse do |n|
|
91
|
+
if n.name == "stem" && a = n.at(".//asciimath")
|
92
|
+
n.children = @c.encode(
|
93
|
+
@c.decode(grkletters(a.text)), :basic
|
94
|
+
)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
key.xpath(".//asciimath").each(&:remove)
|
98
|
+
Nokogiri::XML(key.to_xml)
|
99
|
+
end
|
100
|
+
|
101
|
+
def grkletters(text)
|
102
|
+
text.gsub(/\b(alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|
|
103
|
+
lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|
|
104
|
+
psi|omega)\b/xi, "&\\1;")
|
105
|
+
end
|
106
|
+
|
88
107
|
module_function :adoc2xml
|
89
108
|
|
90
109
|
class EmptyAttr
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "metanorma/standoc/utils"
|
2
|
-
require_relative "
|
3
|
-
require_relative "
|
4
|
-
require_relative "
|
2
|
+
require_relative "validate_section"
|
3
|
+
require_relative "validate_table"
|
4
|
+
require_relative "validate_term"
|
5
5
|
require "nokogiri"
|
6
6
|
require "jing"
|
7
7
|
require "iev"
|
data/metanorma-standoc.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
|
31
31
|
spec.add_dependency "asciidoctor", "~> 2.0.0"
|
32
32
|
spec.add_dependency "iev", "~> 0.3.0"
|
33
|
-
spec.add_dependency "isodoc", "~> 2.
|
33
|
+
spec.add_dependency "isodoc", "~> 2.6.0"
|
34
34
|
spec.add_dependency "metanorma", ">= 1.5.0"
|
35
35
|
spec.add_dependency "metanorma-plugin-datastruct", "~> 0.2.0"
|
36
36
|
spec.add_dependency "metanorma-plugin-glossarist", "~> 0.1.1"
|
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
|
+
version: 2.5.0
|
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-07
|
11
|
+
date: 2023-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
47
|
+
version: 2.6.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
54
|
+
version: 2.6.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: metanorma
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|