metanorma-standoc 1.9.0 → 1.10.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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -13
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -8
  5. data/lib/asciidoctor/standoc/base.rb +31 -35
  6. data/lib/asciidoctor/standoc/biblio.rng +1 -0
  7. data/lib/asciidoctor/standoc/blocks.rb +25 -9
  8. data/lib/asciidoctor/standoc/blocks_notes.rb +41 -24
  9. data/lib/asciidoctor/standoc/cleanup.rb +59 -84
  10. data/lib/asciidoctor/standoc/cleanup_block.rb +63 -85
  11. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +28 -15
  12. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +1 -0
  13. data/lib/asciidoctor/standoc/cleanup_image.rb +71 -0
  14. data/lib/asciidoctor/standoc/cleanup_inline.rb +117 -77
  15. data/lib/asciidoctor/standoc/cleanup_maths.rb +36 -27
  16. data/lib/asciidoctor/standoc/cleanup_ref.rb +31 -15
  17. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +1 -1
  18. data/lib/asciidoctor/standoc/cleanup_reqt.rb +47 -0
  19. data/lib/asciidoctor/standoc/cleanup_section.rb +77 -135
  20. data/lib/asciidoctor/standoc/cleanup_section_names.rb +75 -0
  21. data/lib/asciidoctor/standoc/cleanup_terms.rb +19 -18
  22. data/lib/asciidoctor/standoc/converter.rb +7 -2
  23. data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +67 -66
  24. data/lib/asciidoctor/standoc/front.rb +35 -18
  25. data/lib/asciidoctor/standoc/front_contributor.rb +70 -45
  26. data/lib/asciidoctor/standoc/inline.rb +45 -34
  27. data/lib/asciidoctor/standoc/isodoc.rng +209 -4
  28. data/lib/asciidoctor/standoc/lists.rb +4 -2
  29. data/lib/asciidoctor/standoc/macros.rb +11 -11
  30. data/lib/asciidoctor/standoc/macros_form.rb +63 -0
  31. data/lib/asciidoctor/standoc/macros_plantuml.rb +19 -21
  32. data/lib/asciidoctor/standoc/macros_terms.rb +33 -23
  33. data/lib/asciidoctor/standoc/ref.rb +87 -112
  34. data/lib/asciidoctor/standoc/ref_date_id.rb +62 -0
  35. data/lib/asciidoctor/standoc/ref_sect.rb +20 -17
  36. data/lib/asciidoctor/standoc/section.rb +3 -1
  37. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +40 -27
  38. data/lib/asciidoctor/standoc/terms.rb +25 -18
  39. data/lib/asciidoctor/standoc/utils.rb +35 -9
  40. data/lib/asciidoctor/standoc/validate.rb +48 -33
  41. data/lib/metanorma-standoc.rb +0 -1
  42. data/lib/metanorma/standoc/version.rb +1 -1
  43. data/metanorma-standoc.gemspec +4 -4
  44. data/spec/asciidoctor/base_spec.rb +701 -508
  45. data/spec/asciidoctor/blocks_spec.rb +831 -738
  46. data/spec/asciidoctor/cleanup_sections_spec.rb +51 -14
  47. data/spec/asciidoctor/cleanup_spec.rb +889 -682
  48. data/spec/asciidoctor/inline_spec.rb +62 -14
  49. data/spec/asciidoctor/isobib_cache_spec.rb +404 -358
  50. data/spec/asciidoctor/lists_spec.rb +149 -137
  51. data/spec/asciidoctor/macros_plantuml_spec.rb +8 -8
  52. data/spec/asciidoctor/macros_spec.rb +923 -503
  53. data/spec/asciidoctor/macros_yaml2text_spec.rb +1 -1
  54. data/spec/asciidoctor/refs_dl_spec.rb +4 -4
  55. data/spec/asciidoctor/refs_spec.rb +1528 -1533
  56. data/spec/asciidoctor/section_spec.rb +405 -299
  57. data/spec/asciidoctor/table_spec.rb +6 -6
  58. data/spec/asciidoctor/validate_spec.rb +342 -304
  59. data/spec/spec_helper.rb +13 -9
  60. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +54 -54
  61. data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
  62. data/spec/vcr_cassettes/isobib_get_123_1.yml +25 -25
  63. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +37 -37
  64. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  65. data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
  66. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  67. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  68. metadata +16 -15
  69. data/lib/liquid/custom_blocks/key_iterator.rb +0 -21
  70. data/lib/liquid/custom_blocks/with_json_nested_context.rb +0 -18
  71. data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +0 -19
  72. data/lib/liquid/custom_filters/values.rb +0 -7
@@ -4,7 +4,7 @@ require "fileutils"
4
4
 
5
5
  RSpec.describe Asciidoctor::Standoc do
6
6
  it "appends any initial user-supplied text to boilerplate in terms and definitions" do
7
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
7
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
8
8
  #{ASCIIDOC_BLANK_HDR}
9
9
  == Terms and Definitions
10
10
 
@@ -36,7 +36,7 @@ RSpec.describe Asciidoctor::Standoc do
36
36
  end
37
37
 
38
38
  it "removes initial extraneous material from Normative References" do
39
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
39
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
40
40
  #{ASCIIDOC_BLANK_HDR}
41
41
  [bibliography]
42
42
  == Normative References
@@ -69,8 +69,45 @@ RSpec.describe Asciidoctor::Standoc do
69
69
  OUTPUT
70
70
  end
71
71
 
72
- it "sorts references with their notes in Bibliography" do
73
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
72
+ it "preserves user-supplied boilerplate in Normative References" do
73
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
74
+ #{ASCIIDOC_BLANK_HDR}
75
+ [bibliography]
76
+ == Normative References
77
+
78
+ [NOTE,type=boilerplate]
79
+ --
80
+ This is extraneous information
81
+ --
82
+
83
+ * [[[iso216,ISO 216]]], _Reference_
84
+
85
+ This is also extraneous information
86
+ INPUT
87
+ #{BLANK_HDR}
88
+ <sections></sections>
89
+ <bibliography><references id="_" obligation="informative" normative="true"><title>Normative references</title>
90
+ <p id='_'>This is extraneous information</p>
91
+ <bibitem id="iso216" type="standard">
92
+ <title format="text/plain">Reference</title>
93
+ <docidentifier>ISO 216</docidentifier>
94
+ <docnumber>216</docnumber>
95
+ <contributor>
96
+ <role type="publisher"/>
97
+ <organization>
98
+ <name>ISO</name>
99
+ </organization>
100
+ </contributor>
101
+ </bibitem>
102
+ <p id='_'>This is also extraneous information</p>
103
+ </references>
104
+ </bibliography>
105
+ </standard-document>
106
+ OUTPUT
107
+ end
108
+
109
+ it "sorts references with their notes in Bibliography" do
110
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
74
111
  #{ASCIIDOC_BLANK_HDR}
75
112
  [bibliography]
76
113
  == Bibliography
@@ -144,7 +181,7 @@ RSpec.describe Asciidoctor::Standoc do
144
181
  end
145
182
 
146
183
  it "defaults section obligations" do
147
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
184
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
148
185
  #{ASCIIDOC_BLANK_HDR}
149
186
 
150
187
  == Clause
@@ -169,7 +206,7 @@ end
169
206
  end
170
207
 
171
208
  it "extends clause levels past 5" do
172
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
209
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
173
210
  #{ASCIIDOC_BLANK_HDR}
174
211
 
175
212
  == Clause1
@@ -232,7 +269,7 @@ end
232
269
  end
233
270
 
234
271
  it "inserts boilerplate before empty Normative References" do
235
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
272
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
236
273
  #{ASCIIDOC_BLANK_HDR}
237
274
 
238
275
  [bibliography]
@@ -250,7 +287,7 @@ end
250
287
  end
251
288
 
252
289
  it "inserts boilerplate before non-empty Normative References" do
253
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
290
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
254
291
  #{ASCIIDOC_BLANK_HDR}
255
292
 
256
293
  [bibliography]
@@ -274,7 +311,7 @@ end
274
311
  end
275
312
 
276
313
  it "inserts boilerplate before empty Normative References in French" do
277
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
314
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
278
315
  = Document title
279
316
  Author
280
317
  :docfile: test.adoc
@@ -298,7 +335,7 @@ it "inserts boilerplate before empty Normative References in French" do
298
335
  end
299
336
 
300
337
  it "processes section names, with footnotes" do
301
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
338
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
302
339
  #{ASCIIDOC_BLANK_HDR}
303
340
  .Foreword.footnote:[A]
304
341
 
@@ -590,7 +627,7 @@ OUTPUT
590
627
  end
591
628
 
592
629
  it "processes section names, default to English" do
593
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
630
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
594
631
  #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: tlh\n:script: Latn\n:nodoc:")}
595
632
  .Foreword
596
633
 
@@ -821,7 +858,7 @@ OUTPUT
821
858
  end
822
859
 
823
860
  it "processes section names, French" do
824
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
861
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
825
862
  #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: fr\n:script: Latn\n:nodoc:")}
826
863
  .Foreword
827
864
 
@@ -1055,7 +1092,7 @@ OUTPUT
1055
1092
  end
1056
1093
 
1057
1094
  it "processes section names, Simplified Chinese" do
1058
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1095
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1059
1096
  #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: zh\n:script: Hans\n:nodoc:")}
1060
1097
  .Foreword
1061
1098
 
@@ -1286,7 +1323,7 @@ OUTPUT
1286
1323
  end
1287
1324
 
1288
1325
  it "processes section names, internationalisation file" do
1289
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1326
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1290
1327
  #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":i18nyaml: spec/assets/i18n.yaml")}
1291
1328
  .Foreword
1292
1329
 
@@ -4,37 +4,40 @@ require "fileutils"
4
4
 
5
5
  RSpec.describe Asciidoctor::Standoc do
6
6
  it "processes svgmap" do
7
- FileUtils.cp "spec/fixtures/action_schemaexpg1.svg", "action_schemaexpg1.svg"
8
- FileUtils.cp "spec/fixtures/action_schemaexpg1.svg", "action_schemaexpg2.svg"
9
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).gsub(%r{<image.*?</image>}m, "<image/>").gsub(%r{<style.*?</style>}m, "<style/>")).to be_equivalent_to xmlpp(<<~"OUTPUT")
10
- #{ASCIIDOC_BLANK_HDR}
11
-
12
- [svgmap%unnumbered,number=8,subsequence=A,keep-with-next=true,keep-lines-together=true]
13
- ====
14
- * <<ref1,Computer>>; http://www.example.com
15
- ====
16
-
17
- [[ref1]]
18
- .SVG title
19
- [.svgmap]
20
- ====
21
- image::action_schemaexpg1.svg[]
22
-
23
- * <<ref1,Computer>>; mn://action_schema
24
- * http://www.example.com[Phone]; http://www.example.com
25
- ====
26
-
27
- [[ref2]]
28
- [svgmap%unnumbered,number=8,subsequence=A,keep-with-next=true,keep-lines-together=true]
29
- ====
30
- [alt=Workmap]
31
- image::action_schemaexpg2.svg[]
32
-
33
- * <<ref1,Computer>>; mn://action_schema
34
- * http://www.example.com[Phone]; mn://basic_attribute_schema
35
- * <<express:action_schema:action_schema.basic,Coffee>>; mn://support_resource_schema
36
- ====
7
+ FileUtils.cp "spec/fixtures/action_schemaexpg1.svg",
8
+ "action_schemaexpg1.svg"
9
+ FileUtils.cp "spec/fixtures/action_schemaexpg1.svg",
10
+ "action_schemaexpg2.svg"
11
+ input = <<~INPUT
12
+ #{ASCIIDOC_BLANK_HDR}
13
+
14
+ [svgmap%unnumbered,number=8,subsequence=A,keep-with-next=true,keep-lines-together=true]
15
+ ====
16
+ * <<ref1,Computer>>; http://www.example.com
17
+ ====
18
+
19
+ [[ref1]]
20
+ .SVG title
21
+ [.svgmap]
22
+ ====
23
+ image::action_schemaexpg1.svg[]
24
+
25
+ * <<ref1,Computer>>; mn://action_schema
26
+ * http://www.example.com[Phone]; http://www.example.com
27
+ ====
28
+
29
+ [[ref2]]
30
+ [svgmap%unnumbered,number=8,subsequence=A,keep-with-next=true,keep-lines-together=true]
31
+ ====
32
+ [alt=Workmap]
33
+ image::action_schemaexpg2.svg[]
34
+
35
+ * <<ref1,Computer>>; mn://action_schema
36
+ * http://www.example.com[Phone]; mn://basic_attribute_schema
37
+ * <<express:action_schema:action_schema.basic,Coffee>>; mn://support_resource_schema
38
+ ====
37
39
  INPUT
40
+ output = <<~OUTPUT
38
41
  #{BLANK_HDR}
39
42
  <sections>
40
43
  <svgmap unnumbered='true' number='8' subsequence='A' keep-with-next='true' keep-lines-together='true'>
@@ -44,9 +47,7 @@ RSpec.describe Asciidoctor::Standoc do
44
47
  </svgmap>
45
48
  <figure id='ref1'>
46
49
  <name>SVG title</name>
47
- <?xml version="1.0" encoding="utf-8"??>
48
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
49
- <svg xmlns='http://www.w3.org/2000/svg' version='1.1' id='Layer_1' x='0px' y='0px' viewbox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve' xmlns:xlink='http://www.w3.org/1999/xlink'>
50
+ <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1_000000001' x='0px' y='0px' viewBox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve'>
50
51
  <style/>
51
52
  <image/>
52
53
  <a xlink:href='#ref1'>
@@ -62,9 +63,7 @@ RSpec.describe Asciidoctor::Standoc do
62
63
  </figure>
63
64
  <svgmap>
64
65
  <figure id='ref2' unnumbered='true' number='8' subsequence='A' keep-with-next='true' keep-lines-together='true'>
65
- <?xml version="1.0" encoding="utf-8"??>
66
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
67
- <svg xmlns='http://www.w3.org/2000/svg' version='1.1' id='Layer_1' x='0px' y='0px' viewbox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve' xmlns:xlink='http://www.w3.org/1999/xlink'>
66
+ <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1_000000002' x='0px' y='0px' viewBox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve'>
68
67
  <style/>
69
68
  <image/>
70
69
  <a xlink:href='#ref1'>
@@ -99,25 +98,30 @@ RSpec.describe Asciidoctor::Standoc do
99
98
  </bibliography>
100
99
  </standard-document>
101
100
  OUTPUT
101
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))
102
+ .gsub(%r{<image.*?</image>}m, "<image/>")
103
+ .gsub(%r{<style.*?</style>}m, "<style/>"))
104
+ .to be_equivalent_to xmlpp(output)
102
105
  end
103
106
 
104
107
  it "processes markup in sourcecode" do
105
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
106
- #{ASCIIDOC_BLANK_HDR}
108
+ input = <<~INPUT
109
+ #{ASCIIDOC_BLANK_HDR}
107
110
 
108
- [source]
109
- ----
110
- <tag/>
111
- ----
111
+ [source]
112
+ ----
113
+ <tag/>
114
+ ----
112
115
 
113
- [[A]]
114
- [source]
115
- ----
116
- var {{{*x*}}} : {{{<<A,recursive>>}}} <tag/>
117
- ----
116
+ [[A]]
117
+ [source]
118
+ ----
119
+ var {{{*x*}}} : {{{<<A,recursive>>}}} <tag/>
120
+ ----
118
121
 
119
122
 
120
123
  INPUT
124
+ output = <<~OUTPUT
121
125
  #{BLANK_HDR}
122
126
  <sections>
123
127
  <sourcecode id='_'>&lt;tag/&gt;</sourcecode>
@@ -131,10 +135,12 @@ RSpec.describe Asciidoctor::Standoc do
131
135
  </sections>
132
136
  </standard-document>
133
137
  OUTPUT
138
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
139
+ .to be_equivalent_to xmlpp(output)
134
140
  end
135
141
 
136
142
  it "processes markup in sourcecode with custom delimiters" do
137
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
143
+ input = <<~INPUT
138
144
  = Document title
139
145
  Author
140
146
  :docfile: test.adoc
@@ -152,6 +158,7 @@ RSpec.describe Asciidoctor::Standoc do
152
158
 
153
159
 
154
160
  INPUT
161
+ output = <<~OUTPUT
155
162
  #{BLANK_HDR}
156
163
  <sections>
157
164
  <sourcecode id='A'>
@@ -163,15 +170,18 @@ RSpec.describe Asciidoctor::Standoc do
163
170
  </sections>
164
171
  </standard-document>
165
172
  OUTPUT
173
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
174
+ .to be_equivalent_to xmlpp(output)
166
175
  end
167
176
 
168
177
  it "applies smartquotes by default" do
169
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
178
+ input = <<~INPUT
170
179
  #{ASCIIDOC_BLANK_HDR}
171
180
  == "Quotation" A's
172
181
 
173
182
  '24:00:00'.
174
183
  INPUT
184
+ output = <<~OUTPUT
175
185
  #{BLANK_HDR}
176
186
  <sections>
177
187
  <clause id="_" inline-header="false" obligation="normative">
@@ -181,10 +191,12 @@ RSpec.describe Asciidoctor::Standoc do
181
191
  </sections>
182
192
  </standard-document>
183
193
  OUTPUT
194
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
195
+ .to be_equivalent_to xmlpp(output)
184
196
  end
185
197
 
186
198
  it "applies smartquotes when requested" do
187
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
199
+ input = <<~INPUT
188
200
  = Document title
189
201
  Author
190
202
  :docfile: test.adoc
@@ -195,6 +207,7 @@ RSpec.describe Asciidoctor::Standoc do
195
207
 
196
208
  == "Quotation" A's
197
209
  INPUT
210
+ output = <<~OUTPUT
198
211
  #{BLANK_HDR}
199
212
  <sections>
200
213
  <clause id="_" inline-header="false" obligation="normative">
@@ -203,10 +216,12 @@ RSpec.describe Asciidoctor::Standoc do
203
216
  </sections>
204
217
  </standard-document>
205
218
  OUTPUT
219
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
220
+ .to be_equivalent_to xmlpp(output)
206
221
  end
207
222
 
208
223
  it "does not apply smartquotes when requested not to" do
209
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
224
+ input = <<~INPUT
210
225
  = Document title
211
226
  Author
212
227
  :docfile: test.adoc
@@ -219,6 +234,7 @@ RSpec.describe Asciidoctor::Standoc do
219
234
 
220
235
  `"quote" A's`
221
236
  INPUT
237
+ output = <<~OUTPUT
222
238
  #{BLANK_HDR}
223
239
  <sections>
224
240
  <clause id="_" inline-header="false" obligation="normative">
@@ -230,10 +246,12 @@ RSpec.describe Asciidoctor::Standoc do
230
246
  </sections>
231
247
  </standard-document>
232
248
  OUTPUT
249
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
250
+ .to be_equivalent_to xmlpp(output)
233
251
  end
234
252
 
235
253
  it "does not apply smartquotes to sourcecode, tt, pre, pseudocode" do
236
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
254
+ input = <<~INPUT
237
255
  = Document title
238
256
  Author
239
257
  :docfile: test.adoc
@@ -259,6 +277,7 @@ RSpec.describe Asciidoctor::Standoc do
259
277
  ====
260
278
 
261
279
  INPUT
280
+ output = <<~OUTPUT
262
281
  #{BLANK_HDR}
263
282
  <sections>
264
283
  <clause id="_" inline-header="false" obligation="normative"><title>“Quotation” A’s</title><p id="_">“Quotation” A’s</p>
@@ -273,15 +292,18 @@ RSpec.describe Asciidoctor::Standoc do
273
292
  </sections>
274
293
  </standard-document>
275
294
  OUTPUT
295
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
296
+ .to be_equivalent_to xmlpp(output)
276
297
  end
277
298
 
278
299
  it "handles < > &amp; in Asciidoctor correctly" do
279
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
300
+ input = <<~INPUT
280
301
  #{ASCIIDOC_BLANK_HDR}
281
302
  == {blank}
282
303
 
283
304
  <&amp;>
284
305
  INPUT
306
+ output = <<~OUTPUT
285
307
  #{BLANK_HDR}
286
308
  <sections>
287
309
  <clause id="_" inline-header="false" obligation="normative">
@@ -290,13 +312,16 @@ RSpec.describe Asciidoctor::Standoc do
290
312
  </sections>
291
313
  </standard-document>
292
314
  OUTPUT
315
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
316
+ .to be_equivalent_to xmlpp(output)
293
317
  end
294
318
 
295
319
  it "removes empty text elements" do
296
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
320
+ input = <<~INPUT
297
321
  #{ASCIIDOC_BLANK_HDR}
298
322
  == {blank}
299
323
  INPUT
324
+ output = <<~OUTPUT
300
325
  #{BLANK_HDR}
301
326
  <sections>
302
327
  <clause id="_" inline-header="false" obligation="normative">
@@ -305,10 +330,12 @@ RSpec.describe Asciidoctor::Standoc do
305
330
  </sections>
306
331
  </standard-document>
307
332
  OUTPUT
333
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
334
+ .to be_equivalent_to xmlpp(output)
308
335
  end
309
336
 
310
337
  it "processes stem-only terms as admitted" do
311
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
338
+ input = <<~INPUT
312
339
  #{ASCIIDOC_BLANK_HDR}
313
340
  == Terms and Definitions
314
341
 
@@ -318,6 +345,7 @@ RSpec.describe Asciidoctor::Standoc do
318
345
 
319
346
  Time
320
347
  INPUT
348
+ output = <<~OUTPUT
321
349
  #{BLANK_HDR}
322
350
  <sections>
323
351
  <terms id="_" obligation="normative">
@@ -343,10 +371,12 @@ RSpec.describe Asciidoctor::Standoc do
343
371
  </sections>
344
372
  </standard-document>
345
373
  OUTPUT
374
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
375
+ .to be_equivalent_to xmlpp(output)
346
376
  end
347
377
 
348
378
  it "moves term domains out of the term definition paragraph" do
349
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
379
+ input = <<~INPUT
350
380
  #{ASCIIDOC_BLANK_HDR}
351
381
  == Terms and Definitions
352
382
 
@@ -360,6 +390,7 @@ RSpec.describe Asciidoctor::Standoc do
360
390
 
361
391
  domain:[relativity2]
362
392
  INPUT
393
+ output = <<~OUTPUT
363
394
  #{BLANK_HDR}
364
395
  <sections>
365
396
  <terms id="_" obligation="normative">
@@ -381,10 +412,12 @@ RSpec.describe Asciidoctor::Standoc do
381
412
  </sections>
382
413
  </standard-document>
383
414
  OUTPUT
415
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
416
+ .to be_equivalent_to xmlpp(output)
384
417
  end
385
418
 
386
419
  it "permits multiple blocks in term definition paragraph" do
387
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
420
+ input = <<~INPUT
388
421
  = Document title
389
422
  Author
390
423
  :docfile: test.adoc
@@ -403,6 +436,7 @@ RSpec.describe Asciidoctor::Standoc do
403
436
 
404
437
  This paragraph is extraneous
405
438
  INPUT
439
+ output = <<~OUTPUT
406
440
  #{BLANK_HDR}
407
441
  <sections>
408
442
  <terms id="_" obligation="normative">
@@ -431,35 +465,40 @@ RSpec.describe Asciidoctor::Standoc do
431
465
  </sections>
432
466
  </standard-document>
433
467
  OUTPUT
468
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
469
+ .to be_equivalent_to xmlpp(output)
434
470
  end
435
471
 
436
472
  it "moves notes inside preceding blocks, if they are not at clause end, and the blocks are not delimited" do
437
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
438
- #{ASCIIDOC_BLANK_HDR}
473
+ input = <<~INPUT
474
+ #{ASCIIDOC_BLANK_HDR}
439
475
 
440
- [stem]
441
- ++++
442
- r = 1 %
443
- r = 1 %
444
- ++++
476
+ [stem]
477
+ ++++
478
+ r = 1 %
479
+ r = 1 %
480
+ ++++
445
481
 
446
- NOTE: That formula does not do much
482
+ NOTE: That formula does not do much
447
483
 
448
- Indeed.
484
+ Indeed.
449
485
  INPUT
450
- #{BLANK_HDR}
451
- <sections><formula id="_">
452
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi></math></stem>
453
- <note id="_">
454
- <p id="_">That formula does not do much</p>
455
- </note></formula>
456
- <p id="_">Indeed.</p></sections>
457
- </standard-document>
486
+ output = <<~OUTPUT
487
+ #{BLANK_HDR}
488
+ <sections><formula id="_">
489
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi></math></stem>
490
+ <note id="_">
491
+ <p id="_">That formula does not do much</p>
492
+ </note></formula>
493
+ <p id="_">Indeed.</p></sections>
494
+ </standard-document>
458
495
  OUTPUT
496
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
497
+ .to be_equivalent_to xmlpp(output)
459
498
  end
460
499
 
461
500
  it "does not move notes inside preceding blocks, if they are marked as keep-separate" do
462
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
501
+ input = <<~INPUT
463
502
  #{ASCIIDOC_BLANK_HDR}
464
503
 
465
504
  [stem]
@@ -475,19 +514,22 @@ RSpec.describe Asciidoctor::Standoc do
475
514
 
476
515
  Indeed.
477
516
  INPUT
478
- #{BLANK_HDR}
479
- <sections><formula id="_">
480
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi></math></stem></formula>
481
- <note id="_">
482
- <p id="_">That formula does not do much</p>
483
- </note>
484
- <p id="_">Indeed.</p></sections>
485
- </standard-document>
517
+ output = <<~OUTPUT
518
+ #{BLANK_HDR}
519
+ <sections><formula id="_">
520
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi></math></stem></formula>
521
+ <note id="_">
522
+ <p id="_">That formula does not do much</p>
523
+ </note>
524
+ <p id="_">Indeed.</p></sections>
525
+ </standard-document>
486
526
  OUTPUT
527
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
528
+ .to be_equivalent_to xmlpp(output)
487
529
  end
488
530
 
489
531
  it "does not move notes inside preceding blocks, if they are at clause end" do
490
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
532
+ input = <<~INPUT
491
533
  #{ASCIIDOC_BLANK_HDR}
492
534
  [source,ruby]
493
535
  [1...x].each do |y|
@@ -496,6 +538,7 @@ RSpec.describe Asciidoctor::Standoc do
496
538
 
497
539
  NOTE: That loop does not do much
498
540
  INPUT
541
+ output = <<~OUTPUT
499
542
  #{BLANK_HDR}
500
543
  <sections><sourcecode id="_" lang="ruby">[1...x].each do |y|
501
544
  puts y
@@ -505,10 +548,12 @@ RSpec.describe Asciidoctor::Standoc do
505
548
  </note></sections>
506
549
  </standard-document>
507
550
  OUTPUT
551
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
552
+ .to be_equivalent_to xmlpp(output)
508
553
  end
509
554
 
510
555
  it "converts xrefs to references into erefs" do
511
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
556
+ input = <<~INPUT
512
557
  #{ASCIIDOC_BLANK_HDR}
513
558
  <<iso216>>
514
559
  <<iso216,droploc%capital%>>
@@ -517,6 +562,7 @@ RSpec.describe Asciidoctor::Standoc do
517
562
  == Normative References
518
563
  * [[[iso216,ISO 216:2001]]], _Reference_
519
564
  INPUT
565
+ output = <<~OUTPUT
520
566
  #{BLANK_HDR}
521
567
  <preface><foreword id="_" obligation="informative">
522
568
  <title>Foreword</title>
@@ -546,10 +592,12 @@ RSpec.describe Asciidoctor::Standoc do
546
592
  </bibliography>
547
593
  </standard-document>
548
594
  OUTPUT
595
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
596
+ .to be_equivalent_to xmlpp(output)
549
597
  end
550
598
 
551
599
  it "extracts localities from erefs" do
552
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
600
+ input = <<~INPUT
553
601
  #{ASCIIDOC_BLANK_HDR}
554
602
  <<iso216,whole,clause=3,example=9-11,locality:prelude="33 a",locality:entirety:the reference,xyz>>
555
603
  <<iso216,whole,clause=3,example=9-11,locality:prelude=33,locality:entirety="the reference";whole,clause=3,example=9-11,locality:prelude=33,locality:entirety:the reference,xyz>>
@@ -562,6 +610,7 @@ RSpec.describe Asciidoctor::Standoc do
562
610
  == Normative References
563
611
  * [[[iso216,ISO 216]]], _Reference_
564
612
  INPUT
613
+ output = <<~OUTPUT
565
614
  #{BLANK_HDR}
566
615
  <preface><foreword id="_" obligation="informative">
567
616
  <title>Foreword</title>
@@ -654,10 +703,12 @@ RSpec.describe Asciidoctor::Standoc do
654
703
  </bibliography>
655
704
  </standard-document>
656
705
  OUTPUT
706
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
707
+ .to be_equivalent_to xmlpp(output)
657
708
  end
658
709
 
659
710
  it "strips type from xrefs" do
660
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
711
+ input = <<~INPUT
661
712
  #{ASCIIDOC_BLANK_HDR}
662
713
  <<iso216>>
663
714
 
@@ -665,6 +716,7 @@ RSpec.describe Asciidoctor::Standoc do
665
716
  == Clause
666
717
  * [[[iso216,ISO 216]]], _Reference_
667
718
  INPUT
719
+ output = <<~OUTPUT
668
720
  #{BLANK_HDR}
669
721
  <preface>
670
722
  <foreword id="_" obligation="informative">
@@ -689,10 +741,12 @@ RSpec.describe Asciidoctor::Standoc do
689
741
  </references></bibliography>
690
742
  </standard-document>
691
743
  OUTPUT
744
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
745
+ .to be_equivalent_to xmlpp(output)
692
746
  end
693
747
 
694
748
  it "processes localities in term sources" do
695
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
749
+ input = <<~INPUT
696
750
  #{ASCIIDOC_BLANK_HDR}
697
751
  == Terms and Definitions
698
752
 
@@ -701,6 +755,7 @@ RSpec.describe Asciidoctor::Standoc do
701
755
  [.source]
702
756
  <<ISO2191,section=1>>
703
757
  INPUT
758
+ output = <<~OUTPUT
704
759
  #{BLANK_HDR}
705
760
  <sections>
706
761
  <terms id="_" obligation="normative">
@@ -720,29 +775,35 @@ RSpec.describe Asciidoctor::Standoc do
720
775
  </sections>
721
776
  </standard-document>
722
777
  OUTPUT
778
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
779
+ .to be_equivalent_to xmlpp(output)
723
780
  end
724
781
 
725
782
  it "inserts IDs into paragraphs" do
726
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
783
+ input = <<~INPUT
727
784
  #{ASCIIDOC_BLANK_HDR}
728
785
  Paragraph
729
786
  INPUT
787
+ output = <<~OUTPUT
730
788
  #{BLANK_HDR}
731
789
  <sections>
732
790
  <p id="_">Paragraph</p>
733
791
  </sections>
734
792
  </standard-document>
735
793
  OUTPUT
794
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
795
+ .to be_equivalent_to xmlpp(output)
736
796
  end
737
797
 
738
798
  it "inserts IDs into notes" do
739
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
799
+ input = <<~INPUT
740
800
  #{ASCIIDOC_BLANK_HDR}
741
801
  [example]
742
802
  ====
743
803
  NOTE: This note has no ID
744
804
  ====
745
805
  INPUT
806
+ output = <<~OUTPUT
746
807
  #{BLANK_HDR}
747
808
  <sections>
748
809
  <example id="_">
@@ -753,10 +814,12 @@ RSpec.describe Asciidoctor::Standoc do
753
814
  </sections>
754
815
  </standard-document>
755
816
  OUTPUT
817
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
818
+ .to be_equivalent_to xmlpp(output)
756
819
  end
757
820
 
758
821
  it "moves table key inside table" do
759
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
822
+ input = <<~INPUT
760
823
  #{ASCIIDOC_BLANK_HDR}
761
824
  |===
762
825
  |a |b |c
@@ -779,6 +842,7 @@ RSpec.describe Asciidoctor::Standoc do
779
842
 
780
843
  a:: b
781
844
  INPUT
845
+ output = <<~OUTPUT
782
846
  #{BLANK_HDR}
783
847
  <sections>
784
848
  <table id='_'>
@@ -829,10 +893,12 @@ RSpec.describe Asciidoctor::Standoc do
829
893
  </sections>
830
894
  </standard-document>
831
895
  OUTPUT
896
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
897
+ .to be_equivalent_to xmlpp(output)
832
898
  end
833
899
 
834
900
  it "processes headerrows attribute for table without header rows" do
835
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
901
+ input = <<~INPUT
836
902
  #{ASCIIDOC_BLANK_HDR}
837
903
  [headerrows=3]
838
904
  |===
@@ -842,6 +908,7 @@ RSpec.describe Asciidoctor::Standoc do
842
908
  |a |b |c
843
909
  |===
844
910
  INPUT
911
+ output = <<~OUTPUT
845
912
  #{BLANK_HDR}
846
913
  <sections>
847
914
  <table id="_"><thead><tr>
@@ -868,10 +935,12 @@ RSpec.describe Asciidoctor::Standoc do
868
935
  </sections>
869
936
  </standard-document>
870
937
  OUTPUT
938
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
939
+ .to be_equivalent_to xmlpp(output)
871
940
  end
872
941
 
873
942
  it "processes headerrows attribute for table with header rows" do
874
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
943
+ input = <<~INPUT
875
944
  #{ASCIIDOC_BLANK_HDR}
876
945
  [headerrows=3]
877
946
  |===
@@ -882,6 +951,7 @@ RSpec.describe Asciidoctor::Standoc do
882
951
  |a |b |c
883
952
  |===
884
953
  INPUT
954
+ output = <<~OUTPUT
885
955
  #{BLANK_HDR}
886
956
  <sections>
887
957
  <table id="_">
@@ -913,10 +983,12 @@ RSpec.describe Asciidoctor::Standoc do
913
983
  </sections>
914
984
  </standard-document>
915
985
  OUTPUT
986
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
987
+ .to be_equivalent_to xmlpp(output)
916
988
  end
917
989
 
918
990
  it "moves table notes inside table" do
919
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
991
+ input = <<~INPUT
920
992
  #{ASCIIDOC_BLANK_HDR}
921
993
  |===
922
994
  |a |b |c
@@ -926,6 +998,7 @@ RSpec.describe Asciidoctor::Standoc do
926
998
 
927
999
  NOTE: Note 2
928
1000
  INPUT
1001
+ output = <<~OUTPUT
929
1002
  #{BLANK_HDR}
930
1003
  <sections><table id="_">
931
1004
  <tbody>
@@ -944,10 +1017,12 @@ RSpec.describe Asciidoctor::Standoc do
944
1017
  </sections>
945
1018
  </standard-document>
946
1019
  OUTPUT
1020
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1021
+ .to be_equivalent_to xmlpp(output)
947
1022
  end
948
1023
 
949
1024
  it "moves formula key inside formula" do
950
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1025
+ input = <<~INPUT
951
1026
  #{ASCIIDOC_BLANK_HDR}
952
1027
  [stem]
953
1028
  ++++
@@ -973,6 +1048,7 @@ RSpec.describe Asciidoctor::Standoc do
973
1048
 
974
1049
  a:: b
975
1050
  INPUT
1051
+ output = <<~OUTPUT
976
1052
  #{BLANK_HDR}
977
1053
  <sections>
978
1054
  <formula id='_'>
@@ -1029,10 +1105,12 @@ RSpec.describe Asciidoctor::Standoc do
1029
1105
  </sections>
1030
1106
  </standard-document>
1031
1107
  OUTPUT
1108
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1109
+ .to be_equivalent_to xmlpp(output)
1032
1110
  end
1033
1111
 
1034
1112
  it "moves footnotes inside figures" do
1035
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1113
+ input = <<~INPUT
1036
1114
  #{ASCIIDOC_BLANK_HDR}
1037
1115
  .Figuretitle.footnote:[xyz]
1038
1116
  image::spec/examples/rice_images/rice_image1.png[]
@@ -1043,33 +1121,36 @@ RSpec.describe Asciidoctor::Standoc do
1043
1121
 
1044
1122
  A footnote:[This is a third footnote]
1045
1123
  INPUT
1046
- #{BLANK_HDR}
1047
- <sections><figure id="_">
1048
- <name>
1049
- Figuretitle.
1050
- <fn reference='1'>
1051
- <p id='_'>xyz</p>
1052
- </fn>
1053
- </name>
1054
- <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1055
- <fn reference="a">
1056
- <p id="_">This is a footnote to a figure</p>
1057
- </fn><fn reference="b">
1058
- <p id="_">This is another footnote to a figure</p>
1059
- </fn></figure>
1060
- <p id='_'>
1061
- A
1062
- <fn reference='2'>
1063
- <p id='_'>This is a third footnote</p>
1064
- </fn>
1065
- </p>
1066
- </sections>
1067
- </standard-document>
1124
+ output = <<~OUTPUT
1125
+ #{BLANK_HDR}
1126
+ <sections><figure id="_">
1127
+ <name>
1128
+ Figuretitle.
1129
+ <fn reference='1'>
1130
+ <p id='_'>xyz</p>
1131
+ </fn>
1132
+ </name>
1133
+ <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1134
+ <fn reference="a">
1135
+ <p id="_">This is a footnote to a figure</p>
1136
+ </fn><fn reference="b">
1137
+ <p id="_">This is another footnote to a figure</p>
1138
+ </fn></figure>
1139
+ <p id='_'>
1140
+ A
1141
+ <fn reference='2'>
1142
+ <p id='_'>This is a third footnote</p>
1143
+ </fn>
1144
+ </p>
1145
+ </sections>
1146
+ </standard-document>
1068
1147
  OUTPUT
1148
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1149
+ .to be_equivalent_to xmlpp(output)
1069
1150
  end
1070
1151
 
1071
1152
  it "moves figure key inside figure" do
1072
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1153
+ input = <<~INPUT
1073
1154
  #{ASCIIDOC_BLANK_HDR}
1074
1155
  image::spec/examples/rice_images/rice_image1.png[]
1075
1156
 
@@ -1086,6 +1167,7 @@ RSpec.describe Asciidoctor::Standoc do
1086
1167
 
1087
1168
  a:: b
1088
1169
  INPUT
1170
+ output = <<~OUTPUT
1089
1171
  #{BLANK_HDR}
1090
1172
  <sections>
1091
1173
  <figure id='_'>
@@ -1118,10 +1200,12 @@ RSpec.describe Asciidoctor::Standoc do
1118
1200
  </sections>
1119
1201
  </standard-document>
1120
1202
  OUTPUT
1203
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1204
+ .to be_equivalent_to xmlpp(output)
1121
1205
  end
1122
1206
 
1123
1207
  it "processes subfigures" do
1124
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1208
+ input = <<~INPUT
1125
1209
  #{ASCIIDOC_BLANK_HDR}
1126
1210
  [[figureC-2]]
1127
1211
  .Stages of gelatinization
@@ -1136,6 +1220,7 @@ RSpec.describe Asciidoctor::Standoc do
1136
1220
  image::spec/examples/rice_images/rice_image3_3.png[]
1137
1221
  ====
1138
1222
  INPUT
1223
+ output = <<~OUTPUT
1139
1224
  #{BLANK_HDR}
1140
1225
  <sections>
1141
1226
  <figure id="figureC-2"><name>Stages of gelatinization</name><figure id="_">
@@ -1153,10 +1238,12 @@ RSpec.describe Asciidoctor::Standoc do
1153
1238
  </sections>
1154
1239
  </standard-document>
1155
1240
  OUTPUT
1241
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1242
+ .to be_equivalent_to xmlpp(output)
1156
1243
  end
1157
1244
 
1158
1245
  it "numbers bibliographic notes and footnotes sequentially" do
1159
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1246
+ input = <<~INPUT
1160
1247
  #{ASCIIDOC_BLANK_HDR}
1161
1248
  footnote:[Footnote]
1162
1249
 
@@ -1168,6 +1255,7 @@ RSpec.describe Asciidoctor::Standoc do
1168
1255
  == Clause
1169
1256
  footnote:[Footnote2]
1170
1257
  INPUT
1258
+ output = <<~OUTPUT
1171
1259
  #{BLANK_HDR}
1172
1260
  <preface><foreword id="_" obligation="informative">
1173
1261
  <title>Foreword</title>
@@ -1205,10 +1293,12 @@ RSpec.describe Asciidoctor::Standoc do
1205
1293
  </bibliography>
1206
1294
  </standard-document>
1207
1295
  OUTPUT
1296
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1297
+ .to be_equivalent_to xmlpp(output)
1208
1298
  end
1209
1299
 
1210
1300
  it "rearranges term note, term example, term source" do
1211
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1301
+ input = <<~INPUT
1212
1302
  #{ASCIIDOC_BLANK_HDR}
1213
1303
 
1214
1304
  == Terms and definitions
@@ -1228,6 +1318,7 @@ RSpec.describe Asciidoctor::Standoc do
1228
1318
  [example]
1229
1319
  Example 2
1230
1320
  INPUT
1321
+ output = <<~OUTPUT
1231
1322
  #{BLANK_HDR}
1232
1323
  <sections>
1233
1324
  <terms id="_" obligation="normative">
@@ -1256,20 +1347,24 @@ RSpec.describe Asciidoctor::Standoc do
1256
1347
  </sections>
1257
1348
  </standard-document>
1258
1349
  OUTPUT
1350
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1351
+ .to be_equivalent_to xmlpp(output)
1259
1352
  end
1260
1353
 
1261
1354
  it "separates IEV citations by top-level clause" do
1262
1355
  FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1")
1263
- FileUtils.mv File.expand_path("~/.relaton/cache"), File.expand_path("~/.relaton-bib.pstore1"), force: true
1356
+ FileUtils.mv File.expand_path("~/.relaton/cache"),
1357
+ File.expand_path("~/.relaton-bib.pstore1"), force: true
1264
1358
  FileUtils.rm_rf File.expand_path("~/.iev.pstore1")
1265
- FileUtils.mv File.expand_path("~/.iev.pstore"), File.expand_path("~/.iev.pstore1"), force: true
1359
+ FileUtils.mv File.expand_path("~/.iev.pstore"),
1360
+ File.expand_path("~/.iev.pstore1"), force: true
1266
1361
  FileUtils.rm_rf "relaton/cache"
1267
1362
  FileUtils.rm_rf "test.iev.pstore"
1268
1363
  # mock_iecbib_get_iec60050_102_01
1269
1364
  # mock_iecbib_get_iec60050_103_01
1270
1365
  # mock_iev
1271
1366
  VCR.use_cassette "separates_iev_citations_by_top_level_clause" do
1272
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1367
+ input = <<~INPUT
1273
1368
  #{CACHED_ISOBIB_BLANK_HDR}
1274
1369
 
1275
1370
  [bibliography]
@@ -1292,166 +1387,174 @@ RSpec.describe Asciidoctor::Standoc do
1292
1387
  [.source]
1293
1388
  <<iev,clause="103-01-02">>
1294
1389
  INPUT
1295
- #{BLANK_HDR}
1296
- <sections>
1297
- <terms id="_" obligation="normative"><title>Terms and definitions</title>
1298
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
1299
- <term id="term-automation1">
1300
- <preferred>Automation1</preferred>
1301
- <termsource status="identical">
1302
- <origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
1303
- <localityStack>
1304
- <locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
1305
- </localityStack>
1306
- </origin>
1307
- </termsource>
1308
- </term>
1309
- <term id="term-automation2">
1310
- <preferred>Automation2</preferred>
1311
- <termsource status="identical">
1312
- <origin bibitemid="IEC60050-102" type="inline" citeas="IEC 60050-102:2007">
1313
- <localityStack>
1314
- <locality type="clause"><referenceFrom>102-01-02</referenceFrom></locality>
1315
- </localityStack>
1316
- </origin>
1317
- </termsource>
1318
- </term>
1319
- <term id="term-automation3">
1320
- <preferred>Automation3</preferred>
1321
- <termsource status="identical">
1322
- <origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
1323
- <localityStack>
1324
- <locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
1325
- </localityStack>
1326
- </origin>
1327
- </termsource>
1328
- </term></terms></sections><bibliography><references id="_" obligation="informative" normative="true">
1329
- <title>Normative references</title>
1330
- #{NORM_REF_BOILERPLATE}
1331
- <bibitem type="standard" id="IEC60050-102">
1332
- <fetched>#{Date.today}</fetched>
1333
- <title type="title-main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV)</title>
1334
- <title type="title-part" format="text/plain" language="en" script="Latn">Part 102: Mathematics — General concepts and linear algebra</title>
1335
- <title type='main' format='text/plain' language='en' script='Latn'>International Electrotechnical Vocabulary (IEV) — Part 102: Mathematics — General concepts and linear algebra</title>
1336
- <uri type="src">https://webstore.iec.ch/publication/160</uri>
1337
- <uri type="obp">/preview/info_iec60050-102%7Bed1.0%7Db.pdf</uri>
1338
- <docidentifier type="IEC">IEC 60050-102:2007</docidentifier>
1339
- <docidentifier type='URN'>urn:iec:std:iec:60050-102:2007:::en</docidentifier>
1340
- <date type="published">
1341
- <on>2007-08-27</on>
1342
- </date>
1343
- <contributor>
1344
- <role type="publisher"/>
1345
- <organization>
1346
- <name>International Electrotechnical Commission</name>
1347
- <abbreviation>IEC</abbreviation>
1348
- <uri>www.iec.ch</uri>
1349
- </organization>
1350
- </contributor>
1351
- <edition>1.0</edition>
1352
- <language>en</language>
1353
- <script>Latn</script>
1354
- <abstract format="text/plain" language="en" script="Latn">This part of IEC 60050 gives the general mathematical terminology used in the fields of electricity, electronics and telecommunications, together with basic concepts in linear algebra. It maintains a clear distinction between mathematical concepts and physical concepts, even if some terms are used in both cases. Another part will deal with functions.&#13; It has the status of a horizontal standard in accordance with IEC Guide 108.</abstract>
1355
- <status>
1356
- <stage>60</stage>
1357
- <substage>60</substage>
1358
- </status>
1359
- <copyright>
1360
- <from>2007</from>
1361
- <owner>
1362
- <organization>
1363
- <name>International Electrotechnical Commission</name>
1364
- <abbreviation>IEC</abbreviation>
1365
- <uri>www.iec.ch</uri>
1366
- </organization>
1367
- </owner>
1368
- </copyright>
1369
- <place>Geneva</place>
1370
- </bibitem><bibitem type="standard" id="IEC60050-103">
1371
- <fetched>#{Date.today}</fetched>
1372
- <title type="title-main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV)</title>
1373
- <title type="title-part" format="text/plain" language="en" script="Latn">Part 103: Mathematics — Functions</title>
1374
- <title type="main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV) — Part 103: Mathematics — Functions</title>
1375
- <uri type="src">https://webstore.iec.ch/publication/161</uri>
1376
- <uri type="obp">/preview/info_iec60050-103%7Bed1.0%7Db.pdf</uri>
1377
- <docidentifier type="IEC">IEC 60050-103:2009</docidentifier>
1378
- <docidentifier type='URN'>urn:iec:std:iec:60050-103:2009:::en</docidentifier>
1379
- <date type="published">
1380
- <on>2009-12-14</on>
1381
- </date>
1382
- <contributor>
1383
- <role type="publisher"/>
1384
- <organization>
1385
- <name>International Electrotechnical Commission</name>
1386
- <abbreviation>IEC</abbreviation>
1387
- <uri>www.iec.ch</uri>
1388
- </organization>
1389
- </contributor>
1390
- <edition>1.0</edition>
1391
- <language>en</language>
1392
- <script>Latn</script>
1393
- <abstract format="text/plain" language="en" script="Latn">IEC 60050-103:2009 gives the terminology relative to functions of one or more variables. Together with IEC 60050-102, it covers the mathematical terminology used in the fields of electricity, electronics and telecommunications. It maintains a clear distinction between mathematical concepts and physical concepts, even if some terms are used in both cases. Mathematical symbols are generally in accordance with IEC 60027-1 and ISO 80000-2. This standard cancels and replaces Sections 101-13, 101-14 and 101-15 of International Standard IEC 60050-101:1998. It has the status of a horizontal standard in accordance with IEC Guide 108.</abstract>
1394
- <status>
1395
- <stage>60</stage>
1396
- <substage>60</substage>
1397
- </status>
1398
- <copyright>
1399
- <from>2009</from>
1400
- <owner>
1401
- <organization>
1402
- <name>International Electrotechnical Commission</name>
1403
- <abbreviation>IEC</abbreviation>
1404
- <uri>www.iec.ch</uri>
1405
- </organization>
1406
- </owner>
1407
- </copyright>
1408
- <place>Geneva</place>
1409
- </bibitem>
1410
- </references></bibliography>
1411
- </standard-document>
1390
+ output = <<~OUTPUT
1391
+ #{BLANK_HDR}
1392
+ <sections>
1393
+ <terms id="_" obligation="normative"><title>Terms and definitions</title>
1394
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
1395
+ <term id="term-automation1">
1396
+ <preferred>Automation1</preferred>
1397
+ <termsource status="identical">
1398
+ <origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
1399
+ <localityStack>
1400
+ <locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
1401
+ </localityStack>
1402
+ </origin>
1403
+ </termsource>
1404
+ </term>
1405
+ <term id="term-automation2">
1406
+ <preferred>Automation2</preferred>
1407
+ <termsource status="identical">
1408
+ <origin bibitemid="IEC60050-102" type="inline" citeas="IEC 60050-102:2007">
1409
+ <localityStack>
1410
+ <locality type="clause"><referenceFrom>102-01-02</referenceFrom></locality>
1411
+ </localityStack>
1412
+ </origin>
1413
+ </termsource>
1414
+ </term>
1415
+ <term id="term-automation3">
1416
+ <preferred>Automation3</preferred>
1417
+ <termsource status="identical">
1418
+ <origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
1419
+ <localityStack>
1420
+ <locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
1421
+ </localityStack>
1422
+ </origin>
1423
+ </termsource>
1424
+ </term></terms></sections><bibliography><references id="_" obligation="informative" normative="true">
1425
+ <title>Normative references</title>
1426
+ #{NORM_REF_BOILERPLATE}
1427
+ <bibitem type="standard" id="IEC60050-102">
1428
+ <fetched>#{Date.today}</fetched>
1429
+ <title type="title-main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV)</title>
1430
+ <title type="title-part" format="text/plain" language="en" script="Latn">Part 102: Mathematics — General concepts and linear algebra</title>
1431
+ <title type='main' format='text/plain' language='en' script='Latn'>International Electrotechnical Vocabulary (IEV) — Part 102: Mathematics — General concepts and linear algebra</title>
1432
+ <uri type="src">https://webstore.iec.ch/publication/160</uri>
1433
+ <uri type="obp">/preview/info_iec60050-102%7Bed1.0%7Db.pdf</uri>
1434
+ <docidentifier type="IEC">IEC 60050-102:2007</docidentifier>
1435
+ <docidentifier type='URN'>urn:iec:std:iec:60050-102:2007:::en</docidentifier>
1436
+ <date type="published">
1437
+ <on>2007-08-27</on>
1438
+ </date>
1439
+ <contributor>
1440
+ <role type="publisher"/>
1441
+ <organization>
1442
+ <name>International Electrotechnical Commission</name>
1443
+ <abbreviation>IEC</abbreviation>
1444
+ <uri>www.iec.ch</uri>
1445
+ </organization>
1446
+ </contributor>
1447
+ <edition>1.0</edition>
1448
+ <language>en</language>
1449
+ <script>Latn</script>
1450
+ <abstract format="text/plain" language="en" script="Latn">This part of IEC 60050 gives the general mathematical terminology used in the fields of electricity, electronics and telecommunications, together with basic concepts in linear algebra. It maintains a clear distinction between mathematical concepts and physical concepts, even if some terms are used in both cases. Another part will deal with functions.&#13; It has the status of a horizontal standard in accordance with IEC Guide 108.</abstract>
1451
+ <status>
1452
+ <stage>60</stage>
1453
+ <substage>60</substage>
1454
+ </status>
1455
+ <copyright>
1456
+ <from>2007</from>
1457
+ <owner>
1458
+ <organization>
1459
+ <name>International Electrotechnical Commission</name>
1460
+ <abbreviation>IEC</abbreviation>
1461
+ <uri>www.iec.ch</uri>
1462
+ </organization>
1463
+ </owner>
1464
+ </copyright>
1465
+ <place>Geneva</place>
1466
+ </bibitem><bibitem type="standard" id="IEC60050-103">
1467
+ <fetched>#{Date.today}</fetched>
1468
+ <title type="title-main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV)</title>
1469
+ <title type="title-part" format="text/plain" language="en" script="Latn">Part 103: Mathematics — Functions</title>
1470
+ <title type="main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV) — Part 103: Mathematics — Functions</title>
1471
+ <uri type="src">https://webstore.iec.ch/publication/161</uri>
1472
+ <uri type="obp">/preview/info_iec60050-103%7Bed1.0%7Db.pdf</uri>
1473
+ <docidentifier type="IEC">IEC 60050-103:2009</docidentifier>
1474
+ <docidentifier type='URN'>urn:iec:std:iec:60050-103:2009:::en</docidentifier>
1475
+ <date type="published">
1476
+ <on>2009-12-14</on>
1477
+ </date>
1478
+ <contributor>
1479
+ <role type="publisher"/>
1480
+ <organization>
1481
+ <name>International Electrotechnical Commission</name>
1482
+ <abbreviation>IEC</abbreviation>
1483
+ <uri>www.iec.ch</uri>
1484
+ </organization>
1485
+ </contributor>
1486
+ <edition>1.0</edition>
1487
+ <language>en</language>
1488
+ <script>Latn</script>
1489
+ <abstract format="text/plain" language="en" script="Latn">IEC 60050-103:2009 gives the terminology relative to functions of one or more variables. Together with IEC 60050-102, it covers the mathematical terminology used in the fields of electricity, electronics and telecommunications. It maintains a clear distinction between mathematical concepts and physical concepts, even if some terms are used in both cases. Mathematical symbols are generally in accordance with IEC 60027-1 and ISO 80000-2. This standard cancels and replaces Sections 101-13, 101-14 and 101-15 of International Standard IEC 60050-101:1998. It has the status of a horizontal standard in accordance with IEC Guide 108.</abstract>
1490
+ <status>
1491
+ <stage>60</stage>
1492
+ <substage>60</substage>
1493
+ </status>
1494
+ <copyright>
1495
+ <from>2009</from>
1496
+ <owner>
1497
+ <organization>
1498
+ <name>International Electrotechnical Commission</name>
1499
+ <abbreviation>IEC</abbreviation>
1500
+ <uri>www.iec.ch</uri>
1501
+ </organization>
1502
+ </owner>
1503
+ </copyright>
1504
+ <place>Geneva</place>
1505
+ </bibitem>
1506
+ </references></bibliography>
1507
+ </standard-document>
1412
1508
  OUTPUT
1509
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1510
+ .to be_equivalent_to xmlpp(output)
1413
1511
  end
1414
1512
  FileUtils.rm_rf File.expand_path("~/.iev.pstore")
1415
- FileUtils.mv File.expand_path("~/.iev.pstore1"), File.expand_path("~/.iev.pstore"), force: true
1513
+ FileUtils.mv File.expand_path("~/.iev.pstore1"),
1514
+ File.expand_path("~/.iev.pstore"), force: true
1416
1515
  FileUtils.rm_rf File.expand_path("~/.relaton/cache")
1417
- FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"), File.expand_path("~/.relaton/cache"), force: true
1516
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"),
1517
+ File.expand_path("~/.relaton/cache"), force: true
1418
1518
  end
1419
1519
 
1420
1520
  it "counts footnotes with link-only content as separate footnotes" do
1421
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1422
- #{ASCIIDOC_BLANK_HDR}
1521
+ input = <<~INPUT
1522
+ #{ASCIIDOC_BLANK_HDR}
1423
1523
 
1424
- footnote:[http://www.example.com]
1524
+ footnote:[http://www.example.com]
1425
1525
 
1426
- footnote:[http://www.example.com]
1526
+ footnote:[http://www.example.com]
1427
1527
 
1428
- footnote:[http://www.example1.com]
1528
+ footnote:[http://www.example1.com]
1429
1529
  INPUT
1430
- #{BLANK_HDR}
1431
- <sections><p id="_"><fn reference="1">
1432
- <p id="_">
1433
- <link target="http://www.example.com"/>
1434
- </p>
1435
- </fn>
1436
- </p>
1437
- <p id="_"><fn reference="1">
1438
- <p id="_">
1439
- <link target="http://www.example.com"/>
1440
- </p>
1441
- </fn>
1442
- </p>
1443
- <p id="_"><fn reference="2">
1444
- <p id="_">
1445
- <link target="http://www.example1.com"/>
1446
- </p>
1447
- </fn>
1448
- </p></sections>
1449
- </standard-document>
1530
+ output = <<~OUTPUT
1531
+ #{BLANK_HDR}
1532
+ <sections><p id="_"><fn reference="1">
1533
+ <p id="_">
1534
+ <link target="http://www.example.com"/>
1535
+ </p>
1536
+ </fn>
1537
+ </p>
1538
+ <p id="_"><fn reference="1">
1539
+ <p id="_">
1540
+ <link target="http://www.example.com"/>
1541
+ </p>
1542
+ </fn>
1543
+ </p>
1544
+ <p id="_"><fn reference="2">
1545
+ <p id="_">
1546
+ <link target="http://www.example1.com"/>
1547
+ </p>
1548
+ </fn>
1549
+ </p></sections>
1550
+ </standard-document>
1450
1551
  OUTPUT
1552
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1553
+ .to be_equivalent_to xmlpp(output)
1451
1554
  end
1452
1555
 
1453
1556
  it "retains AsciiMath on request" do
1454
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1557
+ input = <<~INPUT
1455
1558
  = Document title
1456
1559
  Author
1457
1560
  :docfile: test.adoc
@@ -1462,18 +1565,21 @@ RSpec.describe Asciidoctor::Standoc do
1462
1565
 
1463
1566
  stem:[1/r]
1464
1567
  INPUT
1465
- #{BLANK_HDR}
1466
- <sections>
1467
- <p id="_">
1468
- <stem type="AsciiMath">1/r</stem>
1469
- </p>
1470
- </sections>
1471
- </standard-document>
1568
+ output = <<~OUTPUT
1569
+ #{BLANK_HDR}
1570
+ <sections>
1571
+ <p id="_">
1572
+ <stem type="AsciiMath">1/r</stem>
1573
+ </p>
1574
+ </sections>
1575
+ </standard-document>
1472
1576
  OUTPUT
1577
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1578
+ .to be_equivalent_to xmlpp(output)
1473
1579
  end
1474
1580
 
1475
1581
  it "converts AsciiMath to MathML by default" do
1476
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1582
+ input = <<~INPUT
1477
1583
  = Document title
1478
1584
  Author
1479
1585
  :docfile: test.adoc
@@ -1483,6 +1589,7 @@ RSpec.describe Asciidoctor::Standoc do
1483
1589
 
1484
1590
  stem:[1/r]
1485
1591
  INPUT
1592
+ output = <<~OUTPUT
1486
1593
  #{BLANK_HDR}
1487
1594
  <sections>
1488
1595
  <p id="_">
@@ -1498,26 +1605,63 @@ RSpec.describe Asciidoctor::Standoc do
1498
1605
  </sections>
1499
1606
  </standard-document>
1500
1607
  OUTPUT
1608
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1609
+ .to be_equivalent_to xmlpp(output)
1501
1610
  end
1502
1611
 
1503
1612
  it "cleans up text MathML" do
1504
- expect(Asciidoctor::Standoc::Converter.new(nil, backend: :standoc, header_footer: true).cleanup(Nokogiri::XML(<<~"INPUT")).to_xml).to be_equivalent_to xmlpp(<<~"OUTPUT")
1613
+ input = <<~INPUT
1505
1614
  #{BLANK_HDR}
1506
1615
  <sections>
1507
1616
  <stem type="MathML">&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;r&lt;/mi&gt;&lt;/mfrac&gt;&lt;/math&gt;</stem>
1508
1617
  </sections>
1509
1618
  </standard-document>
1510
1619
  INPUT
1511
- #{BLANK_HDR}
1512
- <sections>
1513
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mn>1</mn><mi>r</mi></mfrac></math></stem>
1514
- </sections>
1515
- </standard-document>
1620
+ output = <<~OUTPUT
1621
+ #{BLANK_HDR}
1622
+ <sections>
1623
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mn>1</mn><mi>r</mi></mfrac></math></stem>
1624
+ </sections>
1625
+ </standard-document>
1626
+ OUTPUT
1627
+ expect(Asciidoctor::Standoc::Converter.new(nil, *OPTIONS)
1628
+ .cleanup(Nokogiri::XML(input)).to_xml)
1629
+ .to be_equivalent_to xmlpp(output)
1630
+ end
1631
+
1632
+ it "removes nested bibitem IDs" do
1633
+ input = <<~INPUT
1634
+ #{BLANK_HDR}
1635
+ <bibliography>
1636
+ <references normative="true"><title>Normative</title>
1637
+ <bibitem id="A">
1638
+ <relation type="includes">
1639
+ <bibitem id="B"/>
1640
+ </relation>
1641
+ </bibitem>
1642
+ </bibliography>
1643
+ </standard-document>
1644
+ INPUT
1645
+ output = <<~OUTPUT
1646
+ #{BLANK_HDR}
1647
+ <bibliography>
1648
+ <references normative="true"><title>Normative</title>
1649
+ <bibitem id="A">
1650
+ <relation type="includes">
1651
+ <bibitem id="B"/>
1652
+ </relation>
1653
+ </bibitem>
1654
+ </references>
1655
+ </bibliography>
1656
+ </standard-document>
1516
1657
  OUTPUT
1658
+ expect(Asciidoctor::Standoc::Converter.new(nil, *OPTIONS)
1659
+ .cleanup(Nokogiri::XML(input)).to_xml)
1660
+ .to be_equivalent_to xmlpp(output)
1517
1661
  end
1518
1662
 
1519
1663
  it "renumbers numeric references in Bibliography sequentially" do
1520
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1664
+ input = <<~INPUT
1521
1665
  #{ASCIIDOC_BLANK_HDR}
1522
1666
 
1523
1667
  == Clause
@@ -1530,6 +1674,7 @@ RSpec.describe Asciidoctor::Standoc do
1530
1674
  * [[[iso124,ISO 124]]] _Standard 124_
1531
1675
  * [[[iso123,1]]] _Standard 123_
1532
1676
  INPUT
1677
+ output = <<~OUTPUT
1533
1678
  #{BLANK_HDR}
1534
1679
  <sections><clause id="_" inline-header="false" obligation="normative">
1535
1680
  <title>Clause</title>
@@ -1558,10 +1703,12 @@ RSpec.describe Asciidoctor::Standoc do
1558
1703
  </references></bibliography>
1559
1704
  </standard-document>
1560
1705
  OUTPUT
1706
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1707
+ .to be_equivalent_to xmlpp(output)
1561
1708
  end
1562
1709
 
1563
1710
  it "renumbers numeric references in Bibliography subclauses sequentially" do
1564
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1711
+ input = <<~INPUT
1565
1712
  #{ASCIIDOC_BLANK_HDR}
1566
1713
 
1567
1714
  == Clause
@@ -1592,6 +1739,7 @@ RSpec.describe Asciidoctor::Standoc do
1592
1739
  * [[[iso128,1]]] _Standard 123_
1593
1740
 
1594
1741
  INPUT
1742
+ output = <<~OUTPUT
1595
1743
  #{BLANK_HDR}
1596
1744
  <sections><clause id="_" inline-header="false" obligation="normative">
1597
1745
  <title>Clause</title>
@@ -1664,10 +1812,12 @@ RSpec.describe Asciidoctor::Standoc do
1664
1812
  </references></clause></bibliography>
1665
1813
  </standard-document>
1666
1814
  OUTPUT
1815
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1816
+ .to be_equivalent_to xmlpp(output)
1667
1817
  end
1668
1818
 
1669
1819
  it "removes bibdata bibitem IDs" do
1670
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1820
+ input = <<~INPUT
1671
1821
  = Document title
1672
1822
  Author
1673
1823
  :docfile: test.adoc
@@ -1680,6 +1830,7 @@ RSpec.describe Asciidoctor::Standoc do
1680
1830
  == Normative References
1681
1831
 
1682
1832
  INPUT
1833
+ output = <<~OUTPUT
1683
1834
  <?xml version='1.0' encoding='UTF-8'?>
1684
1835
  <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1685
1836
  <bibdata type='standard'>
@@ -1711,10 +1862,12 @@ RSpec.describe Asciidoctor::Standoc do
1711
1862
  </bibliography>
1712
1863
  </standard-document>
1713
1864
  OUTPUT
1865
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1866
+ .to be_equivalent_to xmlpp(output)
1714
1867
  end
1715
1868
 
1716
1869
  it "imports boilerplate file" do
1717
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1870
+ input = <<~INPUT
1718
1871
  = Document title
1719
1872
  Author
1720
1873
  :docfile: test.adoc
@@ -1727,6 +1880,7 @@ RSpec.describe Asciidoctor::Standoc do
1727
1880
  == Clause 1
1728
1881
 
1729
1882
  INPUT
1883
+ output = <<~OUTPUT
1730
1884
  <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1731
1885
  <bibdata type='standard'>
1732
1886
  <title language='en' format='text/plain'>Document title</title>
@@ -1752,23 +1906,26 @@ RSpec.describe Asciidoctor::Standoc do
1752
1906
  </sections>
1753
1907
  </standard-document>
1754
1908
  OUTPUT
1909
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1910
+ .to be_equivalent_to xmlpp(output)
1755
1911
  end
1756
1912
 
1757
- it "sorts symbols lists" do
1758
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1759
- #{ASCIIDOC_BLANK_HDR}
1913
+ it "sorts symbols lists #1" do
1914
+ input = <<~INPUT
1915
+ #{ASCIIDOC_BLANK_HDR}
1760
1916
 
1761
- [[L]]
1762
- == Symbols and abbreviated terms
1917
+ [[L]]
1918
+ == Symbols and abbreviated terms
1763
1919
 
1764
- α:: Definition 1
1765
- Xa:: Definition 2
1766
- x_1_:: Definition 3
1767
- x_m_:: Definition 4
1768
- x:: Definition 5
1769
- stem:[n]:: Definition 6
1770
- m:: Definition 7
1920
+ α:: Definition 1
1921
+ Xa:: Definition 2
1922
+ x_1_:: Definition 3
1923
+ x_m_:: Definition 4
1924
+ x:: Definition 5
1925
+ stem:[n]:: Definition 6
1926
+ m:: Definition 7
1771
1927
  INPUT
1928
+ output = <<~OUTPUT
1772
1929
  #{BLANK_HDR}
1773
1930
  <sections>
1774
1931
  <definitions id='L' obligation="normative">
@@ -1813,21 +1970,24 @@ RSpec.describe Asciidoctor::Standoc do
1813
1970
  </sections>
1814
1971
  </standard-document>
1815
1972
  OUTPUT
1973
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1974
+ .to be_equivalent_to xmlpp(output)
1816
1975
  end
1817
1976
 
1818
- it "sorts symbols lists" do
1819
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1820
- #{ASCIIDOC_BLANK_HDR}
1977
+ it "sorts symbols lists #2" do
1978
+ input = <<~INPUT
1979
+ #{ASCIIDOC_BLANK_HDR}
1821
1980
 
1822
- [[L]]
1823
- == Symbols and abbreviated terms
1981
+ [[L]]
1982
+ == Symbols and abbreviated terms
1824
1983
 
1825
- stem:[alpha]:: Definition 1
1826
- xa:: Definition 2
1827
- stem:[x_1]:: Definition 3
1828
- stem:[x_m]:: Definition 4
1829
- x:: Definition 5
1984
+ stem:[alpha]:: Definition 1
1985
+ xa:: Definition 2
1986
+ stem:[x_1]:: Definition 3
1987
+ stem:[x_m]:: Definition 4
1988
+ x:: Definition 5
1830
1989
  INPUT
1990
+ output = <<~OUTPUT
1831
1991
  #{BLANK_HDR}
1832
1992
  <sections>
1833
1993
  <definitions id='L' obligation="normative">
@@ -1886,10 +2046,12 @@ RSpec.describe Asciidoctor::Standoc do
1886
2046
  </sections>
1887
2047
  </standard-document>
1888
2048
  OUTPUT
2049
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2050
+ .to be_equivalent_to xmlpp(output)
1889
2051
  end
1890
2052
 
1891
2053
  it "moves inherit macros to correct location" do
1892
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2054
+ input = <<~INPUT
1893
2055
  #{ASCIIDOC_BLANK_HDR}
1894
2056
 
1895
2057
  == Clause
@@ -1924,6 +2086,7 @@ RSpec.describe Asciidoctor::Standoc do
1924
2086
 
1925
2087
 
1926
2088
  INPUT
2089
+ output = <<~OUTPUT
1927
2090
  #{BLANK_HDR}
1928
2091
  <sections>
1929
2092
  <clause id='_' inline-header='false' obligation='normative'>
@@ -1966,74 +2129,79 @@ RSpec.describe Asciidoctor::Standoc do
1966
2129
  </sections>
1967
2130
  </standard-document>
1968
2131
  OUTPUT
2132
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2133
+ .to be_equivalent_to xmlpp(output)
1969
2134
  end
1970
2135
 
1971
2136
  it "moves %beforeclause admonitions to right position" do
1972
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1973
- #{ASCIIDOC_BLANK_HDR}
2137
+ input = <<~INPUT
2138
+ #{ASCIIDOC_BLANK_HDR}
1974
2139
 
1975
- .Foreword
1976
- Foreword
2140
+ .Foreword
2141
+ Foreword
1977
2142
 
1978
- [NOTE,beforeclauses=true]
1979
- ====
1980
- Note which is very important
1981
- ====
2143
+ [NOTE,beforeclauses=true]
2144
+ ====
2145
+ Note which is very important
2146
+ ====
1982
2147
 
1983
- == Introduction
1984
- Introduction
2148
+ == Introduction
2149
+ Introduction
1985
2150
 
1986
- == Scope
1987
- Scope statement
2151
+ == Scope
2152
+ Scope statement
1988
2153
 
1989
- [IMPORTANT,beforeclauses=true]
1990
- ====
1991
- Notice which is very important
1992
- ====
2154
+ [IMPORTANT,beforeclauses=true]
2155
+ ====
2156
+ Notice which is very important
2157
+ ====
1993
2158
  INPUT
1994
- #{BLANK_HDR}
1995
- <preface>
1996
- <note id='_'>
1997
- <p id='_'>Note which is very important</p>
1998
- </note>
1999
- <foreword id='_' obligation='informative'>
2000
- <title>Foreword</title>
2001
- <p id='_'>Foreword</p>
2002
- </foreword>
2003
- <introduction id='_' obligation='informative'>
2004
- <title>Introduction</title>
2005
- <p id='_'>Introduction</p>
2006
- </introduction>
2007
- </preface>
2008
- <sections>
2009
- <admonition id='_' type='important'>
2010
- <p id='_'>Notice which is very important</p>
2011
- </admonition>
2012
- <clause id='_' inline-header='false' obligation='normative' type="scope">
2013
- <title>Scope</title>
2014
- <p id='_'>Scope statement</p>
2015
- </clause>
2016
- </sections>
2017
- </standard-document>
2159
+ output = <<~OUTPUT
2160
+ #{BLANK_HDR}
2161
+ <preface>
2162
+ <note id='_'>
2163
+ <p id='_'>Note which is very important</p>
2164
+ </note>
2165
+ <foreword id='_' obligation='informative'>
2166
+ <title>Foreword</title>
2167
+ <p id='_'>Foreword</p>
2168
+ </foreword>
2169
+ <introduction id='_' obligation='informative'>
2170
+ <title>Introduction</title>
2171
+ <p id='_'>Introduction</p>
2172
+ </introduction>
2173
+ </preface>
2174
+ <sections>
2175
+ <admonition id='_' type='important'>
2176
+ <p id='_'>Notice which is very important</p>
2177
+ </admonition>
2178
+ <clause id='_' inline-header='false' obligation='normative' type="scope">
2179
+ <title>Scope</title>
2180
+ <p id='_'>Scope statement</p>
2181
+ </clause>
2182
+ </sections>
2183
+ </standard-document>
2018
2184
  OUTPUT
2185
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2186
+ .to be_equivalent_to xmlpp(output)
2019
2187
  end
2020
2188
 
2021
2189
  it "fixes illegal anchors" do
2022
2190
  input = <<~INPUT
2023
- #{ASCIIDOC_BLANK_HDR}
2024
-
2025
- [[a:b]]
2026
- == A
2027
- <</:ab>>
2028
- <<:>>
2029
- <<1>>
2030
- <<1:>>
2031
- <<1#b>>
2032
- <<:a#b:>>
2033
- <</%ab>>
2034
- <<1!>>
2191
+ #{ASCIIDOC_BLANK_HDR}
2192
+
2193
+ [[a:b]]
2194
+ == A
2195
+ <</:ab>>
2196
+ <<:>>
2197
+ <<1>>
2198
+ <<1:>>
2199
+ <<1#b>>
2200
+ <<:a#b:>>
2201
+ <</%ab>>
2202
+ <<1!>>
2035
2203
  INPUT
2036
- expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true).gsub(/<p id="_[^"]+">/, "").gsub("</p>", ""))).to be_equivalent_to (<<~"OUTPUT")
2204
+ output = <<~OUTPUT
2037
2205
  <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
2038
2206
  <bibdata type='standard'>
2039
2207
  <title language='en' format='text/plain'>Document title</title>
@@ -2071,25 +2239,40 @@ RSpec.describe Asciidoctor::Standoc do
2071
2239
  </bibliography>
2072
2240
  </standard-document>
2073
2241
  OUTPUT
2074
- expect { Asciidoctor.convert(input, backend: :standoc, header_footer: true) }.to output(%r{normalised identifier in <clause id="a_b" inline-header="false" obligation="normative"/> from a:b}).to_stderr
2075
- expect { Asciidoctor.convert(input, backend: :standoc, header_footer: true) }.to output(%r{normalised identifier in <eref bibitemid="__ab" citeas=""/> from /_ab}).to_stderr
2076
- expect { Asciidoctor.convert(input, backend: :standoc, header_footer: true) }.to output(%r{normalised identifier in <xref target="_"/> from :}).to_stderr
2077
- expect { Asciidoctor.convert(input, backend: :standoc, header_footer: true) }.to output(%r{normalised identifier in <xref target="_1"/> from 1}).to_stderr
2078
- expect { Asciidoctor.convert(input, backend: :standoc, header_footer: true) }.to output(%r{normalised identifier in <xref target="_1_"/> from 1:}).to_stderr
2079
- expect { Asciidoctor.convert(input, backend: :standoc, header_footer: true) }.to output(%r{normalised identifier in <xref target="_a#b_"/> from :a#b:}).to_stderr
2242
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)
2243
+ .gsub(/<p id="_[^"]+">/, "").gsub("</p>", "")))
2244
+ .to be_equivalent_to(output)
2245
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2246
+ .to output(%r{normalised identifier in <clause id="a_b" inline-header="false" obligation="normative"/> from a:b})
2247
+ .to_stderr
2248
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2249
+ .to output(%r{normalised identifier in <eref bibitemid="__ab" citeas=""/> from /_ab})
2250
+ .to_stderr
2251
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2252
+ .to output(%r{normalised identifier in <xref target="_"/> from :})
2253
+ .to_stderr
2254
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2255
+ .to output(%r{normalised identifier in <xref target="_1"/> from 1})
2256
+ .to_stderr
2257
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2258
+ .to output(%r{normalised identifier in <xref target="_1_"/> from 1:})
2259
+ .to_stderr
2260
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2261
+ .to output(%r{normalised identifier in <xref target="_a#b_"/> from :a#b:})
2262
+ .to_stderr
2080
2263
  end
2081
2264
 
2082
2265
  it "moves title footnotes to bibdata" do
2083
2266
  input = <<~INPUT
2084
- = Document title footnote:[ABC] footnote:[DEF]
2085
- Author
2086
- :docfile: test.adoc
2087
- :nodoc:
2088
- :novalid:
2089
- :no-isobib:
2267
+ = Document title footnote:[ABC] footnote:[DEF]
2268
+ Author
2269
+ :docfile: test.adoc
2270
+ :nodoc:
2271
+ :novalid:
2272
+ :no-isobib:
2090
2273
 
2091
2274
  INPUT
2092
- expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2275
+ output = <<~OUTPUT
2093
2276
  <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
2094
2277
  <bibdata type='standard'>
2095
2278
  <title language='en' format='text/plain'>Document title</title>
@@ -2114,289 +2297,304 @@ RSpec.describe Asciidoctor::Standoc do
2114
2297
  <sections> </sections>
2115
2298
  </standard-document>
2116
2299
  OUTPUT
2300
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
2301
+ .to be_equivalent_to xmlpp(output)
2117
2302
  end
2118
2303
 
2119
2304
  it "converts UnitsML to MathML" do
2120
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~INPUT, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2121
- = Document title
2122
- Author
2123
- :stem:
2124
-
2125
- [stem]
2126
- ++++
2127
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2128
- <mrow>
2129
- <mn>7</mn>
2130
- <mtext>unitsml(m*kg^-2)</mtext>
2131
- <mo>+</mo>
2132
- <mn>8</mn>
2133
- <mtext>unitsml(m*kg^-2)</mtext>
2134
- </mrow>
2135
- </math>
2136
- ++++
2305
+ input = <<~INPUT
2306
+ = Document title
2307
+ Author
2308
+ :stem:
2309
+
2310
+ [stem]
2311
+ ++++
2312
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2313
+ <mrow>
2314
+ <mn>7</mn>
2315
+ <mtext>unitsml(m*kg^-2)</mtext>
2316
+ <mo>+</mo>
2317
+ <mn>8</mn>
2318
+ <mtext>unitsml(m*kg^-2)</mtext>
2319
+ </mrow>
2320
+ </math>
2321
+ ++++
2137
2322
  INPUT
2323
+ output = <<~OUTPUT
2138
2324
  #{BLANK_HDR}
2139
2325
  <misc-container>
2140
- <UnitsML xmlns='https://schema.unitsml.org/unitsml/1.0'>
2141
- <UnitSet>
2142
- <Unit xml:id='U_m.kg-2' dimensionURL='#D_LM-2'>
2143
- <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
2144
- <UnitName xml:lang='en'>m*kg^-2</UnitName>
2145
- <UnitSymbol type='HTML'>
2146
- m&#160;kg
2147
- <sup>&#8722;2</sup>
2148
- </UnitSymbol>
2149
- <UnitSymbol type='MathML'>
2150
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2151
- <mrow>
2152
- <mi mathvariant='normal'>m</mi>
2153
- <mo rspace='thickmathspace'>&#8290;</mo>
2154
- <msup>
2155
- <mrow>
2156
- <mi mathvariant='normal'>kg</mi>
2157
- </mrow>
2158
- <mrow>
2159
- <mo>&#8722;</mo>
2160
- <mn>2</mn>
2161
- </mrow>
2162
- </msup>
2163
- </mrow>
2164
- </math>
2165
- </UnitSymbol>
2166
- <RootUnits>
2167
- <EnumeratedRootUnit unit='meter'/>
2168
- <EnumeratedRootUnit unit='gram' prefix='k' powerNumerator='-2'/>
2169
- </RootUnits>
2170
- </Unit>
2171
- </UnitSet>
2172
- <DimensionSet>
2173
- <Dimension xml:id='D_LM-2'>
2174
- <Length symbol='L' powerNumerator='1'/>
2175
- <Mass symbol='M' powerNumerator='-2'/>
2176
- </Dimension>
2177
- </DimensionSet>
2178
- <PrefixSet>
2179
- <Prefix prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
2180
- <PrefixName xml:lang='en'>kilo</PrefixName>
2181
- <PrefixSymbol type='ASCII'>k</PrefixSymbol>
2182
- <PrefixSymbol type='unicode'>k</PrefixSymbol>
2183
- <PrefixSymbol type='LaTeX'>k</PrefixSymbol>
2184
- <PrefixSymbol type='HTML'>k</PrefixSymbol>
2185
- </Prefix>
2186
- </PrefixSet>
2187
- </UnitsML>
2188
- </misc-container>
2189
- <sections>
2190
- <formula id='_'>
2191
- <stem type='MathML'>
2192
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2193
- <mrow>
2194
- <mn>7</mn>
2195
- <mo rspace='thickmathspace'>&#8290;</mo>
2196
- <mrow xref='U_m.kg-2'>
2197
- <mi mathvariant='normal'>m</mi>
2198
- <mo rspace='thickmathspace'>&#8290;</mo>
2199
- <msup>
2200
- <mrow>
2201
- <mi mathvariant='normal'>kg</mi>
2202
- </mrow>
2203
- <mrow>
2204
- <mo>&#8722;</mo>
2205
- <mn>2</mn>
2206
- </mrow>
2207
- </msup>
2326
+ <UnitsML xmlns='https://schema.unitsml.org/unitsml/1.0'>
2327
+ <UnitSet>
2328
+ <Unit xml:id='U_m.kg-2' dimensionURL='#D_LM-2'>
2329
+ <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
2330
+ <UnitName xml:lang='en'>m*kg^-2</UnitName>
2331
+ <UnitSymbol type='HTML'>
2332
+ m&#160;kg
2333
+ <sup>&#8722;2</sup>
2334
+ </UnitSymbol>
2335
+ <UnitSymbol type='MathML'>
2336
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2337
+ <mrow>
2338
+ <mi mathvariant='normal'>m</mi>
2339
+ <mo rspace='thickmathspace'>&#8290;</mo>
2340
+ <msup>
2341
+ <mrow>
2342
+ <mi mathvariant='normal'>kg</mi>
2208
2343
  </mrow>
2209
- <mo>+</mo>
2210
- <mn>8</mn>
2211
- <mo rspace='thickmathspace'>&#8290;</mo>
2212
- <mrow xref='U_m.kg-2'>
2213
- <mi mathvariant='normal'>m</mi>
2214
- <mo rspace='thickmathspace'>&#8290;</mo>
2215
- <msup>
2216
- <mrow>
2217
- <mi mathvariant='normal'>kg</mi>
2218
- </mrow>
2219
- <mrow>
2220
- <mo>&#8722;</mo>
2221
- <mn>2</mn>
2222
- </mrow>
2223
- </msup>
2344
+ <mrow>
2345
+ <mo>&#8722;</mo>
2346
+ <mn>2</mn>
2224
2347
  </mrow>
2348
+ </msup>
2349
+ </mrow>
2350
+ </math>
2351
+ </UnitSymbol>
2352
+ <RootUnits>
2353
+ <EnumeratedRootUnit unit='meter'/>
2354
+ <EnumeratedRootUnit unit='gram' prefix='k' powerNumerator='-2'/>
2355
+ </RootUnits>
2356
+ </Unit>
2357
+ </UnitSet>
2358
+ <DimensionSet>
2359
+ <Dimension xml:id='D_LM-2'>
2360
+ <Length symbol='L' powerNumerator='1'/>
2361
+ <Mass symbol='M' powerNumerator='-2'/>
2362
+ </Dimension>
2363
+ </DimensionSet>
2364
+ <PrefixSet>
2365
+ <Prefix prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
2366
+ <PrefixName xml:lang='en'>kilo</PrefixName>
2367
+ <PrefixSymbol type='ASCII'>k</PrefixSymbol>
2368
+ <PrefixSymbol type='unicode'>k</PrefixSymbol>
2369
+ <PrefixSymbol type='LaTeX'>k</PrefixSymbol>
2370
+ <PrefixSymbol type='HTML'>k</PrefixSymbol>
2371
+ </Prefix>
2372
+ </PrefixSet>
2373
+ </UnitsML>
2374
+ </misc-container>
2375
+ <sections>
2376
+ <formula id='_'>
2377
+ <stem type='MathML'>
2378
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2379
+ <mrow>
2380
+ <mn>7</mn>
2381
+ <mo rspace='thickmathspace'>&#8290;</mo>
2382
+ <mrow xref='U_m.kg-2'>
2383
+ <mi mathvariant='normal'>m</mi>
2384
+ <mo rspace='thickmathspace'>&#8290;</mo>
2385
+ <msup>
2386
+ <mrow>
2387
+ <mi mathvariant='normal'>kg</mi>
2225
2388
  </mrow>
2226
- </math>
2227
- </stem>
2228
- </formula>
2229
- </sections>
2230
- </standard-document>
2389
+ <mrow>
2390
+ <mo>&#8722;</mo>
2391
+ <mn>2</mn>
2392
+ </mrow>
2393
+ </msup>
2394
+ </mrow>
2395
+ <mo>+</mo>
2396
+ <mn>8</mn>
2397
+ <mo rspace='thickmathspace'>&#8290;</mo>
2398
+ <mrow xref='U_m.kg-2'>
2399
+ <mi mathvariant='normal'>m</mi>
2400
+ <mo rspace='thickmathspace'>&#8290;</mo>
2401
+ <msup>
2402
+ <mrow>
2403
+ <mi mathvariant='normal'>kg</mi>
2404
+ </mrow>
2405
+ <mrow>
2406
+ <mo>&#8722;</mo>
2407
+ <mn>2</mn>
2408
+ </mrow>
2409
+ </msup>
2410
+ </mrow>
2411
+ </mrow>
2412
+ </math>
2413
+ </stem>
2414
+ </formula>
2415
+ </sections>
2416
+ </standard-document>
2231
2417
  OUTPUT
2418
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2419
+ .to be_equivalent_to xmlpp(output)
2232
2420
  end
2233
2421
 
2234
2422
  it "customises italicisation of MathML" do
2235
2423
  input = <<~INPUT
2236
- = Document title
2237
- Author
2238
- :stem:
2239
-
2240
- [stem]
2241
- ++++
2242
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2243
- <mi>A</mi>
2244
- <mo>+</mo>
2245
- <mi>a</mi>
2246
- <mo>+</mo>
2247
- <mi>Α</mi>
2248
- <mo>+</mo>
2249
- <mi>α</mi>
2250
- <mo>+</mo>
2251
- <mi>AB</mi>
2252
- <mstyle mathvariant="italic">
2253
- <mrow>
2254
- <mi>Α</mi>
2255
- </mrow>
2256
- </mstyle>
2257
- </math>
2258
- ++++
2259
- INPUT
2424
+ = Document title
2425
+ Author
2426
+ :stem:
2260
2427
 
2261
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2262
- #{BLANK_HDR}
2263
- <sections>
2264
- <formula id='_'>
2265
- <stem type='MathML'>
2266
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2267
- <mi>A</mi>
2268
- <mo>+</mo>
2269
- <mi>a</mi>
2270
- <mo>+</mo>
2271
- <mi>Α</mi>
2272
- <mo>+</mo>
2273
- <mi>α</mi>
2274
- <mo>+</mo>
2275
- <mi>AB</mi>
2276
- <mstyle mathvariant='italic'>
2277
- <mrow>
2278
- <mi>Α</mi>
2279
- </mrow>
2280
- </mstyle>
2281
- </math>
2282
- </stem>
2283
- </formula>
2284
- </sections>
2285
- </standard-document>
2286
- OUTPUT
2287
- mock_mathml_italicise({ uppergreek: false, upperroman: true, lowergreek: true, lowerroman: true })
2288
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2289
- #{BLANK_HDR}
2290
- <sections>
2291
- <formula id='_'>
2292
- <stem type='MathML'>
2293
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2294
- <mi>A</mi>
2295
- <mo>+</mo>
2296
- <mi>a</mi>
2297
- <mo>+</mo>
2298
- <mi mathvariant="normal">Α</mi>
2299
- <mo>+</mo>
2300
- <mi>α</mi>
2301
- <mo>+</mo>
2302
- <mi>AB</mi>
2303
- <mstyle mathvariant='italic'>
2304
- <mrow>
2305
- <mi>Α</mi>
2306
- </mrow>
2307
- </mstyle>
2308
- </math>
2309
- </stem>
2310
- </formula>
2311
- </sections>
2312
- </standard-document>
2313
- OUTPUT
2314
- mock_mathml_italicise({ uppergreek: true, upperroman: false, lowergreek: true, lowerroman: true })
2315
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2316
- #{BLANK_HDR}
2317
- <sections>
2318
- <formula id='_'>
2319
- <stem type='MathML'>
2320
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2321
- <mi mathvariant="normal">A</mi>
2322
- <mo>+</mo>
2323
- <mi>a</mi>
2324
- <mo>+</mo>
2325
- <mi>Α</mi>
2326
- <mo>+</mo>
2327
- <mi>α</mi>
2328
- <mo>+</mo>
2329
- <mi>AB</mi>
2330
- <mstyle mathvariant='italic'>
2331
- <mrow>
2332
- <mi>Α</mi>
2333
- </mrow>
2334
- </mstyle>
2335
- </math>
2336
- </stem>
2337
- </formula>
2338
- </sections>
2339
- </standard-document>
2340
- OUTPUT
2341
- mock_mathml_italicise({ uppergreek: true, upperroman: true, lowergreek: false, lowerroman: true })
2342
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2343
- #{BLANK_HDR}
2344
- <sections>
2345
- <formula id='_'>
2346
- <stem type='MathML'>
2347
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2348
- <mi>A</mi>
2349
- <mo>+</mo>
2350
- <mi>a</mi>
2351
- <mo>+</mo>
2352
- <mi>Α</mi>
2353
- <mo>+</mo>
2354
- <mi mathvariant="normal">α</mi>
2355
- <mo>+</mo>
2356
- <mi>AB</mi>
2357
- <mstyle mathvariant='italic'>
2358
- <mrow>
2359
- <mi>Α</mi>
2360
- </mrow>
2361
- </mstyle>
2362
- </math>
2363
- </stem>
2364
- </formula>
2365
- </sections>
2366
- </standard-document>
2367
- OUTPUT
2368
- mock_mathml_italicise({ uppergreek: true, upperroman: true, lowergreek: true, lowerroman: false })
2369
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2370
- #{BLANK_HDR}
2371
- <sections>
2372
- <formula id='_'>
2373
- <stem type='MathML'>
2374
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2375
- <mi>A</mi>
2376
- <mo>+</mo>
2377
- <mi mathvariant="normal">a</mi>
2378
- <mo>+</mo>
2379
- <mi>Α</mi>
2380
- <mo>+</mo>
2381
- <mi>α</mi>
2382
- <mo>+</mo>
2383
- <mi>AB</mi>
2384
- <mstyle mathvariant='italic'>
2428
+ [stem]
2429
+ ++++
2430
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2431
+ <mi>A</mi>
2432
+ <mo>+</mo>
2433
+ <mi>a</mi>
2434
+ <mo>+</mo>
2435
+ <mi>Α</mi>
2436
+ <mo>+</mo>
2437
+ <mi>α</mi>
2438
+ <mo>+</mo>
2439
+ <mi>AB</mi>
2440
+ <mstyle mathvariant="italic">
2385
2441
  <mrow>
2386
- <mi>Α</mi>
2442
+ <mi>Α</mi>
2387
2443
  </mrow>
2388
- </mstyle>
2389
- </math>
2390
- </stem>
2391
- </formula>
2392
- </sections>
2393
- </standard-document>
2394
- OUTPUT
2395
- mock_mathml_italicise({ uppergreek: true, upperroman: true, lowergreek: true, lowerroman: true })
2444
+ </mstyle>
2445
+ </math>
2446
+ ++++
2447
+ INPUT
2448
+
2449
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2450
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2451
+ #{BLANK_HDR}
2452
+ <sections>
2453
+ <formula id='_'>
2454
+ <stem type='MathML'>
2455
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2456
+ <mi>A</mi>
2457
+ <mo>+</mo>
2458
+ <mi>a</mi>
2459
+ <mo>+</mo>
2460
+ <mi>Α</mi>
2461
+ <mo>+</mo>
2462
+ <mi>α</mi>
2463
+ <mo>+</mo>
2464
+ <mi>AB</mi>
2465
+ <mstyle mathvariant='italic'>
2466
+ <mrow>
2467
+ <mi>Α</mi>
2468
+ </mrow>
2469
+ </mstyle>
2470
+ </math>
2471
+ </stem>
2472
+ </formula>
2473
+ </sections>
2474
+ </standard-document>
2475
+ OUTPUT
2476
+ mock_mathml_italicise({ uppergreek: false, upperroman: true,
2477
+ lowergreek: true, lowerroman: true })
2478
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2479
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2480
+ #{BLANK_HDR}
2481
+ <sections>
2482
+ <formula id='_'>
2483
+ <stem type='MathML'>
2484
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2485
+ <mi>A</mi>
2486
+ <mo>+</mo>
2487
+ <mi>a</mi>
2488
+ <mo>+</mo>
2489
+ <mi mathvariant="normal">Α</mi>
2490
+ <mo>+</mo>
2491
+ <mi>α</mi>
2492
+ <mo>+</mo>
2493
+ <mi>AB</mi>
2494
+ <mstyle mathvariant='italic'>
2495
+ <mrow>
2496
+ <mi>Α</mi>
2497
+ </mrow>
2498
+ </mstyle>
2499
+ </math>
2500
+ </stem>
2501
+ </formula>
2502
+ </sections>
2503
+ </standard-document>
2504
+ OUTPUT
2505
+ mock_mathml_italicise({ uppergreek: true, upperroman: false,
2506
+ lowergreek: true, lowerroman: true })
2507
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2508
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2509
+ #{BLANK_HDR}
2510
+ <sections>
2511
+ <formula id='_'>
2512
+ <stem type='MathML'>
2513
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2514
+ <mi mathvariant="normal">A</mi>
2515
+ <mo>+</mo>
2516
+ <mi>a</mi>
2517
+ <mo>+</mo>
2518
+ <mi>Α</mi>
2519
+ <mo>+</mo>
2520
+ <mi>α</mi>
2521
+ <mo>+</mo>
2522
+ <mi>AB</mi>
2523
+ <mstyle mathvariant='italic'>
2524
+ <mrow>
2525
+ <mi>Α</mi>
2526
+ </mrow>
2527
+ </mstyle>
2528
+ </math>
2529
+ </stem>
2530
+ </formula>
2531
+ </sections>
2532
+ </standard-document>
2533
+ OUTPUT
2534
+ mock_mathml_italicise({ uppergreek: true, upperroman: true,
2535
+ lowergreek: false, lowerroman: true })
2536
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2537
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2538
+ #{BLANK_HDR}
2539
+ <sections>
2540
+ <formula id='_'>
2541
+ <stem type='MathML'>
2542
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2543
+ <mi>A</mi>
2544
+ <mo>+</mo>
2545
+ <mi>a</mi>
2546
+ <mo>+</mo>
2547
+ <mi>Α</mi>
2548
+ <mo>+</mo>
2549
+ <mi mathvariant="normal">α</mi>
2550
+ <mo>+</mo>
2551
+ <mi>AB</mi>
2552
+ <mstyle mathvariant='italic'>
2553
+ <mrow>
2554
+ <mi>Α</mi>
2555
+ </mrow>
2556
+ </mstyle>
2557
+ </math>
2558
+ </stem>
2559
+ </formula>
2560
+ </sections>
2561
+ </standard-document>
2562
+ OUTPUT
2563
+ mock_mathml_italicise({ uppergreek: true, upperroman: true,
2564
+ lowergreek: true, lowerroman: false })
2565
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2566
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2567
+ #{BLANK_HDR}
2568
+ <sections>
2569
+ <formula id='_'>
2570
+ <stem type='MathML'>
2571
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2572
+ <mi>A</mi>
2573
+ <mo>+</mo>
2574
+ <mi mathvariant="normal">a</mi>
2575
+ <mo>+</mo>
2576
+ <mi>Α</mi>
2577
+ <mo>+</mo>
2578
+ <mi>α</mi>
2579
+ <mo>+</mo>
2580
+ <mi>AB</mi>
2581
+ <mstyle mathvariant='italic'>
2582
+ <mrow>
2583
+ <mi>Α</mi>
2584
+ </mrow>
2585
+ </mstyle>
2586
+ </math>
2587
+ </stem>
2588
+ </formula>
2589
+ </sections>
2590
+ </standard-document>
2591
+ OUTPUT
2592
+ mock_mathml_italicise({ uppergreek: true, upperroman: true,
2593
+ lowergreek: true, lowerroman: true })
2396
2594
  end
2397
2595
 
2398
2596
  it "process express_ref macro with existing bibliography" do
2399
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2597
+ input = <<~INPUT
2400
2598
  #{ASCIIDOC_BLANK_HDR}
2401
2599
  == Clause
2402
2600
 
@@ -2416,49 +2614,52 @@ RSpec.describe Asciidoctor::Standoc do
2416
2614
  == Bibliography
2417
2615
  * [[[D,E]]] F
2418
2616
  INPUT
2419
- #{BLANK_HDR}
2420
- <sections>
2421
- <clause id='_' inline-header='false' obligation='normative'>
2422
- <title>Clause</title>
2423
- <p id='_'>
2424
- <eref bibitemid='uml_A' citeas="">
2425
- <localityStack>
2426
- <locality type='anchor'><referenceFrom>A.B.C</referenceFrom></locality>
2427
- </localityStack>
2428
- C
2429
- </eref>
2430
- <eref bibitemid='uml_A' citeas=""/>
2431
- <xref target='action.AA'>AA</xref>
2432
- <xref target='action'>** Missing target action.AB</xref>
2433
- </p>
2434
- </clause>
2435
- <clause id='action' type='express-schema' inline-header='false' obligation='normative'>
2436
- <title>Action</title>
2437
- <clause id='action.AA' inline-header='false' obligation='normative'>
2438
- <title>AA</title>
2439
- </clause>
2440
- </clause>
2441
- </sections>
2442
- <bibliography>
2443
- <references id='_' normative='false' obligation='informative'>
2444
- <title>Bibliography</title>
2445
- <bibitem id='D'>
2446
- <formattedref format='application/x-isodoc+xml'>F</formattedref>
2447
- <docidentifier>E</docidentifier>
2448
- </bibitem>
2449
- </references>
2450
- <references hidden='true' normative='false'>
2451
- <bibitem id='uml_A' type='internal'>
2452
- <docidentifier type='repository'>uml/A</docidentifier>
2453
- </bibitem>
2454
- </references>
2455
- </bibliography>
2617
+ output = <<~OUTPUT
2618
+ #{BLANK_HDR}
2619
+ <sections>
2620
+ <clause id='_' inline-header='false' obligation='normative'>
2621
+ <title>Clause</title>
2622
+ <p id='_'>
2623
+ <eref bibitemid='uml_A' citeas="">
2624
+ <localityStack>
2625
+ <locality type='anchor'><referenceFrom>A.B.C</referenceFrom></locality>
2626
+ </localityStack>
2627
+ C
2628
+ </eref>
2629
+ <eref bibitemid='uml_A' citeas=""/>
2630
+ <xref target='action.AA'>AA</xref>
2631
+ <xref target='action'>** Missing target action.AB</xref>
2632
+ </p>
2633
+ </clause>
2634
+ <clause id='action' type='express-schema' inline-header='false' obligation='normative'>
2635
+ <title>Action</title>
2636
+ <clause id='action.AA' inline-header='false' obligation='normative'>
2637
+ <title>AA</title>
2638
+ </clause>
2639
+ </clause>
2640
+ </sections>
2641
+ <bibliography>
2642
+ <references id='_' normative='false' obligation='informative'>
2643
+ <title>Bibliography</title>
2644
+ <bibitem id='D'>
2645
+ <formattedref format='application/x-isodoc+xml'>F</formattedref>
2646
+ <docidentifier>E</docidentifier>
2647
+ </bibitem>
2648
+ </references>
2649
+ <references hidden='true' normative='false'>
2650
+ <bibitem id='uml_A' type='internal'>
2651
+ <docidentifier type='repository'>uml/A</docidentifier>
2652
+ </bibitem>
2653
+ </references>
2654
+ </bibliography>
2456
2655
  </standard-document>
2457
2656
  OUTPUT
2657
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2658
+ .to be_equivalent_to xmlpp(output)
2458
2659
  end
2459
2660
 
2460
2661
  it "process express_ref macro with no existing bibliography" do
2461
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2662
+ input = <<~INPUT
2462
2663
  #{ASCIIDOC_BLANK_HDR}
2463
2664
  [[B]]
2464
2665
  [type="express-schema"]
@@ -2472,6 +2673,7 @@ RSpec.describe Asciidoctor::Standoc do
2472
2673
  <<express-schema:B>>
2473
2674
  <<express-schema:B1>>
2474
2675
  INPUT
2676
+ output = <<~OUTPUT
2475
2677
  #{BLANK_HDR}
2476
2678
  <sections>
2477
2679
  <clause id='B' type='express-schema' inline-header='false' obligation='normative'>
@@ -2503,16 +2705,20 @@ RSpec.describe Asciidoctor::Standoc do
2503
2705
  </bibliography>
2504
2706
  </standard-document>
2505
2707
  OUTPUT
2708
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2709
+ .to be_equivalent_to xmlpp(output)
2506
2710
  end
2507
2711
 
2508
2712
  private
2509
2713
 
2510
- def mock_mathml_italicise(x)
2511
- allow_any_instance_of(::Asciidoctor::Standoc::Cleanup).to receive(:mathml_mi_italics).and_return(x)
2714
+ def mock_mathml_italicise(string)
2715
+ allow_any_instance_of(::Asciidoctor::Standoc::Cleanup)
2716
+ .to receive(:mathml_mi_italics).and_return(string)
2512
2717
  end
2513
2718
 
2514
2719
  def mock_iecbib_get_iec60050_103_01
2515
- expect(Iecbib::IecBibliography).to receive(:get).with("IEC 60050-103", nil, { keep_year: true }) do
2720
+ expect(Iecbib::IecBibliography).to receive(:get)
2721
+ .with("IEC 60050-103", nil, { keep_year: true }) do
2516
2722
  IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
2517
2723
  <bibitem type="standard" id="IEC60050-103">
2518
2724
  <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
@@ -2550,7 +2756,8 @@ RSpec.describe Asciidoctor::Standoc do
2550
2756
  end
2551
2757
 
2552
2758
  def mock_iecbib_get_iec60050_102_01
2553
- expect(Iecbib::IecBibliography).to receive(:get).with("IEC 60050-102", nil, { keep_year: true }) do
2759
+ expect(Iecbib::IecBibliography).to receive(:get)
2760
+ .with("IEC 60050-102", nil, { keep_year: true }) do
2554
2761
  IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
2555
2762
  <bibitem type="standard" id="IEC60050-102">
2556
2763
  <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>