metanorma-standoc 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -3
- data/lib/asciidoctor/standoc/base.rb +3 -1
- data/lib/asciidoctor/standoc/blocks.rb +15 -3
- data/lib/asciidoctor/standoc/cleanup.rb +16 -2
- data/lib/asciidoctor/standoc/cleanup_footnotes.rb +11 -4
- data/lib/asciidoctor/standoc/isodoc.rng +3 -0
- data/lib/asciidoctor/standoc/macros.rb +1 -0
- data/lib/asciidoctor/standoc/section.rb +12 -3
- data/lib/asciidoctor/standoc/utils.rb +2 -1
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -0
- data/spec/asciidoctor-standoc/blocks_spec.rb +73 -2
- data/spec/asciidoctor-standoc/cleanup_spec.rb +110 -6
- data/spec/asciidoctor-standoc/inline_spec.rb +1 -1
- data/spec/asciidoctor-standoc/macros_spec.rb +1 -1
- data/spec/asciidoctor-standoc/section_spec.rb +6 -5
- data/spec/asciidoctor-standoc/table_spec.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 810c273a1e6b17c407448b2bd4c8857cf76c90238924e2f891d9961564379fa8
|
4
|
+
data.tar.gz: d2bb301e3c33c71443892e368174673d056d68e29f1ddeecc70f64c922116755
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6771846b0c74aa8fd58317cf03135e3eb2a635037db1e64e488a6225b6dc4144ca934af8abc41cc551d9e1657abcab5331454a47c48f273fbc9150f8db8cddcf
|
7
|
+
data.tar.gz: c94f478d887abd354b24aa6ba9f4dda8095c8eb6ae496f36a871945eaacef4c94e6fb5d8c2e618faaa74dc07ab20fcca0476665f3d533d4f8d8d311fdf75ae29
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
metanorma-standoc (1.1.
|
4
|
+
metanorma-standoc (1.1.2)
|
5
5
|
asciidoctor (~> 1.5.7)
|
6
6
|
concurrent-ruby
|
7
|
+
html2doc (~> 0.8.0)
|
7
8
|
iev (~> 0.2.0)
|
8
9
|
isodoc (~> 0.9.0)
|
9
10
|
relaton (~> 0.3.1)
|
@@ -19,7 +20,7 @@ GEM
|
|
19
20
|
httpclient (~> 2.8, >= 2.8.3)
|
20
21
|
json (>= 1.5.1)
|
21
22
|
asciidoctor (1.5.8)
|
22
|
-
asciimath (1.0.
|
23
|
+
asciimath (1.0.8)
|
23
24
|
ast (2.4.0)
|
24
25
|
byebug (10.0.2)
|
25
26
|
cnccs (0.1.3)
|
@@ -53,7 +54,7 @@ GEM
|
|
53
54
|
guard-compat (~> 1.1)
|
54
55
|
rspec (>= 2.99.0, < 4.0)
|
55
56
|
hashdiff (0.3.8)
|
56
|
-
html2doc (0.8.
|
57
|
+
html2doc (0.8.9)
|
57
58
|
asciimath (~> 1.0.7)
|
58
59
|
htmlentities (~> 4.3.4)
|
59
60
|
image_size
|
@@ -82,6 +82,8 @@ module Asciidoctor
|
|
82
82
|
@draft = node.attributes.has_key?("draft")
|
83
83
|
@novalid = node.attr("novalid")
|
84
84
|
@smartquotes = node.attr("smartquotes") != "false"
|
85
|
+
@keepasciimath = node.attr("mn-keep-asciimath") &&
|
86
|
+
node.attr("mn-keep-asciimath") != "false"
|
85
87
|
@fontheader = default_fonts(node)
|
86
88
|
@files_to_delete = []
|
87
89
|
@filename = node.attr("docfile") ?
|
@@ -150,7 +152,7 @@ module Asciidoctor
|
|
150
152
|
result << noko { |ixml| front node, ixml }
|
151
153
|
result << noko { |ixml| middle node, ixml }
|
152
154
|
result << "</standard-document>"
|
153
|
-
textcleanup(result
|
155
|
+
textcleanup(result)
|
154
156
|
end
|
155
157
|
|
156
158
|
def makexml(node)
|
@@ -70,6 +70,11 @@ module Asciidoctor
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def note(n)
|
73
|
+
a = noko do |xml|
|
74
|
+
xml.note **id_attr(n) do |c|
|
75
|
+
wrap_in_para(n, c)
|
76
|
+
end
|
77
|
+
end
|
73
78
|
noko do |xml|
|
74
79
|
xml.note **id_attr(n) do |c|
|
75
80
|
wrap_in_para(n, c)
|
@@ -200,14 +205,21 @@ module Asciidoctor
|
|
200
205
|
end
|
201
206
|
end
|
202
207
|
|
208
|
+
# NOTE: html escaping is performed by Nokogiri
|
203
209
|
def listing(node)
|
204
|
-
|
205
|
-
|
206
|
-
xml.sourcecode
|
210
|
+
attrs = { lang: node.attr("language"), id: Utils::anchor_or_uuid(node) }
|
211
|
+
fragment = ::Nokogiri::XML::Builder.new do |xml|
|
212
|
+
xml.sourcecode **attr_code(attrs) do |s|
|
207
213
|
figure_title(node, s)
|
208
214
|
s << node.content
|
209
215
|
end
|
210
216
|
end
|
217
|
+
fragment.to_xml(encoding: "US-ASCII", save_with:
|
218
|
+
Nokogiri::XML::Node::SaveOptions::NO_DECLARATION)
|
219
|
+
end
|
220
|
+
|
221
|
+
def pass(node)
|
222
|
+
node.content
|
211
223
|
end
|
212
224
|
end
|
213
225
|
end
|
@@ -2,6 +2,7 @@ require "date"
|
|
2
2
|
require "nokogiri"
|
3
3
|
require "pathname"
|
4
4
|
require "open-uri"
|
5
|
+
require "html2doc"
|
5
6
|
require "pp"
|
6
7
|
require_relative "./cleanup_block.rb"
|
7
8
|
require_relative "./cleanup_footnotes.rb"
|
@@ -10,7 +11,18 @@ require_relative "./cleanup_ref.rb"
|
|
10
11
|
module Asciidoctor
|
11
12
|
module Standoc
|
12
13
|
module Cleanup
|
13
|
-
def textcleanup(
|
14
|
+
def textcleanup(result)
|
15
|
+
text = result.flatten.map { |l| l.sub(/\n$/, "") } * "\n"
|
16
|
+
if !@keepasciimath
|
17
|
+
text = text.gsub(%r{<stem type="AsciiMath">(.+?)</stem>},
|
18
|
+
'<amathstem>\1</amathstem>')
|
19
|
+
text = Html2Doc.
|
20
|
+
asciimath_to_mathml(text, ['<amathstem>', "</amathstem>"]).
|
21
|
+
gsub(%r{<math xmlns='http://www.w3.org/1998/Math/MathML'>},
|
22
|
+
"<stem type='MathML'>"\
|
23
|
+
"<math xmlns='http://www.w3.org/1998/Math/MathML'>").
|
24
|
+
gsub(%r{</math>}, %{</math></stem>})
|
25
|
+
end
|
14
26
|
text.gsub(/\s+<fn /, "<fn ")
|
15
27
|
end
|
16
28
|
|
@@ -60,7 +72,8 @@ module Asciidoctor
|
|
60
72
|
TEXT_ELEMS =
|
61
73
|
%w{status language script version author name callout phone email
|
62
74
|
street city state country postcode identifier referenceFrom
|
63
|
-
referenceTo docidentifier docnumber prefix initial addition surname
|
75
|
+
referenceTo docidentifier docnumber prefix initial addition surname
|
76
|
+
forename
|
64
77
|
title draft secretariat title-main title-intro title-part}.freeze
|
65
78
|
|
66
79
|
# it seems Nokogiri::XML is treating the content of <script> as cdata,
|
@@ -228,6 +241,7 @@ module Asciidoctor
|
|
228
241
|
|
229
242
|
def mathml_cleanup(xmldoc)
|
230
243
|
xmldoc.xpath("//stem[@type = 'MathML']").each do |x|
|
244
|
+
next if x.children.any? { |y| y.element? }
|
231
245
|
math = x.text.gsub(/</, "<").gsub(/>/, ">").gsub(/"/, '"').
|
232
246
|
gsub(/&/, "&").gsub(/<[^:\/]+:/, "<").gsub(/<\/[^:]+:/, "</").
|
233
247
|
gsub(/ xmlns[^>]+/, "").
|
@@ -9,6 +9,11 @@ require "pp"
|
|
9
9
|
module Asciidoctor
|
10
10
|
module Standoc
|
11
11
|
module Cleanup
|
12
|
+
def footnote_content(fn)
|
13
|
+
c = fn.children.respond_to?(:to_xml) ? fn.children.to_xml : fn.children
|
14
|
+
c.gsub(/ id="[^"]+"/, "")
|
15
|
+
end
|
16
|
+
|
12
17
|
# include footnotes inside figure
|
13
18
|
def figure_footnote_cleanup(xmldoc)
|
14
19
|
nomatches = false
|
@@ -24,11 +29,12 @@ module Asciidoctor
|
|
24
29
|
end
|
25
30
|
|
26
31
|
def table_footnote_renumber1(fn, i, seen)
|
27
|
-
|
32
|
+
content = footnote_content(fn)
|
33
|
+
if seen[content] then outnum = seen[content]
|
28
34
|
else
|
29
35
|
i += 1
|
30
36
|
outnum = i
|
31
|
-
seen[
|
37
|
+
seen[content] = outnum
|
32
38
|
end
|
33
39
|
fn["reference"] = (outnum - 1 + "a".ord).chr
|
34
40
|
fn["table"] = true
|
@@ -47,11 +53,12 @@ module Asciidoctor
|
|
47
53
|
|
48
54
|
def other_footnote_renumber1(fn, i, seen)
|
49
55
|
unless fn["table"]
|
50
|
-
|
56
|
+
content = footnote_content(fn)
|
57
|
+
if seen[content] then outnum = seen[content]
|
51
58
|
else
|
52
59
|
i += 1
|
53
60
|
outnum = i
|
54
|
-
seen[
|
61
|
+
seen[content] = outnum
|
55
62
|
end
|
56
63
|
fn["reference"] = outnum.to_s
|
57
64
|
end
|
@@ -116,16 +116,25 @@ module Asciidoctor
|
|
116
116
|
|
117
117
|
def symbols_parse(attrs, xml, node)
|
118
118
|
xml.definitions **attr_code(attrs) do |xml_section|
|
119
|
+
xml_section.title { |t| t << node.title }
|
119
120
|
xml_section << node.content
|
120
121
|
end
|
121
122
|
end
|
122
123
|
|
124
|
+
SYMBOLS_TITLES = ["symbols and abbreviated terms", "symbols",
|
125
|
+
"abbreviated terms"].freeze
|
126
|
+
|
123
127
|
# subclause contains subclauses
|
124
128
|
def term_def_subclause_parse(attrs, xml, node)
|
125
|
-
|
129
|
+
if node.role == "nonterm"
|
130
|
+
@term_def = false
|
131
|
+
clause_parse(attrs, xml, node)
|
132
|
+
@term_def = true
|
133
|
+
return
|
134
|
+
end
|
126
135
|
sub = node.find_by(context: :section) { |s| s.level == node.level + 1 }
|
127
136
|
sub.empty? || (return term_def_parse(attrs, xml, node, false))
|
128
|
-
node.title.
|
137
|
+
SYMBOLS_TITLES.include?(node.title.downcase) and
|
129
138
|
(return symbols_parse(attrs, xml, node))
|
130
139
|
xml.term **attr_code(attrs) do |xml_section|
|
131
140
|
xml_section.preferred { |name| name << node.title }
|
@@ -136,7 +145,7 @@ module Asciidoctor
|
|
136
145
|
def term_def_title(toplevel, node)
|
137
146
|
return node.title unless toplevel
|
138
147
|
sub = node.find_by(context: :section) do |s|
|
139
|
-
s.title.
|
148
|
+
SYMBOLS_TITLES.include? s.title.downcase
|
140
149
|
end
|
141
150
|
return "Terms and definitions" if sub.empty?
|
142
151
|
"Terms, definitions, symbols and abbreviated terms"
|
@@ -110,7 +110,8 @@ module Asciidoctor
|
|
110
110
|
fragment = doc.fragment("")
|
111
111
|
::Nokogiri::XML::Builder.with fragment, &block
|
112
112
|
fragment.to_xml(encoding: "US-ASCII").lines.map do |l|
|
113
|
-
l.gsub(
|
113
|
+
#l.gsub(/(?<!\s)\n/, " ")
|
114
|
+
l.sub(/\n$/, " ")
|
114
115
|
end
|
115
116
|
end
|
116
117
|
|
data/metanorma-standoc.gemspec
CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_dependency "relaton", "~> 0.3.1"
|
34
34
|
spec.add_dependency "sterile", "~> 1.0.14"
|
35
35
|
spec.add_dependency "concurrent-ruby"
|
36
|
+
spec.add_dependency "html2doc", "~> 0.8.0"
|
36
37
|
|
37
38
|
spec.add_development_dependency "bundler", "~> 2.0.1"
|
38
39
|
spec.add_development_dependency "byebug"
|
@@ -1,6 +1,22 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe Asciidoctor::Standoc do
|
4
|
+
it "processes pass blocks" do
|
5
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
6
|
+
#{ASCIIDOC_BLANK_HDR}
|
7
|
+
|
8
|
+
++++
|
9
|
+
<abc>X > Y</abc>
|
10
|
+
++++
|
11
|
+
INPUT
|
12
|
+
#{BLANK_HDR}
|
13
|
+
<sections>
|
14
|
+
<abc>X > Y</abc>
|
15
|
+
</sections>
|
16
|
+
</standard-document>
|
17
|
+
OUTPUT
|
18
|
+
end
|
19
|
+
|
4
20
|
it "processes open blocks" do
|
5
21
|
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
6
22
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -142,6 +158,33 @@ RSpec.describe Asciidoctor::Standoc do
|
|
142
158
|
OUTPUT
|
143
159
|
end
|
144
160
|
|
161
|
+
it "processes term notes as plain notes in nonterm clauses" do
|
162
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
163
|
+
#{ASCIIDOC_BLANK_HDR}
|
164
|
+
== Terms and Definitions
|
165
|
+
|
166
|
+
[.nonterm]
|
167
|
+
=== Term1
|
168
|
+
|
169
|
+
NOTE: This is a note
|
170
|
+
INPUT
|
171
|
+
#{BLANK_HDR}
|
172
|
+
<sections>
|
173
|
+
<terms id="_" obligation="normative">
|
174
|
+
<title>Terms and definitions</title>
|
175
|
+
<clause id="_" inline-header="false" obligation="normative">
|
176
|
+
<title>Term1</title>
|
177
|
+
<note id="_">
|
178
|
+
<p id="_">This is a note</p>
|
179
|
+
</note>
|
180
|
+
</clause>
|
181
|
+
</terms>
|
182
|
+
</sections>
|
183
|
+
</standard-document>
|
184
|
+
|
185
|
+
OUTPUT
|
186
|
+
end
|
187
|
+
|
145
188
|
it "processes notes" do
|
146
189
|
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
147
190
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -266,6 +309,34 @@ RSpec.describe Asciidoctor::Standoc do
|
|
266
309
|
OUTPUT
|
267
310
|
end
|
268
311
|
|
312
|
+
it "processes term examples as plain examples in nonterm clauses" do
|
313
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
314
|
+
#{ASCIIDOC_BLANK_HDR}
|
315
|
+
== Terms and Definitions
|
316
|
+
|
317
|
+
[.nonterm]
|
318
|
+
=== Term1
|
319
|
+
|
320
|
+
[example]
|
321
|
+
This is an example
|
322
|
+
INPUT
|
323
|
+
#{BLANK_HDR}
|
324
|
+
<sections>
|
325
|
+
<terms id="_" obligation="normative">
|
326
|
+
<title>Terms and definitions</title>
|
327
|
+
<clause id="_" inline-header="false" obligation="normative">
|
328
|
+
<title>Term1</title>
|
329
|
+
<example id="_">
|
330
|
+
<p id="_">This is an example</p>
|
331
|
+
</example>
|
332
|
+
</clause>
|
333
|
+
</terms>
|
334
|
+
</sections>
|
335
|
+
</standard-document>
|
336
|
+
OUTPUT
|
337
|
+
end
|
338
|
+
|
339
|
+
|
269
340
|
it "processes examples" do
|
270
341
|
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
271
342
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -434,7 +505,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
434
505
|
INPUT
|
435
506
|
#{BLANK_HDR}
|
436
507
|
<sections>
|
437
|
-
<sourcecode id="_"><name>Caption</name>puts "Hello, world."
|
508
|
+
<sourcecode id="_" lang="ruby"><name>Caption</name>puts "Hello, world."
|
438
509
|
%w{a b c}.each do |x|
|
439
510
|
puts x
|
440
511
|
end</sourcecode>
|
@@ -457,7 +528,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
457
528
|
<2> This is another callout
|
458
529
|
INPUT
|
459
530
|
#{BLANK_HDR}
|
460
|
-
<sections><sourcecode id="_">puts "Hello, world." <callout target="_">1</callout>
|
531
|
+
<sections><sourcecode id="_" lang="ruby">puts "Hello, world." <callout target="_">1</callout>
|
461
532
|
%w{a b c}.each do |x|
|
462
533
|
puts x <callout target="_">2</callout>
|
463
534
|
end<annotation id="_">
|
@@ -143,7 +143,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
143
143
|
<sections>
|
144
144
|
<terms id="_" obligation="normative">
|
145
145
|
<title>Terms and definitions</title>
|
146
|
-
<term id="_"><preferred><stem type="
|
146
|
+
<term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>91</mn></msub></math></stem></admitted>
|
147
147
|
<definition><p id="_">Time</p></definition></term>
|
148
148
|
</terms>
|
149
149
|
</sections>
|
@@ -198,9 +198,10 @@ RSpec.describe Asciidoctor::Standoc do
|
|
198
198
|
<sections>
|
199
199
|
<terms id="_" obligation="normative">
|
200
200
|
<title>Terms and definitions</title>
|
201
|
-
<term id="_"><preferred><stem type="
|
202
|
-
<stem type="
|
203
|
-
</formula
|
201
|
+
<term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><definition><formula id="_">
|
202
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mi>A</mi></msub></math></stem>
|
203
|
+
</formula>
|
204
|
+
<p id="_">This paragraph is extraneous</p></definition>
|
204
205
|
</term>
|
205
206
|
</terms>
|
206
207
|
</sections>
|
@@ -271,7 +272,7 @@ r = 1 %</stem>
|
|
271
272
|
NOTE: That loop does not do much
|
272
273
|
INPUT
|
273
274
|
#{BLANK_HDR}
|
274
|
-
<sections><sourcecode id="_">[1...x].each do |y|
|
275
|
+
<sections><sourcecode id="_" lang="ruby">[1...x].each do |y|
|
275
276
|
puts y
|
276
277
|
end</sourcecode>
|
277
278
|
<note id="_">
|
@@ -635,7 +636,7 @@ r = 1 %</stem>
|
|
635
636
|
INPUT
|
636
637
|
#{BLANK_HDR}
|
637
638
|
<sections><formula id="_">
|
638
|
-
<stem type="
|
639
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>F</mi><mtext>or</mtext><mi>μ</mi><mi>l</mi><mi>a</mi></math></stem>
|
639
640
|
<dl id="_">
|
640
641
|
<dt>a</dt>
|
641
642
|
<dd>
|
@@ -1075,6 +1076,109 @@ r = 1 %</stem>
|
|
1075
1076
|
FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"), File.expand_path("~/.relaton/cache"), force: true
|
1076
1077
|
end
|
1077
1078
|
|
1079
|
+
it "counts footnotes with link-only content as separate footnotes" do
|
1080
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
1081
|
+
#{ASCIIDOC_BLANK_HDR}
|
1082
|
+
|
1083
|
+
footnote:[http://www.example.com]
|
1084
|
+
|
1085
|
+
footnote:[http://www.example.com]
|
1086
|
+
|
1087
|
+
footnote:[http://www.example1.com]
|
1088
|
+
INPUT
|
1089
|
+
#{BLANK_HDR}
|
1090
|
+
<sections><p id="_"><fn reference="1">
|
1091
|
+
<p id="_">
|
1092
|
+
<link target="http://www.example.com"/>
|
1093
|
+
</p>
|
1094
|
+
</fn>
|
1095
|
+
</p>
|
1096
|
+
<p id="_"><fn reference="1">
|
1097
|
+
<p id="_">
|
1098
|
+
<link target="http://www.example.com"/>
|
1099
|
+
</p>
|
1100
|
+
</fn>
|
1101
|
+
</p>
|
1102
|
+
<p id="_"><fn reference="2">
|
1103
|
+
<p id="_">
|
1104
|
+
<link target="http://www.example1.com"/>
|
1105
|
+
</p>
|
1106
|
+
</fn>
|
1107
|
+
</p></sections>
|
1108
|
+
|
1109
|
+
|
1110
|
+
</standard-document>
|
1111
|
+
OUTPUT
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
it "retains AsciiMath on request" do
|
1115
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
1116
|
+
= Document title
|
1117
|
+
Author
|
1118
|
+
:docfile: test.adoc
|
1119
|
+
:nodoc:
|
1120
|
+
:novalid:
|
1121
|
+
:no-isobib:
|
1122
|
+
:mn-keep-asciimath:
|
1123
|
+
|
1124
|
+
stem:[1/r]
|
1125
|
+
INPUT
|
1126
|
+
#{BLANK_HDR}
|
1127
|
+
<sections>
|
1128
|
+
<p id="_">
|
1129
|
+
<stem type="AsciiMath">1/r</stem>
|
1130
|
+
</p>
|
1131
|
+
</sections>
|
1132
|
+
</standard-document>
|
1133
|
+
|
1134
|
+
OUTPUT
|
1135
|
+
end
|
1136
|
+
|
1137
|
+
it "converts AsciiMath to MathML by default" do
|
1138
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
1139
|
+
= Document title
|
1140
|
+
Author
|
1141
|
+
:docfile: test.adoc
|
1142
|
+
:nodoc:
|
1143
|
+
:novalid:
|
1144
|
+
:no-isobib:
|
1145
|
+
|
1146
|
+
stem:[1/r]
|
1147
|
+
INPUT
|
1148
|
+
#{BLANK_HDR}
|
1149
|
+
<sections>
|
1150
|
+
<p id="_">
|
1151
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mn>1</mn><mi>r</mi></mfrac></math></stem>
|
1152
|
+
</p>
|
1153
|
+
</sections>
|
1154
|
+
</standard-document>
|
1155
|
+
OUTPUT
|
1156
|
+
end
|
1157
|
+
|
1158
|
+
it "cleans up text MathML" do
|
1159
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
1160
|
+
= Document title
|
1161
|
+
Author
|
1162
|
+
:docfile: test.adoc
|
1163
|
+
:nodoc:
|
1164
|
+
:novalid:
|
1165
|
+
:no-isobib:
|
1166
|
+
|
1167
|
+
++++
|
1168
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mn>1</mn><mi>r</mi></mfrac></math></stem>
|
1169
|
+
++++
|
1170
|
+
INPUT
|
1171
|
+
#{BLANK_HDR}
|
1172
|
+
<sections>
|
1173
|
+
<stem type="MathML">/www.w3.org/1998/Math/MathML”><mfrac><mn>1</mn><mi>r</mi></mfrac></stem>
|
1174
|
+
</sections>
|
1175
|
+
|
1176
|
+
|
1177
|
+
</standard-document>
|
1178
|
+
OUTPUT
|
1179
|
+
end
|
1180
|
+
|
1181
|
+
|
1078
1182
|
private
|
1079
1183
|
|
1080
1184
|
def mock_iecbib_get_iec60050_103_01
|
@@ -32,7 +32,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
32
32
|
super<sup>script</sup>
|
33
33
|
sub<sub>script</sub>
|
34
34
|
sub<sub><em>scr</em>ipt</sub>
|
35
|
-
<stem type="
|
35
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>a</mi><mn>90</mn></msub></math></stem>
|
36
36
|
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
|
37
37
|
<admitted>alt</admitted>
|
38
38
|
<deprecates>deprecated</deprecates>
|
@@ -103,7 +103,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
103
103
|
INPUT
|
104
104
|
#{BLANK_HDR}
|
105
105
|
<sections>
|
106
|
-
<sourcecode id="_">@startuml
|
106
|
+
<sourcecode id="_" lang="plantuml">@startuml
|
107
107
|
Alice -> Bob: Authentication Request
|
108
108
|
Bob --> Alice: Authentication Response
|
109
109
|
|
@@ -38,7 +38,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
38
38
|
|
39
39
|
=== Symbols and Abbreviated Terms
|
40
40
|
|
41
|
-
==
|
41
|
+
== Abbreviated Terms
|
42
42
|
|
43
43
|
== Clause 4
|
44
44
|
|
@@ -89,8 +89,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
89
89
|
<preferred>Term2</preferred>
|
90
90
|
</term>
|
91
91
|
</terms>
|
92
|
-
<definitions id="_"
|
93
|
-
|
92
|
+
<definitions id="_"><title>Symbols and Abbreviated Terms</title></definitions>
|
93
|
+
</clause>
|
94
|
+
<definitions id="_"><title>Abbreviated Terms</title></definitions>
|
94
95
|
<clause id="_" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="_" inline-header="false" obligation="normative">
|
95
96
|
<title>Introduction</title>
|
96
97
|
</clause>
|
@@ -197,8 +198,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
197
198
|
<preferred>Term2</preferred>
|
198
199
|
</term>
|
199
200
|
</clause>
|
200
|
-
<definitions id="_"
|
201
|
-
<definitions id="_"
|
201
|
+
<definitions id="_"><title>Σύμβολα και Συντομογραφίες</title> </definitions></terms>
|
202
|
+
<definitions id="_"><title>Σύμβολα και Συντομογραφίες</title> </definitions>
|
202
203
|
<clause id="_" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="_" inline-header="false" obligation="normative">
|
203
204
|
<title>Introduction</title>
|
204
205
|
</clause>
|
@@ -150,7 +150,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
150
150
|
<tr>
|
151
151
|
<th rowspan="2" align="left">Defect</th>
|
152
152
|
<th colspan="4" align="center">Maximum permissible mass fraction of defects in husked rice<br/>
|
153
|
-
|
153
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>w</mi><mi>max</mi></msub></math></stem></th>
|
154
154
|
</tr>
|
155
155
|
<tr>
|
156
156
|
<td align="left">in husked rice</td>
|
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.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: html2doc
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.8.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.8.0
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: bundler
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|