metanorma-standoc 1.8.8 → 1.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) 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 +3 -7
  5. data/Gemfile.devel +0 -0
  6. data/lib/asciidoctor/standoc/base.rb +42 -36
  7. data/lib/asciidoctor/standoc/biblio.rng +1 -0
  8. data/lib/asciidoctor/standoc/blocks.rb +25 -9
  9. data/lib/asciidoctor/standoc/blocks_notes.rb +41 -24
  10. data/lib/asciidoctor/standoc/cleanup.rb +59 -84
  11. data/lib/asciidoctor/standoc/cleanup_block.rb +63 -85
  12. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +51 -29
  13. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +1 -0
  14. data/lib/asciidoctor/standoc/cleanup_image.rb +71 -0
  15. data/lib/asciidoctor/standoc/cleanup_maths.rb +36 -27
  16. data/lib/asciidoctor/standoc/cleanup_ref.rb +24 -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 -134
  20. data/lib/asciidoctor/standoc/cleanup_section_names.rb +75 -0
  21. data/lib/asciidoctor/standoc/converter.rb +10 -3
  22. data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +67 -66
  23. data/lib/asciidoctor/standoc/front.rb +35 -18
  24. data/lib/asciidoctor/standoc/front_contributor.rb +70 -45
  25. data/lib/asciidoctor/standoc/inline.rb +30 -22
  26. data/lib/asciidoctor/standoc/isodoc.rng +321 -4
  27. data/lib/asciidoctor/standoc/lists.rb +4 -2
  28. data/lib/asciidoctor/standoc/macros.rb +50 -23
  29. data/lib/asciidoctor/standoc/macros_form.rb +63 -0
  30. data/lib/asciidoctor/standoc/ref.rb +87 -112
  31. data/lib/asciidoctor/standoc/ref_date_id.rb +62 -0
  32. data/lib/asciidoctor/standoc/ref_sect.rb +20 -17
  33. data/lib/asciidoctor/standoc/section.rb +3 -1
  34. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +31 -16
  35. data/lib/asciidoctor/standoc/terms.rb +27 -16
  36. data/lib/asciidoctor/standoc/utils.rb +35 -9
  37. data/lib/asciidoctor/standoc/validate.rb +30 -28
  38. data/lib/metanorma-standoc.rb +0 -1
  39. data/lib/metanorma/standoc/version.rb +5 -5
  40. data/metanorma-standoc.gemspec +11 -11
  41. data/spec/asciidoctor/base_spec.rb +715 -509
  42. data/spec/asciidoctor/blocks_spec.rb +830 -727
  43. data/spec/asciidoctor/cleanup_sections_spec.rb +51 -14
  44. data/spec/asciidoctor/cleanup_spec.rb +1836 -1673
  45. data/spec/asciidoctor/inline_spec.rb +330 -283
  46. data/spec/asciidoctor/isobib_cache_spec.rb +406 -358
  47. data/spec/asciidoctor/lists_spec.rb +3 -3
  48. data/spec/asciidoctor/macros_plantuml_spec.rb +8 -8
  49. data/spec/asciidoctor/macros_spec.rb +546 -444
  50. data/spec/asciidoctor/macros_yaml2text_spec.rb +1 -1
  51. data/spec/asciidoctor/refs_dl_spec.rb +4 -4
  52. data/spec/asciidoctor/refs_spec.rb +1528 -1533
  53. data/spec/asciidoctor/section_spec.rb +778 -689
  54. data/spec/asciidoctor/table_spec.rb +6 -6
  55. data/spec/asciidoctor/validate_spec.rb +296 -304
  56. data/spec/spec_helper.rb +13 -9
  57. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +66 -66
  58. data/spec/vcr_cassettes/isobib_get_123.yml +17 -17
  59. data/spec/vcr_cassettes/isobib_get_123_1.yml +31 -31
  60. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +40 -40
  61. data/spec/vcr_cassettes/isobib_get_123_2001.yml +17 -17
  62. data/spec/vcr_cassettes/isobib_get_124.yml +16 -16
  63. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  64. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +78 -66
  65. metadata +69 -67
  66. data/lib/liquid/custom_blocks/key_iterator.rb +0 -21
  67. data/lib/liquid/custom_blocks/with_json_nested_context.rb +0 -18
  68. data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +0 -19
  69. 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
 
@@ -3,112 +3,111 @@ require "relaton_iec"
3
3
  require "fileutils"
4
4
 
5
5
  RSpec.describe Asciidoctor::Standoc do
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)))).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>>; href1.htm
34
- * http://www.example.com[Phone]; mn://basic_attribute_schema
35
- * <<express:action_schema:action_schema.basic,Coffee>>; mn://support_resource_schema
36
- ====
37
- INPUT
38
- #{BLANK_HDR}
39
- <sections>
40
- <svgmap unnumbered='true' number='8' subsequence='A' keep-with-next='true' keep-lines-together='true'>
41
- <target href='http://www.example.com'>
42
- <xref target='ref1'>Computer</xref>
43
- </target>
44
- </svgmap>
45
- <figure id='ref1'>
46
- <name>SVG title</name>
47
- <image src='action_schemaexpg1.svg' id='_' mimetype='image/svg+xml' height='auto' width='auto'/>
48
- </figure>
49
- <svgmap>
50
- <figure id='ref2' unnumbered='true' number='8' subsequence='A' keep-with-next='true' keep-lines-together='true'>
51
- <image src='action_schemaexpg2.svg' id='_' mimetype='image/svg+xml' height='auto' width='auto' alt='Workmap'/>
52
- </figure>
53
- <target href='mn://support_resource_schema'>
54
- <eref bibitemid='express_action_schema' citeas=''>
55
- <localityStack>
56
- <locality type='anchor'>
57
- <referenceFrom>action_schema.basic</referenceFrom>
58
- </locality>
59
- </localityStack>
60
- Coffee
61
- </eref>
62
- </target>
63
- </svgmap>
64
- </sections>
65
- <bibliography>
66
- <references hidden='true' normative='false'>
67
- <bibitem id='express_action_schema' type='internal'>
68
- <docidentifier type='repository'>express/action_schema</docidentifier>
69
- </bibitem>
70
- </references>
71
- </bibliography>
72
- </standard-document>
73
- OUTPUT
74
- expect(xmlpp(File.read("action_schemaexpg1.svg", encoding: "utf-8").sub(%r{<image .*</image>}m, ""))).to be_equivalent_to <<~OUTPUT
75
- <?xml version='1.0' encoding='UTF-8'?>
76
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
77
- <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' 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'>
78
- <style type='text/css'> .st0{fill:none;stroke:#000000;stroke-miterlimit:10;} </style>
79
- <a xlink:href='#ref1'>
80
- <rect x='123.28' y='273.93' class='st0' width='88.05' height='41.84'/>
81
- </a>
82
- <a xlink:href='mn://basic_attribute_schema'>
83
- <rect x='324.69' y='450.52' class='st0' width='132.62' height='40.75'/>
84
- </a>
85
- <a xlink:href='mn://support_resource_schema'>
86
- <rect x='324.69' y='528.36' class='st0' width='148.16' height='40.75'/>
87
- </a>
88
- </svg>
89
- OUTPUT
90
- expect(xmlpp(File.read("action_schemaexpg2.svg", encoding: "utf-8").sub(%r{<image .*</image>}m, ""))).to be_equivalent_to <<~OUTPUT
91
- <?xml version='1.0' encoding='UTF-8'?>
92
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
93
- <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' 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'>
94
- <style type='text/css'> .st0{fill:none;stroke:#000000;stroke-miterlimit:10;} </style>
95
- <a xlink:href='mn://action_schema'>
96
- <rect x='123.28' y='273.93' class='st0' width='88.05' height='41.84'/>
97
- </a>
98
- <a xlink:href='http://www.example.com'>
99
- <rect x='324.69' y='450.52' class='st0' width='132.62' height='40.75'/>
100
- </a>
101
- <a xlink:href='mn://support_resource_schema'>
102
- <rect x='324.69' y='528.36' class='st0' width='148.16' height='40.75'/>
103
- </a>
104
- </svg>
105
- OUTPUT
106
- end
107
-
108
- it "processes markup in sourcecode" do
109
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
+ it "processes svgmap" do
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
+ ====
39
+ INPUT
40
+ output = <<~OUTPUT
41
+ #{BLANK_HDR}
42
+ <sections>
43
+ <svgmap unnumbered='true' number='8' subsequence='A' keep-with-next='true' keep-lines-together='true'>
44
+ <target href='http://www.example.com'>
45
+ <xref target='ref1'>Computer</xref>
46
+ </target>
47
+ </svgmap>
48
+ <figure id='ref1'>
49
+ <name>SVG title</name>
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'>
51
+ <style/>
52
+ <image/>
53
+ <a xlink:href='#ref1'>
54
+ <rect x='123.28' y='273.93' class='st0' width='88.05' height='41.84'/>
55
+ </a>
56
+ <a xlink:href='mn://basic_attribute_schema'>
57
+ <rect x='324.69' y='450.52' class='st0' width='132.62' height='40.75'/>
58
+ </a>
59
+ <a xlink:href='mn://support_resource_schema'>
60
+ <rect x='324.69' y='528.36' class='st0' width='148.16' height='40.75'/>
61
+ </a>
62
+ </svg>
63
+ </figure>
64
+ <svgmap>
65
+ <figure id='ref2' unnumbered='true' number='8' subsequence='A' keep-with-next='true' keep-lines-together='true'>
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'>
67
+ <style/>
68
+ <image/>
69
+ <a xlink:href='#ref1'>
70
+ <rect x='123.28' y='273.93' class='st0' width='88.05' height='41.84'/>
71
+ </a>
72
+ <a xlink:href='http://www.example.com'>
73
+ <rect x='324.69' y='450.52' class='st0' width='132.62' height='40.75'/>
74
+ </a>
75
+ <a xlink:href='mn://support_resource_schema'>
76
+ <rect x='324.69' y='528.36' class='st0' width='148.16' height='40.75'/>
77
+ </a>
78
+ </svg>
79
+ </figure>
80
+ <target href='mn://support_resource_schema'>
81
+ <eref bibitemid='express_action_schema' citeas=''>
82
+ <localityStack>
83
+ <locality type='anchor'>
84
+ <referenceFrom>action_schema.basic</referenceFrom>
85
+ </locality>
86
+ </localityStack>
87
+ Coffee
88
+ </eref>
89
+ </target>
90
+ </svgmap>
91
+ </sections>
92
+ <bibliography>
93
+ <references hidden='true' normative='false'>
94
+ <bibitem id='express_action_schema' type='internal'>
95
+ <docidentifier type='repository'>express/action_schema</docidentifier>
96
+ </bibitem>
97
+ </references>
98
+ </bibliography>
99
+ </standard-document>
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)
105
+ end
106
+
107
+ it "processes markup in sourcecode" do
108
+ input = <<~INPUT
110
109
  #{ASCIIDOC_BLANK_HDR}
111
-
110
+
112
111
  [source]
113
112
  ----
114
113
  <tag/>
@@ -122,23 +121,26 @@ OUTPUT
122
121
 
123
122
 
124
123
  INPUT
125
- #{BLANK_HDR}
126
- <sections>
127
- <sourcecode id='_'>&lt;tag/&gt;</sourcecode>
128
- <sourcecode id='A'>
129
- var
130
- <strong>x</strong>
131
- :
132
- <xref target='A'>recursive</xref>
133
- &lt;tag/&gt;
134
- </sourcecode>
135
- </sections>
136
- </standard-document>
124
+ output = <<~OUTPUT
125
+ #{BLANK_HDR}
126
+ <sections>
127
+ <sourcecode id='_'>&lt;tag/&gt;</sourcecode>
128
+ <sourcecode id='A'>
129
+ var
130
+ <strong>x</strong>
131
+ :
132
+ <xref target='A'>recursive</xref>
133
+ &lt;tag/&gt;
134
+ </sourcecode>
135
+ </sections>
136
+ </standard-document>
137
137
  OUTPUT
138
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
139
+ .to be_equivalent_to xmlpp(output)
138
140
  end
139
141
 
140
- it "processes markup in sourcecode with custom delimiters" do
141
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
142
+ it "processes markup in sourcecode with custom delimiters" do
143
+ input = <<~INPUT
142
144
  = Document title
143
145
  Author
144
146
  :docfile: test.adoc
@@ -156,40 +158,45 @@ OUTPUT
156
158
 
157
159
 
158
160
  INPUT
159
- #{BLANK_HDR}
160
- <sections>
161
- <sourcecode id='A'>
162
- var
163
- <strong>x</strong>
164
- :
165
- <xref target='A'>recursive</xref>
166
- </sourcecode>
167
- </sections>
168
- </standard-document>
161
+ output = <<~OUTPUT
162
+ #{BLANK_HDR}
163
+ <sections>
164
+ <sourcecode id='A'>
165
+ var
166
+ <strong>x</strong>
167
+ :
168
+ <xref target='A'>recursive</xref>
169
+ </sourcecode>
170
+ </sections>
171
+ </standard-document>
169
172
  OUTPUT
173
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
174
+ .to be_equivalent_to xmlpp(output)
170
175
  end
171
176
 
172
-
173
177
  it "applies smartquotes by default" do
174
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
178
+ input = <<~INPUT
175
179
  #{ASCIIDOC_BLANK_HDR}
176
180
  == "Quotation" A's
177
181
 
178
182
  '24:00:00'.
179
183
  INPUT
180
- #{BLANK_HDR}
181
- <sections>
182
- <clause id="_" inline-header="false" obligation="normative">
183
- <title>“Quotation” A’s</title>
184
- <p id='_'>‘24:00:00’.</p>
185
- </clause>
186
- </sections>
187
- </standard-document>
184
+ output = <<~OUTPUT
185
+ #{BLANK_HDR}
186
+ <sections>
187
+ <clause id="_" inline-header="false" obligation="normative">
188
+ <title>“Quotation” A’s</title>
189
+ <p id='_'>‘24:00:00’.</p>
190
+ </clause>
191
+ </sections>
192
+ </standard-document>
188
193
  OUTPUT
194
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
195
+ .to be_equivalent_to xmlpp(output)
189
196
  end
190
197
 
191
198
  it "applies smartquotes when requested" do
192
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
199
+ input = <<~INPUT
193
200
  = Document title
194
201
  Author
195
202
  :docfile: test.adoc
@@ -200,18 +207,21 @@ OUTPUT
200
207
 
201
208
  == "Quotation" A's
202
209
  INPUT
203
- #{BLANK_HDR}
204
- <sections>
205
- <clause id="_" inline-header="false" obligation="normative">
206
- <title>“Quotation” A’s</title>
207
- </clause>
208
- </sections>
209
- </standard-document>
210
+ output = <<~OUTPUT
211
+ #{BLANK_HDR}
212
+ <sections>
213
+ <clause id="_" inline-header="false" obligation="normative">
214
+ <title>“Quotation” A’s</title>
215
+ </clause>
216
+ </sections>
217
+ </standard-document>
210
218
  OUTPUT
219
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
220
+ .to be_equivalent_to xmlpp(output)
211
221
  end
212
222
 
213
- it "does not apply smartquotes when requested not to" do
214
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
223
+ it "does not apply smartquotes when requested not to" do
224
+ input = <<~INPUT
215
225
  = Document title
216
226
  Author
217
227
  :docfile: test.adoc
@@ -224,21 +234,24 @@ OUTPUT
224
234
 
225
235
  `"quote" A's`
226
236
  INPUT
227
- #{BLANK_HDR}
228
- <sections>
229
- <clause id="_" inline-header="false" obligation="normative">
230
- <title>"Quotation" A's</title>
231
- <p id="_">
232
- <tt>"quote" A's</tt>
233
- </p>
234
- </clause>
235
- </sections>
236
- </standard-document>
237
+ output = <<~OUTPUT
238
+ #{BLANK_HDR}
239
+ <sections>
240
+ <clause id="_" inline-header="false" obligation="normative">
241
+ <title>"Quotation" A's</title>
242
+ <p id="_">
243
+ <tt>"quote" A's</tt>
244
+ </p>
245
+ </clause>
246
+ </sections>
247
+ </standard-document>
237
248
  OUTPUT
249
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
250
+ .to be_equivalent_to xmlpp(output)
238
251
  end
239
252
 
240
253
  it "does not apply smartquotes to sourcecode, tt, pre, pseudocode" do
241
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
254
+ input = <<~INPUT
242
255
  = Document title
243
256
  Author
244
257
  :docfile: test.adoc
@@ -264,56 +277,65 @@ OUTPUT
264
277
  ====
265
278
 
266
279
  INPUT
267
- #{BLANK_HDR}
268
- <sections>
269
- <clause id="_" inline-header="false" obligation="normative"><title>“Quotation” A’s</title><p id="_">“Quotation” A’s</p>
270
- <p id="_">
271
- <tt>"quote" A’s</tt>
272
- </p>
273
- <sourcecode id="_">"quote" A's</sourcecode>
274
- <figure id='_' class='pseudocode'>
275
- <p id='_'>"quote" A's</p>
276
- </figure>
277
- </clause>
278
- </sections>
279
- </standard-document>
280
+ output = <<~OUTPUT
281
+ #{BLANK_HDR}
282
+ <sections>
283
+ <clause id="_" inline-header="false" obligation="normative"><title>“Quotation” A’s</title><p id="_">“Quotation” A’s</p>
284
+ <p id="_">
285
+ <tt>"quote" A’s</tt>
286
+ </p>
287
+ <sourcecode id="_">"quote" A's</sourcecode>
288
+ <figure id='_' class='pseudocode'>
289
+ <p id='_'>"quote" A's</p>
290
+ </figure>
291
+ </clause>
292
+ </sections>
293
+ </standard-document>
280
294
  OUTPUT
295
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
296
+ .to be_equivalent_to xmlpp(output)
281
297
  end
282
298
 
283
299
  it "handles < > &amp; in Asciidoctor correctly" do
284
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
300
+ input = <<~INPUT
285
301
  #{ASCIIDOC_BLANK_HDR}
286
302
  == {blank}
287
303
 
288
304
  <&amp;>
289
305
  INPUT
290
- #{BLANK_HDR}
291
- <sections>
292
- <clause id="_" inline-header="false" obligation="normative">
293
- <p id="_">&lt;&amp;&gt;</p>
294
- </clause>
295
- </sections>
296
- </standard-document>
306
+ output = <<~OUTPUT
307
+ #{BLANK_HDR}
308
+ <sections>
309
+ <clause id="_" inline-header="false" obligation="normative">
310
+ <p id="_">&lt;&amp;&gt;</p>
311
+ </clause>
312
+ </sections>
313
+ </standard-document>
297
314
  OUTPUT
315
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
316
+ .to be_equivalent_to xmlpp(output)
298
317
  end
299
318
 
300
319
  it "removes empty text elements" do
301
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
320
+ input = <<~INPUT
302
321
  #{ASCIIDOC_BLANK_HDR}
303
322
  == {blank}
304
323
  INPUT
305
- #{BLANK_HDR}
306
- <sections>
307
- <clause id="_" inline-header="false" obligation="normative">
324
+ output = <<~OUTPUT
325
+ #{BLANK_HDR}
326
+ <sections>
327
+ <clause id="_" inline-header="false" obligation="normative">
308
328
 
309
- </clause>
310
- </sections>
311
- </standard-document>
329
+ </clause>
330
+ </sections>
331
+ </standard-document>
312
332
  OUTPUT
333
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
334
+ .to be_equivalent_to xmlpp(output)
313
335
  end
314
336
 
315
337
  it "processes stem-only terms as admitted" do
316
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
338
+ input = <<~INPUT
317
339
  #{ASCIIDOC_BLANK_HDR}
318
340
  == Terms and Definitions
319
341
 
@@ -323,35 +345,38 @@ OUTPUT
323
345
 
324
346
  Time
325
347
  INPUT
326
- #{BLANK_HDR}
327
- <sections>
328
- <terms id="_" obligation="normative">
329
- <title>Terms and definitions</title>
330
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
331
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
332
- <mrow>
333
- <mi>t</mi>
334
- </mrow>
335
- <mrow>
336
- <mn>90</mn>
337
- </mrow>
338
- </msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
339
- <mrow>
340
- <mi>t</mi>
341
- </mrow>
342
- <mrow>
343
- <mn>91</mn>
344
- </mrow>
345
- </msub></math></stem></admitted>
346
- <definition><p id="_">Time</p></definition></term>
347
- </terms>
348
- </sections>
349
- </standard-document>
348
+ output = <<~OUTPUT
349
+ #{BLANK_HDR}
350
+ <sections>
351
+ <terms id="_" obligation="normative">
352
+ <title>Terms and definitions</title>
353
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
354
+ <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
355
+ <mrow>
356
+ <mi>t</mi>
357
+ </mrow>
358
+ <mrow>
359
+ <mn>90</mn>
360
+ </mrow>
361
+ </msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
362
+ <mrow>
363
+ <mi>t</mi>
364
+ </mrow>
365
+ <mrow>
366
+ <mn>91</mn>
367
+ </mrow>
368
+ </msub></math></stem></admitted>
369
+ <definition><p id="_">Time</p></definition></term>
370
+ </terms>
371
+ </sections>
372
+ </standard-document>
350
373
  OUTPUT
374
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
375
+ .to be_equivalent_to xmlpp(output)
351
376
  end
352
377
 
353
378
  it "moves term domains out of the term definition paragraph" do
354
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
379
+ input = <<~INPUT
355
380
  #{ASCIIDOC_BLANK_HDR}
356
381
  == Terms and Definitions
357
382
 
@@ -365,31 +390,34 @@ OUTPUT
365
390
 
366
391
  domain:[relativity2]
367
392
  INPUT
368
- #{BLANK_HDR}
369
- <sections>
370
- <terms id="_" obligation="normative">
371
- <title>Terms and definitions</title>
372
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
373
- <term id="term-tempus">
374
- <preferred>Tempus</preferred>
375
- <domain>relativity</domain><definition><p id="_"> Time</p></definition>
376
- </term>
377
- <term id='term-tempus1'>
378
- <preferred>Tempus1</preferred>
379
- <domain>relativity2</domain>
380
- <definition>
381
- <p id='_'>Time2</p>
382
- <p id='_'> </p>
383
- </definition>
384
- </term>
385
- </terms>
386
- </sections>
387
- </standard-document>
393
+ output = <<~OUTPUT
394
+ #{BLANK_HDR}
395
+ <sections>
396
+ <terms id="_" obligation="normative">
397
+ <title>Terms and definitions</title>
398
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
399
+ <term id="term-tempus">
400
+ <preferred>Tempus</preferred>
401
+ <domain>relativity</domain><definition><p id="_"> Time</p></definition>
402
+ </term>
403
+ <term id='term-tempus1'>
404
+ <preferred>Tempus1</preferred>
405
+ <domain>relativity2</domain>
406
+ <definition>
407
+ <p id='_'>Time2</p>
408
+ <p id='_'> </p>
409
+ </definition>
410
+ </term>
411
+ </terms>
412
+ </sections>
413
+ </standard-document>
388
414
  OUTPUT
415
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
416
+ .to be_equivalent_to xmlpp(output)
389
417
  end
390
418
 
391
419
  it "permits multiple blocks in term definition paragraph" do
392
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
420
+ input = <<~INPUT
393
421
  = Document title
394
422
  Author
395
423
  :docfile: test.adoc
@@ -408,40 +436,43 @@ OUTPUT
408
436
 
409
437
  This paragraph is extraneous
410
438
  INPUT
411
- #{BLANK_HDR}
412
- <sections>
413
- <terms id="_" obligation="normative">
414
- <title>Terms and definitions</title>
415
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
416
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
417
- <mrow>
418
- <mi>t</mi>
419
- </mrow>
420
- <mrow>
421
- <mn>90</mn>
422
- </mrow>
423
- </msub></math></stem></preferred><definition><formula id="_">
424
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
425
- <mrow>
426
- <mi>t</mi>
427
- </mrow>
428
- <mrow>
429
- <mi>A</mi>
430
- </mrow>
431
- </msub></math></stem>
432
- </formula>
433
- <p id="_">This paragraph is extraneous</p></definition>
434
- </term>
435
- </terms>
436
- </sections>
437
- </standard-document>
439
+ output = <<~OUTPUT
440
+ #{BLANK_HDR}
441
+ <sections>
442
+ <terms id="_" obligation="normative">
443
+ <title>Terms and definitions</title>
444
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
445
+ <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
446
+ <mrow>
447
+ <mi>t</mi>
448
+ </mrow>
449
+ <mrow>
450
+ <mn>90</mn>
451
+ </mrow>
452
+ </msub></math></stem></preferred><definition><formula id="_">
453
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
454
+ <mrow>
455
+ <mi>t</mi>
456
+ </mrow>
457
+ <mrow>
458
+ <mi>A</mi>
459
+ </mrow>
460
+ </msub></math></stem>
461
+ </formula>
462
+ <p id="_">This paragraph is extraneous</p></definition>
463
+ </term>
464
+ </terms>
465
+ </sections>
466
+ </standard-document>
438
467
  OUTPUT
468
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
469
+ .to be_equivalent_to xmlpp(output)
439
470
  end
440
471
 
441
472
  it "moves notes inside preceding blocks, if they are not at clause end, and the blocks are not delimited" do
442
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
473
+ input = <<~INPUT
443
474
  #{ASCIIDOC_BLANK_HDR}
444
-
475
+
445
476
  [stem]
446
477
  ++++
447
478
  r = 1 %
@@ -452,20 +483,22 @@ OUTPUT
452
483
 
453
484
  Indeed.
454
485
  INPUT
455
- #{BLANK_HDR}
456
- <sections><formula id="_">
457
- <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>
458
- <note id="_">
459
- <p id="_">That formula does not do much</p>
460
- </note></formula>
461
-
462
- <p id="_">Indeed.</p></sections>
463
- </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>
464
495
  OUTPUT
496
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
497
+ .to be_equivalent_to xmlpp(output)
465
498
  end
466
499
 
467
- it "does not move notes inside preceding blocks, if they are marked as keep-separate" do
468
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
500
+ it "does not move notes inside preceding blocks, if they are marked as keep-separate" do
501
+ input = <<~INPUT
469
502
  #{ASCIIDOC_BLANK_HDR}
470
503
 
471
504
  [stem]
@@ -481,20 +514,22 @@ OUTPUT
481
514
 
482
515
  Indeed.
483
516
  INPUT
484
- #{BLANK_HDR}
485
- <sections><formula id="_">
486
- <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>
487
- <note id="_">
488
- <p id="_">That formula does not do much</p>
489
- </note>
490
-
491
- <p id="_">Indeed.</p></sections>
492
- </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>
493
526
  OUTPUT
527
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
528
+ .to be_equivalent_to xmlpp(output)
494
529
  end
495
530
 
496
531
  it "does not move notes inside preceding blocks, if they are at clause end" do
497
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
532
+ input = <<~INPUT
498
533
  #{ASCIIDOC_BLANK_HDR}
499
534
  [source,ruby]
500
535
  [1...x].each do |y|
@@ -503,31 +538,37 @@ OUTPUT
503
538
 
504
539
  NOTE: That loop does not do much
505
540
  INPUT
506
- #{BLANK_HDR}
507
- <sections><sourcecode id="_" lang="ruby">[1...x].each do |y|
508
- puts y
509
- end</sourcecode>
510
- <note id="_">
511
- <p id="_">That loop does not do much</p>
512
- </note></sections>
513
- </standard-document>
541
+ output = <<~OUTPUT
542
+ #{BLANK_HDR}
543
+ <sections><sourcecode id="_" lang="ruby">[1...x].each do |y|
544
+ puts y
545
+ end</sourcecode>
546
+ <note id="_">
547
+ <p id="_">That loop does not do much</p>
548
+ </note></sections>
549
+ </standard-document>
514
550
  OUTPUT
551
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
552
+ .to be_equivalent_to xmlpp(output)
515
553
  end
516
554
 
517
555
  it "converts xrefs to references into erefs" do
518
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
556
+ input = <<~INPUT
519
557
  #{ASCIIDOC_BLANK_HDR}
520
558
  <<iso216>>
559
+ <<iso216,droploc%capital%>>
521
560
 
522
561
  [bibliography]
523
562
  == Normative References
524
563
  * [[[iso216,ISO 216:2001]]], _Reference_
525
564
  INPUT
565
+ output = <<~OUTPUT
526
566
  #{BLANK_HDR}
527
567
  <preface><foreword id="_" obligation="informative">
528
568
  <title>Foreword</title>
529
569
  <p id="_">
530
570
  <eref type="inline" bibitemid="iso216" citeas="ISO 216:2001"/>
571
+ <eref type='inline' case='capital' droploc='true' bibitemid='iso216' citeas='ISO 216:2001'/>
531
572
  </p>
532
573
  </foreword></preface><sections>
533
574
  </sections><bibliography><references id="_" obligation="informative" normative="true">
@@ -551,107 +592,123 @@ OUTPUT
551
592
  </bibliography>
552
593
  </standard-document>
553
594
  OUTPUT
595
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
596
+ .to be_equivalent_to xmlpp(output)
554
597
  end
555
598
 
556
599
  it "extracts localities from erefs" do
557
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
600
+ input = <<~INPUT
558
601
  #{ASCIIDOC_BLANK_HDR}
559
602
  <<iso216,whole,clause=3,example=9-11,locality:prelude="33 a",locality:entirety:the reference,xyz>>
560
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>>
561
604
  <<iso216,_whole_>>
562
605
  <<iso216,a _whole_ flagon>>
563
606
  <<iso216,whole,clause=3,a _whole_ flagon>>
607
+ <<iso216,droploc%capital%whole,clause=3,a _whole_ flagon>>
564
608
 
565
609
  [bibliography]
566
610
  == Normative References
567
611
  * [[[iso216,ISO 216]]], _Reference_
568
612
  INPUT
569
- #{BLANK_HDR}
570
- <preface><foreword id="_" obligation="informative">
571
- <title>Foreword</title>
572
- <p id="_">
573
- <eref type="inline" bibitemid="iso216" citeas="ISO 216">
613
+ output = <<~OUTPUT
614
+ #{BLANK_HDR}
615
+ <preface><foreword id="_" obligation="informative">
616
+ <title>Foreword</title>
617
+ <p id="_">
618
+ <eref type="inline" bibitemid="iso216" citeas="ISO 216">
619
+ <localityStack>
620
+ <locality type="whole"/><locality type="clause"><referenceFrom>3</referenceFrom></locality><locality type="example"><referenceFrom>9</referenceFrom><referenceTo>11</referenceTo></locality><locality type="locality:prelude"><referenceFrom>33 a</referenceFrom></locality><locality type="locality:entirety"/>
621
+ </localityStack>
622
+ the reference,xyz</eref>
623
+ <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
624
+ <localityStack>
625
+ <locality type='whole'/>
626
+ <locality type='clause'>
627
+ <referenceFrom>3</referenceFrom>
628
+ </locality>
629
+ <locality type='example'>
630
+ <referenceFrom>9</referenceFrom>
631
+ <referenceTo>11</referenceTo>
632
+ </locality>
633
+ <locality type='locality:prelude'>
634
+ <referenceFrom>33</referenceFrom>
635
+ </locality>
636
+ <locality type='locality:entirety'>
637
+ <referenceFrom>the reference</referenceFrom>
638
+ </locality>
639
+ </localityStack>
640
+ <localityStack>
641
+ <locality type='whole'/>
642
+ <locality type='clause'>
643
+ <referenceFrom>3</referenceFrom>
644
+ </locality>
645
+ <locality type='example'>
646
+ <referenceFrom>9</referenceFrom>
647
+ <referenceTo>11</referenceTo>
648
+ </locality>
649
+ <locality type='locality:prelude'>
650
+ <referenceFrom>33</referenceFrom>
651
+ </locality>
652
+ <locality type='locality:entirety'/>
653
+ </localityStack>
654
+ the reference,xyz
655
+ </eref>
656
+ <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
657
+ <em>whole</em>
658
+ </eref>
659
+ <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
660
+ a
661
+ <em>whole</em>
662
+ flagon
663
+ </eref>
664
+ <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
574
665
  <localityStack>
575
- <locality type="whole"/><locality type="clause"><referenceFrom>3</referenceFrom></locality><locality type="example"><referenceFrom>9</referenceFrom><referenceTo>11</referenceTo></locality><locality type="locality:prelude"><referenceFrom>33 a</referenceFrom></locality><locality type="locality:entirety"/>
666
+ <locality type='whole'/>
667
+ <locality type='clause'>
668
+ <referenceFrom>3</referenceFrom>
669
+ </locality>
576
670
  </localityStack>
577
- the reference,xyz</eref>
578
- <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
579
- <localityStack>
580
- <locality type='whole'/>
581
- <locality type='clause'>
582
- <referenceFrom>3</referenceFrom>
583
- </locality>
584
- <locality type='example'>
585
- <referenceFrom>9</referenceFrom>
586
- <referenceTo>11</referenceTo>
587
- </locality>
588
- <locality type='locality:prelude'>
589
- <referenceFrom>33</referenceFrom>
590
- </locality>
591
- <locality type='locality:entirety'>
592
- <referenceFrom>the reference</referenceFrom>
593
- </locality>
594
- </localityStack>
595
- <localityStack>
596
- <locality type='whole'/>
597
- <locality type='clause'>
598
- <referenceFrom>3</referenceFrom>
599
- </locality>
600
- <locality type='example'>
601
- <referenceFrom>9</referenceFrom>
602
- <referenceTo>11</referenceTo>
603
- </locality>
604
- <locality type='locality:prelude'>
605
- <referenceFrom>33</referenceFrom>
606
- </locality>
607
- <locality type='locality:entirety'/>
608
- </localityStack>
609
- the reference,xyz
610
- </eref>
611
- <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
612
- <em>whole</em>
613
- </eref>
614
- <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
615
- a
616
- <em>whole</em>
617
- flagon
618
- </eref>
619
- <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
620
- <localityStack>
621
- <locality type='whole'/>
622
- <locality type='clause'>
623
- <referenceFrom>3</referenceFrom>
624
- </locality>
625
- </localityStack>
626
- a
627
- <em>whole</em>
628
- flagon
629
- </eref>
630
- </p>
631
- </foreword></preface><sections>
632
- </sections><bibliography><references id="_" obligation="informative" normative="true">
633
- <title>Normative references</title>
634
- #{NORM_REF_BOILERPLATE}
635
- <bibitem id="iso216" type="standard">
636
- <title format="text/plain">Reference</title>
637
- <docidentifier>ISO 216</docidentifier>
638
- <docnumber>216</docnumber>
639
- <contributor>
640
- <role type="publisher"/>
641
- <organization>
642
- <name>ISO</name>
643
- </organization>
644
- </contributor>
645
- </bibitem>
646
- </references>
647
- </bibliography>
648
- </standard-document>
671
+ a
672
+ <em>whole</em>
673
+ flagon
674
+ </eref>
675
+ <eref type='inline' case='capital' droploc='true' bibitemid='iso216' citeas='ISO 216'>
676
+ <localityStack>
677
+ <locality type='whole'/>
678
+ <locality type='clause'>
679
+ <referenceFrom>3</referenceFrom>
680
+ </locality>
681
+ </localityStack>
682
+ a
683
+ <em>whole</em>
684
+ flagon
685
+ </eref>
686
+ </p>
687
+ </foreword></preface><sections>
688
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
689
+ <title>Normative references</title>
690
+ #{NORM_REF_BOILERPLATE}
691
+ <bibitem id="iso216" type="standard">
692
+ <title format="text/plain">Reference</title>
693
+ <docidentifier>ISO 216</docidentifier>
694
+ <docnumber>216</docnumber>
695
+ <contributor>
696
+ <role type="publisher"/>
697
+ <organization>
698
+ <name>ISO</name>
699
+ </organization>
700
+ </contributor>
701
+ </bibitem>
702
+ </references>
703
+ </bibliography>
704
+ </standard-document>
649
705
  OUTPUT
706
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
707
+ .to be_equivalent_to xmlpp(output)
650
708
  end
651
709
 
652
-
653
710
  it "strips type from xrefs" do
654
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
711
+ input = <<~INPUT
655
712
  #{ASCIIDOC_BLANK_HDR}
656
713
  <<iso216>>
657
714
 
@@ -659,34 +716,37 @@ OUTPUT
659
716
  == Clause
660
717
  * [[[iso216,ISO 216]]], _Reference_
661
718
  INPUT
662
- #{BLANK_HDR}
663
- <preface>
664
- <foreword id="_" obligation="informative">
665
- <title>Foreword</title>
666
- <p id="_">
667
- <eref type="inline" bibitemid="iso216" citeas="ISO 216"/>
668
- </p>
669
- </foreword></preface><sections>
670
- </sections><bibliography><references id="_" obligation="informative" normative="false">
671
- <title>Bibliography</title>
672
- <bibitem id="iso216" type="standard">
673
- <title format="text/plain">Reference</title>
674
- <docidentifier>ISO 216</docidentifier>
675
- <docnumber>216</docnumber>
676
- <contributor>
677
- <role type="publisher"/>
678
- <organization>
679
- <name>ISO</name>
680
- </organization>
681
- </contributor>
682
- </bibitem>
683
- </references></bibliography>
684
- </standard-document>
719
+ output = <<~OUTPUT
720
+ #{BLANK_HDR}
721
+ <preface>
722
+ <foreword id="_" obligation="informative">
723
+ <title>Foreword</title>
724
+ <p id="_">
725
+ <eref type="inline" bibitemid="iso216" citeas="ISO 216"/>
726
+ </p>
727
+ </foreword></preface><sections>
728
+ </sections><bibliography><references id="_" obligation="informative" normative="false">
729
+ <title>Bibliography</title>
730
+ <bibitem id="iso216" type="standard">
731
+ <title format="text/plain">Reference</title>
732
+ <docidentifier>ISO 216</docidentifier>
733
+ <docnumber>216</docnumber>
734
+ <contributor>
735
+ <role type="publisher"/>
736
+ <organization>
737
+ <name>ISO</name>
738
+ </organization>
739
+ </contributor>
740
+ </bibitem>
741
+ </references></bibliography>
742
+ </standard-document>
685
743
  OUTPUT
744
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
745
+ .to be_equivalent_to xmlpp(output)
686
746
  end
687
747
 
688
748
  it "processes localities in term sources" do
689
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
749
+ input = <<~INPUT
690
750
  #{ASCIIDOC_BLANK_HDR}
691
751
  == Terms and Definitions
692
752
 
@@ -694,63 +754,72 @@ OUTPUT
694
754
 
695
755
  [.source]
696
756
  <<ISO2191,section=1>>
697
- INPUT
698
- #{BLANK_HDR}
699
- <sections>
700
- <terms id="_" obligation="normative">
701
- <title>Terms and definitions</title>
702
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
703
- <term id="term-term1">
704
- <preferred>Term1</preferred>
705
- <termsource status="identical">
706
- <origin bibitemid="ISO2191" type="inline" citeas="">
707
- <localityStack>
708
- <locality type="section"><referenceFrom>1</referenceFrom></locality>
709
- </localityStack>
710
- </origin>
711
- </termsource>
712
- </term>
713
- </terms>
714
- </sections>
715
- </standard-document>
716
- OUTPUT
757
+ INPUT
758
+ output = <<~OUTPUT
759
+ #{BLANK_HDR}
760
+ <sections>
761
+ <terms id="_" obligation="normative">
762
+ <title>Terms and definitions</title>
763
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
764
+ <term id="term-term1">
765
+ <preferred>Term1</preferred>
766
+ <termsource status="identical">
767
+ <origin bibitemid="ISO2191" type="inline" citeas="">
768
+ <localityStack>
769
+ <locality type="section"><referenceFrom>1</referenceFrom></locality>
770
+ </localityStack>
771
+ </origin>
772
+ </termsource>
773
+ </term>
774
+ </terms>
775
+ </sections>
776
+ </standard-document>
777
+ OUTPUT
778
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
779
+ .to be_equivalent_to xmlpp(output)
717
780
  end
718
781
 
719
782
  it "inserts IDs into paragraphs" do
720
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
783
+ input = <<~INPUT
721
784
  #{ASCIIDOC_BLANK_HDR}
722
785
  Paragraph
723
786
  INPUT
724
- #{BLANK_HDR}
725
- <sections>
726
- <p id="_">Paragraph</p>
727
- </sections>
728
- </standard-document>
787
+ output = <<~OUTPUT
788
+ #{BLANK_HDR}
789
+ <sections>
790
+ <p id="_">Paragraph</p>
791
+ </sections>
792
+ </standard-document>
729
793
  OUTPUT
794
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
795
+ .to be_equivalent_to xmlpp(output)
730
796
  end
731
797
 
732
798
  it "inserts IDs into notes" do
733
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
799
+ input = <<~INPUT
734
800
  #{ASCIIDOC_BLANK_HDR}
735
801
  [example]
736
802
  ====
737
803
  NOTE: This note has no ID
738
804
  ====
739
805
  INPUT
740
- #{BLANK_HDR}
741
- <sections>
742
- <example id="_">
743
- <note id="_">
744
- <p id="_">This note has no ID</p>
745
- </note>
746
- </example>
747
- </sections>
748
- </standard-document>
806
+ output = <<~OUTPUT
807
+ #{BLANK_HDR}
808
+ <sections>
809
+ <example id="_">
810
+ <note id="_">
811
+ <p id="_">This note has no ID</p>
812
+ </note>
813
+ </example>
814
+ </sections>
815
+ </standard-document>
749
816
  OUTPUT
817
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
818
+ .to be_equivalent_to xmlpp(output)
750
819
  end
751
820
 
752
821
  it "moves table key inside table" do
753
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
822
+ input = <<~INPUT
754
823
  #{ASCIIDOC_BLANK_HDR}
755
824
  |===
756
825
  |a |b |c
@@ -773,60 +842,63 @@ OUTPUT
773
842
 
774
843
  a:: b
775
844
  INPUT
776
- #{BLANK_HDR}
777
- <sections>
778
- <table id='_'>
779
- <tbody>
780
- <tr>
781
- <td valign='top' align='left'>a</td>
782
- <td valign='top' align='left'>b</td>
783
- <td valign='top' align='left'>c</td>
784
- </tr>
785
- </tbody>
786
- <dl id='_' key='true'>
787
- <dt>a</dt>
788
- <dd>
789
- <p id='_'>b</p>
790
- </dd>
791
- </dl>
792
- </table>
793
- <table id='_'>
794
- <tbody>
795
- <tr>
796
- <td valign='top' align='left'>a</td>
797
- <td valign='top' align='left'>b</td>
798
- <td valign='top' align='left'>c</td>
799
- </tr>
800
- </tbody>
801
- <dl id='_' key='true'>
802
- <dt>a</dt>
803
- <dd>
804
- <p id='_'>b</p>
805
- </dd>
806
- </dl>
807
- </table>
808
- <table id='_'>
809
- <tbody>
810
- <tr>
811
- <td valign='top' align='left'>a</td>
812
- <td valign='top' align='left'>b</td>
813
- <td valign='top' align='left'>c</td>
814
- </tr>
815
- </tbody>
816
- </table>
817
- <dl id='_'>
818
- <dt>a</dt>
819
- <dd>
820
- <p id='_'>b</p>
821
- </dd>
822
- </dl>
823
- </sections>
824
- </standard-document>
845
+ output = <<~OUTPUT
846
+ #{BLANK_HDR}
847
+ <sections>
848
+ <table id='_'>
849
+ <tbody>
850
+ <tr>
851
+ <td valign='top' align='left'>a</td>
852
+ <td valign='top' align='left'>b</td>
853
+ <td valign='top' align='left'>c</td>
854
+ </tr>
855
+ </tbody>
856
+ <dl id='_' key='true'>
857
+ <dt>a</dt>
858
+ <dd>
859
+ <p id='_'>b</p>
860
+ </dd>
861
+ </dl>
862
+ </table>
863
+ <table id='_'>
864
+ <tbody>
865
+ <tr>
866
+ <td valign='top' align='left'>a</td>
867
+ <td valign='top' align='left'>b</td>
868
+ <td valign='top' align='left'>c</td>
869
+ </tr>
870
+ </tbody>
871
+ <dl id='_' key='true'>
872
+ <dt>a</dt>
873
+ <dd>
874
+ <p id='_'>b</p>
875
+ </dd>
876
+ </dl>
877
+ </table>
878
+ <table id='_'>
879
+ <tbody>
880
+ <tr>
881
+ <td valign='top' align='left'>a</td>
882
+ <td valign='top' align='left'>b</td>
883
+ <td valign='top' align='left'>c</td>
884
+ </tr>
885
+ </tbody>
886
+ </table>
887
+ <dl id='_'>
888
+ <dt>a</dt>
889
+ <dd>
890
+ <p id='_'>b</p>
891
+ </dd>
892
+ </dl>
893
+ </sections>
894
+ </standard-document>
825
895
  OUTPUT
896
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
897
+ .to be_equivalent_to xmlpp(output)
826
898
  end
827
899
 
828
900
  it "processes headerrows attribute for table without header rows" do
829
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
901
+ input = <<~INPUT
830
902
  #{ASCIIDOC_BLANK_HDR}
831
903
  [headerrows=3]
832
904
  |===
@@ -836,36 +908,39 @@ OUTPUT
836
908
  |a |b |c
837
909
  |===
838
910
  INPUT
839
- #{BLANK_HDR}
840
- <sections>
841
- <table id="_"><thead><tr>
842
- <th valign="top" align="left">a</th>
843
- <th valign="top" align="left">b</th>
844
- <th valign="top" align="left">c</th>
845
- </tr><tr>
846
- <th valign="top" align="left">a</th>
847
- <th valign="top" align="left">b</th>
848
- <th valign="top" align="left">c</th>
849
- </tr><tr>
850
- <th valign="top" align="left">a</th>
851
- <th valign="top" align="left">b</th>
852
- <th valign="top" align="left">c</th>
853
- </tr></thead>
854
- <tbody>
855
- <tr>
856
- <td valign="top" align="left">a</td>
857
- <td valign="top" align="left">b</td>
858
- <td valign="top" align="left">c</td>
859
- </tr>
860
- </tbody>
861
- </table>
862
- </sections>
863
- </standard-document>
911
+ output = <<~OUTPUT
912
+ #{BLANK_HDR}
913
+ <sections>
914
+ <table id="_"><thead><tr>
915
+ <th valign="top" align="left">a</th>
916
+ <th valign="top" align="left">b</th>
917
+ <th valign="top" align="left">c</th>
918
+ </tr><tr>
919
+ <th valign="top" align="left">a</th>
920
+ <th valign="top" align="left">b</th>
921
+ <th valign="top" align="left">c</th>
922
+ </tr><tr>
923
+ <th valign="top" align="left">a</th>
924
+ <th valign="top" align="left">b</th>
925
+ <th valign="top" align="left">c</th>
926
+ </tr></thead>
927
+ <tbody>
928
+ <tr>
929
+ <td valign="top" align="left">a</td>
930
+ <td valign="top" align="left">b</td>
931
+ <td valign="top" align="left">c</td>
932
+ </tr>
933
+ </tbody>
934
+ </table>
935
+ </sections>
936
+ </standard-document>
864
937
  OUTPUT
938
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
939
+ .to be_equivalent_to xmlpp(output)
865
940
  end
866
941
 
867
942
  it "processes headerrows attribute for table with header rows" do
868
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
943
+ input = <<~INPUT
869
944
  #{ASCIIDOC_BLANK_HDR}
870
945
  [headerrows=3]
871
946
  |===
@@ -876,41 +951,44 @@ OUTPUT
876
951
  |a |b |c
877
952
  |===
878
953
  INPUT
879
- #{BLANK_HDR}
880
- <sections>
881
- <table id="_">
882
- <thead>
883
- <tr>
884
- <th valign="top" align="left">a</th>
885
- <th valign="top" align="left">b</th>
886
- <th valign="top" align="left">c</th>
887
- </tr>
888
- <tr>
889
- <th valign="top" align="left">a</th>
890
- <th valign="top" align="left">b</th>
891
- <th valign="top" align="left">c</th>
892
- </tr><tr>
893
- <th valign="top" align="left">a</th>
894
- <th valign="top" align="left">b</th>
895
- <th valign="top" align="left">c</th>
896
- </tr></thead>
897
- <tbody>
898
-
899
-
900
- <tr>
901
- <td valign="top" align="left">a</td>
902
- <td valign="top" align="left">b</td>
903
- <td valign="top" align="left">c</td>
904
- </tr>
905
- </tbody>
906
- </table>
907
- </sections>
908
- </standard-document>
954
+ output = <<~OUTPUT
955
+ #{BLANK_HDR}
956
+ <sections>
957
+ <table id="_">
958
+ <thead>
959
+ <tr>
960
+ <th valign="top" align="left">a</th>
961
+ <th valign="top" align="left">b</th>
962
+ <th valign="top" align="left">c</th>
963
+ </tr>
964
+ <tr>
965
+ <th valign="top" align="left">a</th>
966
+ <th valign="top" align="left">b</th>
967
+ <th valign="top" align="left">c</th>
968
+ </tr><tr>
969
+ <th valign="top" align="left">a</th>
970
+ <th valign="top" align="left">b</th>
971
+ <th valign="top" align="left">c</th>
972
+ </tr></thead>
973
+ <tbody>
974
+
975
+
976
+ <tr>
977
+ <td valign="top" align="left">a</td>
978
+ <td valign="top" align="left">b</td>
979
+ <td valign="top" align="left">c</td>
980
+ </tr>
981
+ </tbody>
982
+ </table>
983
+ </sections>
984
+ </standard-document>
909
985
  OUTPUT
986
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
987
+ .to be_equivalent_to xmlpp(output)
910
988
  end
911
989
 
912
990
  it "moves table notes inside table" do
913
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
991
+ input = <<~INPUT
914
992
  #{ASCIIDOC_BLANK_HDR}
915
993
  |===
916
994
  |a |b |c
@@ -920,28 +998,31 @@ OUTPUT
920
998
 
921
999
  NOTE: Note 2
922
1000
  INPUT
923
- #{BLANK_HDR}
924
- <sections><table id="_">
925
- <tbody>
926
- <tr>
927
- <td valign="top" align="left">a</td>
928
- <td valign="top" align="left">b</td>
929
- <td valign="top" align="left">c</td>
930
- </tr>
931
- </tbody>
932
- <note id="_">
933
- <p id="_">Note 1</p>
934
- </note><note id="_">
935
- <p id="_">Note 2</p>
936
- </note></table>
937
-
938
- </sections>
939
- </standard-document>
1001
+ output = <<~OUTPUT
1002
+ #{BLANK_HDR}
1003
+ <sections><table id="_">
1004
+ <tbody>
1005
+ <tr>
1006
+ <td valign="top" align="left">a</td>
1007
+ <td valign="top" align="left">b</td>
1008
+ <td valign="top" align="left">c</td>
1009
+ </tr>
1010
+ </tbody>
1011
+ <note id="_">
1012
+ <p id="_">Note 1</p>
1013
+ </note><note id="_">
1014
+ <p id="_">Note 2</p>
1015
+ </note></table>
1016
+
1017
+ </sections>
1018
+ </standard-document>
940
1019
  OUTPUT
1020
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1021
+ .to be_equivalent_to xmlpp(output)
941
1022
  end
942
1023
 
943
1024
  it "moves formula key inside formula" do
944
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1025
+ input = <<~INPUT
945
1026
  #{ASCIIDOC_BLANK_HDR}
946
1027
  [stem]
947
1028
  ++++
@@ -967,66 +1048,69 @@ OUTPUT
967
1048
 
968
1049
  a:: b
969
1050
  INPUT
970
- #{BLANK_HDR}
971
- <sections>
972
- <formula id='_'>
973
- <stem type='MathML'>
974
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
975
- <mi>F</mi>
976
- <mi>or</mi>
977
- <mi>μ</mi>
978
- <mi>l</mi>
979
- <mi>a</mi>
980
- </math>
981
- </stem>
982
- <dl id='_' key='true'>
983
- <dt>a</dt>
984
- <dd>
985
- <p id='_'>b</p>
986
- </dd>
987
- </dl>
988
- </formula>
989
- <formula id='_'>
990
- <stem type='MathML'>
991
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
992
- <mi>F</mi>
993
- <mi>or</mi>
994
- <mi>μ</mi>
995
- <mi>l</mi>
996
- <mi>a</mi>
997
- </math>
998
- </stem>
999
- <dl id='_' key='true'>
1000
- <dt>a</dt>
1001
- <dd>
1002
- <p id='_'>b</p>
1003
- </dd>
1004
- </dl>
1005
- </formula>
1006
- <formula id='_'>
1007
- <stem type='MathML'>
1008
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1009
- <mi>F</mi>
1010
- <mi>or</mi>
1011
- <mi>μ</mi>
1012
- <mi>l</mi>
1013
- <mi>a</mi>
1014
- </math>
1015
- </stem>
1016
- </formula>
1017
- <dl id='_'>
1018
- <dt>a</dt>
1019
- <dd>
1020
- <p id='_'>b</p>
1021
- </dd>
1022
- </dl>
1023
- </sections>
1024
- </standard-document>
1051
+ output = <<~OUTPUT
1052
+ #{BLANK_HDR}
1053
+ <sections>
1054
+ <formula id='_'>
1055
+ <stem type='MathML'>
1056
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1057
+ <mi>F</mi>
1058
+ <mi>or</mi>
1059
+ <mi>μ</mi>
1060
+ <mi>l</mi>
1061
+ <mi>a</mi>
1062
+ </math>
1063
+ </stem>
1064
+ <dl id='_' key='true'>
1065
+ <dt>a</dt>
1066
+ <dd>
1067
+ <p id='_'>b</p>
1068
+ </dd>
1069
+ </dl>
1070
+ </formula>
1071
+ <formula id='_'>
1072
+ <stem type='MathML'>
1073
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1074
+ <mi>F</mi>
1075
+ <mi>or</mi>
1076
+ <mi>μ</mi>
1077
+ <mi>l</mi>
1078
+ <mi>a</mi>
1079
+ </math>
1080
+ </stem>
1081
+ <dl id='_' key='true'>
1082
+ <dt>a</dt>
1083
+ <dd>
1084
+ <p id='_'>b</p>
1085
+ </dd>
1086
+ </dl>
1087
+ </formula>
1088
+ <formula id='_'>
1089
+ <stem type='MathML'>
1090
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1091
+ <mi>F</mi>
1092
+ <mi>or</mi>
1093
+ <mi>μ</mi>
1094
+ <mi>l</mi>
1095
+ <mi>a</mi>
1096
+ </math>
1097
+ </stem>
1098
+ </formula>
1099
+ <dl id='_'>
1100
+ <dt>a</dt>
1101
+ <dd>
1102
+ <p id='_'>b</p>
1103
+ </dd>
1104
+ </dl>
1105
+ </sections>
1106
+ </standard-document>
1025
1107
  OUTPUT
1108
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1109
+ .to be_equivalent_to xmlpp(output)
1026
1110
  end
1027
1111
 
1028
1112
  it "moves footnotes inside figures" do
1029
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1113
+ input = <<~INPUT
1030
1114
  #{ASCIIDOC_BLANK_HDR}
1031
1115
  .Figuretitle.footnote:[xyz]
1032
1116
  image::spec/examples/rice_images/rice_image1.png[]
@@ -1037,35 +1121,36 @@ OUTPUT
1037
1121
 
1038
1122
  A footnote:[This is a third footnote]
1039
1123
  INPUT
1040
- #{BLANK_HDR}
1041
- <sections><figure id="_">
1042
- <name>
1043
- Figuretitle.
1044
- <fn reference='1'>
1045
- <p id='_'>xyz</p>
1046
- </fn>
1047
- </name>
1048
- <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1049
- <fn reference="a">
1050
- <p id="_">This is a footnote to a figure</p>
1051
- </fn><fn reference="b">
1052
- <p id="_">This is another footnote to a figure</p>
1053
- </fn></figure>
1054
- <p id='_'>
1055
- A
1056
- <fn reference='2'>
1057
- <p id='_'>This is a third footnote</p>
1058
- </fn>
1059
- </p>
1060
-
1061
- </sections>
1062
-
1063
- </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>
1064
1147
  OUTPUT
1148
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1149
+ .to be_equivalent_to xmlpp(output)
1065
1150
  end
1066
1151
 
1067
1152
  it "moves figure key inside figure" do
1068
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1153
+ input = <<~INPUT
1069
1154
  #{ASCIIDOC_BLANK_HDR}
1070
1155
  image::spec/examples/rice_images/rice_image1.png[]
1071
1156
 
@@ -1082,42 +1167,45 @@ OUTPUT
1082
1167
 
1083
1168
  a:: b
1084
1169
  INPUT
1085
- #{BLANK_HDR}
1086
- <sections>
1087
- <figure id='_'>
1088
- <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
1089
- <dl id='_' key='true'>
1090
- <dt>a</dt>
1091
- <dd>
1092
- <p id='_'>b</p>
1093
- </dd>
1094
- </dl>
1095
- </figure>
1096
- <figure id='_'>
1097
- <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
1098
- <dl id='_' key='true'>
1099
- <dt>a</dt>
1100
- <dd>
1101
- <p id='_'>b</p>
1102
- </dd>
1103
- </dl>
1104
- </figure>
1105
- <figure id='_'>
1106
- <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
1107
- </figure>
1108
- <dl id='_'>
1109
- <dt>a</dt>
1110
- <dd>
1111
- <p id='_'>b</p>
1112
- </dd>
1113
- </dl>
1114
- </sections>
1115
- </standard-document>
1170
+ output = <<~OUTPUT
1171
+ #{BLANK_HDR}
1172
+ <sections>
1173
+ <figure id='_'>
1174
+ <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
1175
+ <dl id='_' key='true'>
1176
+ <dt>a</dt>
1177
+ <dd>
1178
+ <p id='_'>b</p>
1179
+ </dd>
1180
+ </dl>
1181
+ </figure>
1182
+ <figure id='_'>
1183
+ <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
1184
+ <dl id='_' key='true'>
1185
+ <dt>a</dt>
1186
+ <dd>
1187
+ <p id='_'>b</p>
1188
+ </dd>
1189
+ </dl>
1190
+ </figure>
1191
+ <figure id='_'>
1192
+ <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
1193
+ </figure>
1194
+ <dl id='_'>
1195
+ <dt>a</dt>
1196
+ <dd>
1197
+ <p id='_'>b</p>
1198
+ </dd>
1199
+ </dl>
1200
+ </sections>
1201
+ </standard-document>
1116
1202
  OUTPUT
1203
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1204
+ .to be_equivalent_to xmlpp(output)
1117
1205
  end
1118
1206
 
1119
1207
  it "processes subfigures" do
1120
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1208
+ input = <<~INPUT
1121
1209
  #{ASCIIDOC_BLANK_HDR}
1122
1210
  [[figureC-2]]
1123
1211
  .Stages of gelatinization
@@ -1132,27 +1220,30 @@ OUTPUT
1132
1220
  image::spec/examples/rice_images/rice_image3_3.png[]
1133
1221
  ====
1134
1222
  INPUT
1135
- #{BLANK_HDR}
1136
- <sections>
1137
- <figure id="figureC-2"><name>Stages of gelatinization</name><figure id="_">
1138
- <name>Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)</name>
1139
- <image src="spec/examples/rice_images/rice_image3_1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1140
- </figure>
1141
- <figure id="_">
1142
- <name>Intermediate stages: Some fully gelatinized kernels are visible</name>
1143
- <image src="spec/examples/rice_images/rice_image3_2.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1144
- </figure>
1145
- <figure id="_">
1146
- <name>Final stages: All kernels are fully gelatinized</name>
1147
- <image src="spec/examples/rice_images/rice_image3_3.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1148
- </figure></figure>
1149
- </sections>
1150
- </standard-document>
1223
+ output = <<~OUTPUT
1224
+ #{BLANK_HDR}
1225
+ <sections>
1226
+ <figure id="figureC-2"><name>Stages of gelatinization</name><figure id="_">
1227
+ <name>Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)</name>
1228
+ <image src="spec/examples/rice_images/rice_image3_1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1229
+ </figure>
1230
+ <figure id="_">
1231
+ <name>Intermediate stages: Some fully gelatinized kernels are visible</name>
1232
+ <image src="spec/examples/rice_images/rice_image3_2.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1233
+ </figure>
1234
+ <figure id="_">
1235
+ <name>Final stages: All kernels are fully gelatinized</name>
1236
+ <image src="spec/examples/rice_images/rice_image3_3.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1237
+ </figure></figure>
1238
+ </sections>
1239
+ </standard-document>
1151
1240
  OUTPUT
1241
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1242
+ .to be_equivalent_to xmlpp(output)
1152
1243
  end
1153
1244
 
1154
1245
  it "numbers bibliographic notes and footnotes sequentially" do
1155
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1246
+ input = <<~INPUT
1156
1247
  #{ASCIIDOC_BLANK_HDR}
1157
1248
  footnote:[Footnote]
1158
1249
 
@@ -1164,6 +1255,7 @@ OUTPUT
1164
1255
  == Clause
1165
1256
  footnote:[Footnote2]
1166
1257
  INPUT
1258
+ output = <<~OUTPUT
1167
1259
  #{BLANK_HDR}
1168
1260
  <preface><foreword id="_" obligation="informative">
1169
1261
  <title>Foreword</title>
@@ -1201,10 +1293,12 @@ OUTPUT
1201
1293
  </bibliography>
1202
1294
  </standard-document>
1203
1295
  OUTPUT
1296
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1297
+ .to be_equivalent_to xmlpp(output)
1204
1298
  end
1205
1299
 
1206
- it "rearranges term note, term example, term source" do
1207
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1300
+ it "rearranges term note, term example, term source" do
1301
+ input = <<~INPUT
1208
1302
  #{ASCIIDOC_BLANK_HDR}
1209
1303
 
1210
1304
  == Terms and definitions
@@ -1224,72 +1318,77 @@ OUTPUT
1224
1318
  [example]
1225
1319
  Example 2
1226
1320
  INPUT
1227
- #{BLANK_HDR}
1228
- <sections>
1229
- <terms id="_" obligation="normative">
1230
- <title>Terms and definitions</title>
1231
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
1232
- <term id="term-term"><preferred>Term</preferred>
1233
-
1234
-
1235
-
1236
- <termnote id="_">
1237
- <p id="_">Note</p>
1238
- </termnote><termnote id="_">
1239
- <p id="_">Note 2</p>
1240
- </termnote><termexample id="_">
1241
- <p id="_">Example 1</p>
1242
- </termexample><termexample id="_">
1243
- <p id="_">Example 2</p>
1244
- </termexample><termsource status="identical">
1245
- <origin bibitemid="ISO2191" type="inline" citeas="">
1246
- <localityStack>
1247
- <locality type="section"><referenceFrom>1</referenceFrom></locality>
1248
- </localityStack>
1249
- </origin>
1250
- </termsource></term>
1251
- </terms>
1252
- </sections>
1253
- </standard-document>
1321
+ output = <<~OUTPUT
1322
+ #{BLANK_HDR}
1323
+ <sections>
1324
+ <terms id="_" obligation="normative">
1325
+ <title>Terms and definitions</title>
1326
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
1327
+ <term id="term-term"><preferred>Term</preferred>
1328
+
1329
+
1330
+
1331
+ <termnote id="_">
1332
+ <p id="_">Note</p>
1333
+ </termnote><termnote id="_">
1334
+ <p id="_">Note 2</p>
1335
+ </termnote><termexample id="_">
1336
+ <p id="_">Example 1</p>
1337
+ </termexample><termexample id="_">
1338
+ <p id="_">Example 2</p>
1339
+ </termexample><termsource status="identical">
1340
+ <origin bibitemid="ISO2191" type="inline" citeas="">
1341
+ <localityStack>
1342
+ <locality type="section"><referenceFrom>1</referenceFrom></locality>
1343
+ </localityStack>
1344
+ </origin>
1345
+ </termsource></term>
1346
+ </terms>
1347
+ </sections>
1348
+ </standard-document>
1254
1349
  OUTPUT
1350
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1351
+ .to be_equivalent_to xmlpp(output)
1255
1352
  end
1256
1353
 
1257
1354
  it "separates IEV citations by top-level clause" do
1258
1355
  FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1")
1259
- 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
1260
1358
  FileUtils.rm_rf File.expand_path("~/.iev.pstore1")
1261
- 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
1262
1361
  FileUtils.rm_rf "relaton/cache"
1263
1362
  FileUtils.rm_rf "test.iev.pstore"
1264
1363
  # mock_iecbib_get_iec60050_102_01
1265
1364
  # mock_iecbib_get_iec60050_103_01
1266
1365
  # mock_iev
1267
1366
  VCR.use_cassette "separates_iev_citations_by_top_level_clause" do
1268
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1269
- #{CACHED_ISOBIB_BLANK_HDR}
1367
+ input = <<~INPUT
1368
+ #{CACHED_ISOBIB_BLANK_HDR}
1270
1369
 
1271
- [bibliography]
1272
- == Normative References
1273
- * [[[iev,IEV]]], _iev_
1370
+ [bibliography]
1371
+ == Normative References
1372
+ * [[[iev,IEV]]], _iev_
1274
1373
 
1275
- == Terms and definitions
1276
- === Automation1
1374
+ == Terms and definitions
1375
+ === Automation1
1277
1376
 
1278
- [.source]
1279
- <<iev,clause="103-01-02">>
1377
+ [.source]
1378
+ <<iev,clause="103-01-02">>
1280
1379
 
1281
- === Automation2
1380
+ === Automation2
1282
1381
 
1283
- [.source]
1284
- <<iev,clause="102-01-02">>
1382
+ [.source]
1383
+ <<iev,clause="102-01-02">>
1285
1384
 
1286
- === Automation3
1385
+ === Automation3
1287
1386
 
1288
- [.source]
1289
- <<iev,clause="103-01-02">>
1387
+ [.source]
1388
+ <<iev,clause="103-01-02">>
1290
1389
  INPUT
1390
+ output = <<~OUTPUT
1291
1391
  #{BLANK_HDR}
1292
-
1293
1392
  <sections>
1294
1393
  <terms id="_" obligation="normative"><title>Terms and definitions</title>
1295
1394
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
@@ -1351,7 +1450,7 @@ OUTPUT
1351
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>
1352
1451
  <status>
1353
1452
  <stage>60</stage>
1354
- <substage>00</substage>
1453
+ <substage>60</substage>
1355
1454
  </status>
1356
1455
  <copyright>
1357
1456
  <from>2007</from>
@@ -1380,8 +1479,8 @@ OUTPUT
1380
1479
  <role type="publisher"/>
1381
1480
  <organization>
1382
1481
  <name>International Electrotechnical Commission</name>
1383
- <abbreviation>IEC</abbreviation>
1384
- <uri>www.iec.ch</uri>
1482
+ <abbreviation>IEC</abbreviation>
1483
+ <uri>www.iec.ch</uri>
1385
1484
  </organization>
1386
1485
  </contributor>
1387
1486
  <edition>1.0</edition>
@@ -1397,8 +1496,8 @@ OUTPUT
1397
1496
  <owner>
1398
1497
  <organization>
1399
1498
  <name>International Electrotechnical Commission</name>
1400
- <abbreviation>IEC</abbreviation>
1401
- <uri>www.iec.ch</uri>
1499
+ <abbreviation>IEC</abbreviation>
1500
+ <uri>www.iec.ch</uri>
1402
1501
  </organization>
1403
1502
  </owner>
1404
1503
  </copyright>
@@ -1406,51 +1505,56 @@ OUTPUT
1406
1505
  </bibitem>
1407
1506
  </references></bibliography>
1408
1507
  </standard-document>
1409
- OUTPUT
1508
+ OUTPUT
1509
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1510
+ .to be_equivalent_to xmlpp(output)
1410
1511
  end
1411
1512
  FileUtils.rm_rf File.expand_path("~/.iev.pstore")
1412
- 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
1413
1515
  FileUtils.rm_rf File.expand_path("~/.relaton/cache")
1414
- 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
1415
1518
  end
1416
1519
 
1417
- it "counts footnotes with link-only content as separate footnotes" do
1418
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1520
+ it "counts footnotes with link-only content as separate footnotes" do
1521
+ input = <<~INPUT
1419
1522
  #{ASCIIDOC_BLANK_HDR}
1420
-
1523
+
1421
1524
  footnote:[http://www.example.com]
1422
1525
 
1423
1526
  footnote:[http://www.example.com]
1424
1527
 
1425
1528
  footnote:[http://www.example1.com]
1426
1529
  INPUT
1427
- #{BLANK_HDR}
1428
- <sections><p id="_"><fn reference="1">
1429
- <p id="_">
1430
- <link target="http://www.example.com"/>
1431
- </p>
1432
- </fn>
1433
- </p>
1434
- <p id="_"><fn reference="1">
1435
- <p id="_">
1436
- <link target="http://www.example.com"/>
1437
- </p>
1438
- </fn>
1439
- </p>
1440
- <p id="_"><fn reference="2">
1441
- <p id="_">
1442
- <link target="http://www.example1.com"/>
1443
- </p>
1444
- </fn>
1445
- </p></sections>
1446
-
1447
-
1448
- </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>
1449
1551
  OUTPUT
1552
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1553
+ .to be_equivalent_to xmlpp(output)
1450
1554
  end
1451
1555
 
1452
- it "retains AsciiMath on request" do
1453
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1556
+ it "retains AsciiMath on request" do
1557
+ input = <<~INPUT
1454
1558
  = Document title
1455
1559
  Author
1456
1560
  :docfile: test.adoc
@@ -1461,19 +1565,21 @@ OUTPUT
1461
1565
 
1462
1566
  stem:[1/r]
1463
1567
  INPUT
1464
- #{BLANK_HDR}
1465
- <sections>
1466
- <p id="_">
1467
- <stem type="AsciiMath">1/r</stem>
1468
- </p>
1469
- </sections>
1470
- </standard-document>
1471
-
1472
- OUTPUT
1473
- end
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>
1576
+ OUTPUT
1577
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1578
+ .to be_equivalent_to xmlpp(output)
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,43 +1589,48 @@ OUTPUT
1483
1589
 
1484
1590
  stem:[1/r]
1485
1591
  INPUT
1486
- #{BLANK_HDR}
1487
- <sections>
1488
- <p id="_">
1489
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac>
1490
- <mrow>
1491
- <mn>1</mn>
1492
- </mrow>
1493
- <mrow>
1494
- <mi>r</mi>
1495
- </mrow>
1496
- </mfrac></math></stem>
1497
- </p>
1498
- </sections>
1499
- </standard-document>
1592
+ output = <<~OUTPUT
1593
+ #{BLANK_HDR}
1594
+ <sections>
1595
+ <p id="_">
1596
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac>
1597
+ <mrow>
1598
+ <mn>1</mn>
1599
+ </mrow>
1600
+ <mrow>
1601
+ <mi>r</mi>
1602
+ </mrow>
1603
+ </mfrac></math></stem>
1604
+ </p>
1605
+ </sections>
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
- 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")
1612
+ it "cleans up text MathML" do
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
-
1516
-
1517
- </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>
1518
1626
  OUTPUT
1627
+ expect(Asciidoctor::Standoc::Converter.new(nil, *OPTIONS)
1628
+ .cleanup(Nokogiri::XML(input)).to_xml)
1629
+ .to be_equivalent_to xmlpp(output)
1519
1630
  end
1520
1631
 
1521
- it "renumbers numeric references in Bibliography sequentially" do
1522
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1632
+ it "renumbers numeric references in Bibliography sequentially" do
1633
+ input = <<~INPUT
1523
1634
  #{ASCIIDOC_BLANK_HDR}
1524
1635
 
1525
1636
  == Clause
@@ -1532,38 +1643,41 @@ OUTPUT
1532
1643
  * [[[iso124,ISO 124]]] _Standard 124_
1533
1644
  * [[[iso123,1]]] _Standard 123_
1534
1645
  INPUT
1535
- #{BLANK_HDR}
1536
- <sections><clause id="_" inline-header="false" obligation="normative">
1537
- <title>Clause</title>
1538
- <p id="_"><eref type="inline" bibitemid="iso123" citeas="[2]"/>
1539
- <eref type="inline" bibitemid="iso124" citeas="ISO 124"/></p>
1540
- </clause>
1541
- </sections><bibliography><references id="_" obligation="informative" normative="false">
1542
- <title>Bibliography</title>
1543
- <bibitem id="iso124" type="standard">
1544
- <title format="text/plain">Standard 124</title>
1545
- <docidentifier>ISO 124</docidentifier>
1546
- <docnumber>124</docnumber>
1547
- <contributor>
1548
- <role type="publisher"/>
1549
- <organization>
1550
- <name>ISO</name>
1551
- </organization>
1552
- </contributor>
1553
- </bibitem>
1554
- <bibitem id="iso123">
1555
- <formattedref format="application/x-isodoc+xml">
1556
- <em>Standard 123</em>
1557
- </formattedref>
1558
- <docidentifier type="metanorma">[2]</docidentifier>
1559
- </bibitem>
1560
- </references></bibliography>
1561
- </standard-document>
1562
- OUTPUT
1563
- end
1646
+ output = <<~OUTPUT
1647
+ #{BLANK_HDR}
1648
+ <sections><clause id="_" inline-header="false" obligation="normative">
1649
+ <title>Clause</title>
1650
+ <p id="_"><eref type="inline" bibitemid="iso123" citeas="[2]"/>
1651
+ <eref type="inline" bibitemid="iso124" citeas="ISO 124"/></p>
1652
+ </clause>
1653
+ </sections><bibliography><references id="_" obligation="informative" normative="false">
1654
+ <title>Bibliography</title>
1655
+ <bibitem id="iso124" type="standard">
1656
+ <title format="text/plain">Standard 124</title>
1657
+ <docidentifier>ISO 124</docidentifier>
1658
+ <docnumber>124</docnumber>
1659
+ <contributor>
1660
+ <role type="publisher"/>
1661
+ <organization>
1662
+ <name>ISO</name>
1663
+ </organization>
1664
+ </contributor>
1665
+ </bibitem>
1666
+ <bibitem id="iso123">
1667
+ <formattedref format="application/x-isodoc+xml">
1668
+ <em>Standard 123</em>
1669
+ </formattedref>
1670
+ <docidentifier type="metanorma">[2]</docidentifier>
1671
+ </bibitem>
1672
+ </references></bibliography>
1673
+ </standard-document>
1674
+ OUTPUT
1675
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1676
+ .to be_equivalent_to xmlpp(output)
1677
+ end
1564
1678
 
1565
- it "renumbers numeric references in Bibliography subclauses sequentially" do
1566
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1679
+ it "renumbers numeric references in Bibliography subclauses sequentially" do
1680
+ input = <<~INPUT
1567
1681
  #{ASCIIDOC_BLANK_HDR}
1568
1682
 
1569
1683
  == Clause
@@ -1594,555 +1708,590 @@ OUTPUT
1594
1708
  * [[[iso128,1]]] _Standard 123_
1595
1709
 
1596
1710
  INPUT
1597
- #{BLANK_HDR}
1598
- <sections><clause id="_" inline-header="false" obligation="normative">
1599
- <title>Clause</title>
1600
- <p id="_"><eref type="inline" bibitemid="iso123" citeas="[2]"/>
1601
- <eref type="inline" bibitemid="iso124" citeas="ISO 124"/>
1602
- <eref type="inline" bibitemid="iso125" citeas="ISO 125"/>
1603
- <eref type="inline" bibitemid="iso126" citeas="[4]"/></p>
1604
- </clause>
1605
- </sections><bibliography><clause id="_" obligation="informative"><title>Bibliography</title><references id="_" obligation="informative" normative="false">
1606
- <title>Clause 1</title>
1607
- <bibitem id="iso124" type="standard">
1608
- <title format="text/plain">Standard 124</title>
1609
- <docidentifier>ISO 124</docidentifier>
1610
- <docnumber>124</docnumber>
1611
- <contributor>
1612
- <role type="publisher"/>
1613
- <organization>
1614
- <name>ISO</name>
1615
- </organization>
1616
- </contributor>
1617
- </bibitem>
1618
- <bibitem id="iso123">
1619
- <formattedref format="application/x-isodoc+xml">
1620
- <em>Standard 123</em>
1621
- </formattedref>
1622
- <docidentifier type="metanorma">[2]</docidentifier>
1623
- </bibitem>
1624
- </references>
1625
- <references id="_" obligation="informative" normative="false">
1626
- <bibitem id="iso125" type="standard">
1627
- <title format="text/plain">Standard 124</title>
1628
- <docidentifier>ISO 125</docidentifier>
1629
- <docnumber>125</docnumber>
1630
- <contributor>
1631
- <role type="publisher"/>
1632
- <organization>
1633
- <name>ISO</name>
1634
- </organization>
1635
- </contributor>
1636
- </bibitem>
1637
- <bibitem id="iso126">
1638
- <formattedref format="application/x-isodoc+xml">
1639
- <em>Standard 123</em>
1640
- </formattedref>
1641
- <docidentifier type="metanorma">[4]</docidentifier>
1642
- </bibitem>
1643
- </references>
1644
- </clause>
1645
- <clause id='_' obligation='informative'>
1646
- <title>Bibliography Redux</title>
1647
- <references id='_' normative='false' obligation='informative'>
1648
- <title>Clause 1</title>
1649
- <bibitem id='iso127' type='standard'>
1650
- <title format='text/plain'>Standard 124</title>
1651
- <docidentifier>ISO 124</docidentifier>
1652
- <docnumber>124</docnumber>
1653
- <contributor>
1654
- <role type='publisher'/>
1655
- <organization>
1656
- <name>ISO</name>
1657
- </organization>
1658
- </contributor>
1659
- </bibitem>
1660
- <bibitem id='iso128'>
1661
- <formattedref format='application/x-isodoc+xml'>
1662
- <em>Standard 123</em>
1663
- </formattedref>
1664
- <docidentifier type='metanorma'>[6]</docidentifier>
1665
- </bibitem>
1666
- </references></clause></bibliography>
1667
- </standard-document>
1668
- OUTPUT
1669
- end
1670
-
1671
- it "removes bibdata bibitem IDs" do
1672
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1673
- = Document title
1674
- Author
1675
- :docfile: test.adoc
1676
- :nodoc:
1677
- :novalid:
1678
- :no-isobib:
1679
- :translated-from: IEC 60050-102
1680
-
1681
- [bibliography]
1682
- == Normative References
1711
+ output = <<~OUTPUT
1712
+ #{BLANK_HDR}
1713
+ <sections><clause id="_" inline-header="false" obligation="normative">
1714
+ <title>Clause</title>
1715
+ <p id="_"><eref type="inline" bibitemid="iso123" citeas="[2]"/>
1716
+ <eref type="inline" bibitemid="iso124" citeas="ISO 124"/>
1717
+ <eref type="inline" bibitemid="iso125" citeas="ISO 125"/>
1718
+ <eref type="inline" bibitemid="iso126" citeas="[4]"/></p>
1719
+ </clause>
1720
+ </sections><bibliography><clause id="_" obligation="informative"><title>Bibliography</title><references id="_" obligation="informative" normative="false">
1721
+ <title>Clause 1</title>
1722
+ <bibitem id="iso124" type="standard">
1723
+ <title format="text/plain">Standard 124</title>
1724
+ <docidentifier>ISO 124</docidentifier>
1725
+ <docnumber>124</docnumber>
1726
+ <contributor>
1727
+ <role type="publisher"/>
1728
+ <organization>
1729
+ <name>ISO</name>
1730
+ </organization>
1731
+ </contributor>
1732
+ </bibitem>
1733
+ <bibitem id="iso123">
1734
+ <formattedref format="application/x-isodoc+xml">
1735
+ <em>Standard 123</em>
1736
+ </formattedref>
1737
+ <docidentifier type="metanorma">[2]</docidentifier>
1738
+ </bibitem>
1739
+ </references>
1740
+ <references id="_" obligation="informative" normative="false">
1741
+ <bibitem id="iso125" type="standard">
1742
+ <title format="text/plain">Standard 124</title>
1743
+ <docidentifier>ISO 125</docidentifier>
1744
+ <docnumber>125</docnumber>
1745
+ <contributor>
1746
+ <role type="publisher"/>
1747
+ <organization>
1748
+ <name>ISO</name>
1749
+ </organization>
1750
+ </contributor>
1751
+ </bibitem>
1752
+ <bibitem id="iso126">
1753
+ <formattedref format="application/x-isodoc+xml">
1754
+ <em>Standard 123</em>
1755
+ </formattedref>
1756
+ <docidentifier type="metanorma">[4]</docidentifier>
1757
+ </bibitem>
1758
+ </references>
1759
+ </clause>
1760
+ <clause id='_' obligation='informative'>
1761
+ <title>Bibliography Redux</title>
1762
+ <references id='_' normative='false' obligation='informative'>
1763
+ <title>Clause 1</title>
1764
+ <bibitem id='iso127' type='standard'>
1765
+ <title format='text/plain'>Standard 124</title>
1766
+ <docidentifier>ISO 124</docidentifier>
1767
+ <docnumber>124</docnumber>
1768
+ <contributor>
1769
+ <role type='publisher'/>
1770
+ <organization>
1771
+ <name>ISO</name>
1772
+ </organization>
1773
+ </contributor>
1774
+ </bibitem>
1775
+ <bibitem id='iso128'>
1776
+ <formattedref format='application/x-isodoc+xml'>
1777
+ <em>Standard 123</em>
1778
+ </formattedref>
1779
+ <docidentifier type='metanorma'>[6]</docidentifier>
1780
+ </bibitem>
1781
+ </references></clause></bibliography>
1782
+ </standard-document>
1783
+ OUTPUT
1784
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1785
+ .to be_equivalent_to xmlpp(output)
1786
+ end
1787
+
1788
+ it "removes bibdata bibitem IDs" do
1789
+ input = <<~INPUT
1790
+ = Document title
1791
+ Author
1792
+ :docfile: test.adoc
1793
+ :nodoc:
1794
+ :novalid:
1795
+ :no-isobib:
1796
+ :translated-from: IEC 60050-102
1797
+
1798
+ [bibliography]
1799
+ == Normative References
1683
1800
 
1684
1801
  INPUT
1685
- <?xml version='1.0' encoding='UTF-8'?>
1686
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1687
- <bibdata type='standard'>
1688
- <title language='en' format='text/plain'>Document title</title>
1689
- <language>en</language>
1690
- <script>Latn</script>
1691
- <status>
1692
- <stage>published</stage>
1693
- </status>
1694
- <copyright>
1695
- <from>#{Date.today.year}</from>
1696
- </copyright>
1697
- <relation type='translatedFrom'>
1698
- <bibitem>
1699
- <title>--</title>
1700
- <docidentifier>IEC 60050-102</docidentifier>
1701
- </bibitem>
1702
- </relation>
1703
- <ext>
1704
- <doctype>article</doctype>
1705
- </ext>
1706
- </bibdata>
1707
- <sections> </sections>
1708
- <bibliography>
1709
- <references id='_' obligation='informative' normative="true">
1710
- <title>Normative references</title>
1711
- <p id="_">There are no normative references in this document.</p>
1712
- </references>
1713
- </bibliography>
1714
- </standard-document>
1715
- OUTPUT
1716
- end
1802
+ output = <<~OUTPUT
1803
+ <?xml version='1.0' encoding='UTF-8'?>
1804
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1805
+ <bibdata type='standard'>
1806
+ <title language='en' format='text/plain'>Document title</title>
1807
+ <language>en</language>
1808
+ <script>Latn</script>
1809
+ <status>
1810
+ <stage>published</stage>
1811
+ </status>
1812
+ <copyright>
1813
+ <from>#{Date.today.year}</from>
1814
+ </copyright>
1815
+ <relation type='translatedFrom'>
1816
+ <bibitem>
1817
+ <title>--</title>
1818
+ <docidentifier>IEC 60050-102</docidentifier>
1819
+ </bibitem>
1820
+ </relation>
1821
+ <ext>
1822
+ <doctype>article</doctype>
1823
+ </ext>
1824
+ </bibdata>
1825
+ <sections> </sections>
1826
+ <bibliography>
1827
+ <references id='_' obligation='informative' normative="true">
1828
+ <title>Normative references</title>
1829
+ <p id="_">There are no normative references in this document.</p>
1830
+ </references>
1831
+ </bibliography>
1832
+ </standard-document>
1833
+ OUTPUT
1834
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1835
+ .to be_equivalent_to xmlpp(output)
1836
+ end
1717
1837
 
1718
- it "imports boilerplate file" do
1719
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1720
- = Document title
1721
- Author
1722
- :docfile: test.adoc
1723
- :nodoc:
1724
- :novalid:
1725
- :no-isobib:
1726
- :docstage: 10
1727
- :boilerplate-authority: spec/assets/boilerplate.xml
1838
+ it "imports boilerplate file" do
1839
+ input = <<~INPUT
1840
+ = Document title
1841
+ Author
1842
+ :docfile: test.adoc
1843
+ :nodoc:
1844
+ :novalid:
1845
+ :no-isobib:
1846
+ :docstage: 10
1847
+ :boilerplate-authority: spec/assets/boilerplate.xml
1728
1848
 
1729
- == Clause 1
1849
+ == Clause 1
1730
1850
 
1731
1851
  INPUT
1732
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1733
- <bibdata type='standard'>
1734
- <title language='en' format='text/plain'>Document title</title>
1735
- <language>en</language>
1736
- <script>Latn</script>
1737
- <status>
1738
- <stage>10</stage>
1739
- </status>
1740
- <copyright>
1741
- <from>#{Date.today.year}</from>
1742
- </copyright>
1743
- <ext>
1744
- <doctype>article</doctype>
1745
- </ext>
1746
- </bibdata>
1747
- <boilerplate>
1748
- <text>10</text>
1749
- </boilerplate>
1750
- <sections>
1751
- <clause id='_' inline-header='false' obligation='normative'>
1752
- <title>Clause 1</title>
1753
- </clause>
1754
- </sections>
1755
- </standard-document>
1852
+ output = <<~OUTPUT
1853
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1854
+ <bibdata type='standard'>
1855
+ <title language='en' format='text/plain'>Document title</title>
1856
+ <language>en</language>
1857
+ <script>Latn</script>
1858
+ <status>
1859
+ <stage>10</stage>
1860
+ </status>
1861
+ <copyright>
1862
+ <from>#{Date.today.year}</from>
1863
+ </copyright>
1864
+ <ext>
1865
+ <doctype>article</doctype>
1866
+ </ext>
1867
+ </bibdata>
1868
+ <boilerplate>
1869
+ <text>10</text>
1870
+ </boilerplate>
1871
+ <sections>
1872
+ <clause id='_' inline-header='false' obligation='normative'>
1873
+ <title>Clause 1</title>
1874
+ </clause>
1875
+ </sections>
1876
+ </standard-document>
1756
1877
  OUTPUT
1757
- end
1878
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1879
+ .to be_equivalent_to xmlpp(output)
1880
+ end
1758
1881
 
1759
- it "sorts symbols lists" do
1760
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1761
- #{ASCIIDOC_BLANK_HDR}
1762
-
1763
- [[L]]
1764
- == Symbols and abbreviated terms
1765
-
1766
- α:: Definition 1
1767
- Xa:: Definition 2
1768
- x_1_:: Definition 3
1769
- x_m_:: Definition 4
1770
- x:: Definition 5
1771
- stem:[n]:: Definition 6
1772
- m:: Definition 7
1773
- INPUT
1774
- #{BLANK_HDR}
1775
- <sections>
1776
- <definitions id='L' obligation="normative">
1777
- <title>Symbols and abbreviated terms</title>
1778
- <dl id='_'>
1779
- <dt>m</dt>
1780
- <dd>
1781
- <p id='_'>Definition 7</p>
1782
- </dd>
1783
- <dt>
1784
- <stem type='MathML'>
1785
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1786
- <mi>n</mi>
1787
- </math>
1788
- </stem>
1789
- </dt>
1790
- <dd>
1791
- <p id='_'>Definition 6</p>
1792
- </dd>
1793
- <dt>x</dt>
1794
- <dd>
1795
- <p id='_'>Definition 5</p>
1796
- </dd>
1797
- <dt>x_m_</dt>
1798
- <dd>
1799
- <p id='_'>Definition 4</p>
1800
- </dd>
1801
- <dt>x_1_</dt>
1802
- <dd>
1803
- <p id='_'>Definition 3</p>
1804
- </dd>
1805
- <dt>Xa</dt>
1806
- <dd>
1807
- <p id='_'>Definition 2</p>
1808
- </dd>
1809
- <dt>α</dt>
1810
- <dd>
1811
- <p id='_'>Definition 1</p>
1812
- </dd>
1813
- </dl>
1814
- </definitions>
1815
- </sections>
1816
- </standard-document>
1817
- OUTPUT
1818
- end
1882
+ it "sorts symbols lists" do
1883
+ input = <<~INPUT
1884
+ #{ASCIIDOC_BLANK_HDR}
1819
1885
 
1820
- it "sorts symbols lists" do
1821
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1822
- #{ASCIIDOC_BLANK_HDR}
1823
-
1824
- [[L]]
1825
- == Symbols and abbreviated terms
1826
-
1827
- stem:[alpha]:: Definition 1
1828
- xa:: Definition 2
1829
- stem:[x_1]:: Definition 3
1830
- stem:[x_m]:: Definition 4
1831
- x:: Definition 5
1832
- INPUT
1833
- #{BLANK_HDR}
1834
- <sections>
1835
- <definitions id='L' obligation="normative">
1836
- <title>Symbols and abbreviated terms</title>
1837
- <dl id='_'>
1838
- <dt>x</dt>
1839
- <dd>
1840
- <p id='_'>Definition 5</p>
1841
- </dd>
1842
- <dt><stem type='MathML'>
1843
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1844
- <msub>
1845
- <mrow>
1846
- <mi>x</mi>
1847
- </mrow>
1848
- <mrow>
1849
- <mi>m</mi>
1850
- </mrow>
1851
- </msub>
1852
- </math>
1853
- </stem></dt>
1854
- <dd>
1855
- <p id='_'>Definition 4</p>
1856
- </dd>
1857
- <dt><stem type='MathML'>
1858
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1859
- <msub>
1860
- <mrow>
1861
- <mi>x</mi>
1862
- </mrow>
1863
- <mrow>
1864
- <mn>1</mn>
1865
- </mrow>
1866
- </msub>
1867
- </math>
1868
- </stem></dt>
1869
- <dd>
1870
- <p id='_'>Definition 3</p>
1871
- </dd>
1872
- <dt>xa</dt>
1873
- <dd>
1874
- <p id='_'>Definition 2</p>
1875
- </dd>
1876
- <dt>
1886
+ [[L]]
1887
+ == Symbols and abbreviated terms
1888
+
1889
+ α:: Definition 1
1890
+ Xa:: Definition 2
1891
+ x_1_:: Definition 3
1892
+ x_m_:: Definition 4
1893
+ x:: Definition 5
1894
+ stem:[n]:: Definition 6
1895
+ m:: Definition 7
1896
+ INPUT
1897
+ output = <<~OUTPUT
1898
+ #{BLANK_HDR}
1899
+ <sections>
1900
+ <definitions id='L' obligation="normative">
1901
+ <title>Symbols and abbreviated terms</title>
1902
+ <dl id='_'>
1903
+ <dt>m</dt>
1904
+ <dd>
1905
+ <p id='_'>Definition 7</p>
1906
+ </dd>
1907
+ <dt>
1877
1908
  <stem type='MathML'>
1878
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1879
- <mi>α</mi>
1880
- </math>
1881
- </stem>
1882
- </dt>
1883
- <dd>
1884
- <p id='_'>Definition 1</p>
1885
- </dd>
1886
- </dl>
1887
- </definitions>
1888
- </sections>
1889
- </standard-document>
1890
- OUTPUT
1891
- end
1909
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1910
+ <mi>n</mi>
1911
+ </math>
1912
+ </stem>
1913
+ </dt>
1914
+ <dd>
1915
+ <p id='_'>Definition 6</p>
1916
+ </dd>
1917
+ <dt>x</dt>
1918
+ <dd>
1919
+ <p id='_'>Definition 5</p>
1920
+ </dd>
1921
+ <dt>x_m_</dt>
1922
+ <dd>
1923
+ <p id='_'>Definition 4</p>
1924
+ </dd>
1925
+ <dt>x_1_</dt>
1926
+ <dd>
1927
+ <p id='_'>Definition 3</p>
1928
+ </dd>
1929
+ <dt>Xa</dt>
1930
+ <dd>
1931
+ <p id='_'>Definition 2</p>
1932
+ </dd>
1933
+ <dt>α</dt>
1934
+ <dd>
1935
+ <p id='_'>Definition 1</p>
1936
+ </dd>
1937
+ </dl>
1938
+ </definitions>
1939
+ </sections>
1940
+ </standard-document>
1941
+ OUTPUT
1942
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1943
+ .to be_equivalent_to xmlpp(output)
1944
+ end
1892
1945
 
1893
- it "moves inherit macros to correct location" do
1894
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1895
- #{ASCIIDOC_BLANK_HDR}
1896
-
1897
- == Clause
1898
-
1899
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
1900
- .Title
1901
- ====
1902
- inherit:[A]
1903
- inherit:[B]
1904
- I recommend this
1905
- ====
1906
-
1907
- [.requirement,subsequence="A",classification="X:Y"]
1908
- .Title
1909
- ====
1910
- inherit:[A]
1911
- I recommend this
1912
- ====
1913
-
1914
- [.requirement,subsequence="A"]
1915
- .Title
1916
- ====
1917
- inherit:[A]
1918
- I recommend this
1919
- ====
1920
-
1921
- [.requirement,subsequence="A"]
1922
- .Title
1923
- ====
1924
- inherit:[A]
1925
- ====
1926
-
1927
-
1928
- INPUT
1929
- #{BLANK_HDR}
1930
- <sections>
1931
- <clause id='_' inline-header='false' obligation='normative'>
1932
- <title>Clause</title>
1933
- <requirement id='_' subsequence='A'>
1934
- <title>Title</title>
1935
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
1936
- <inherit>A</inherit>
1937
- <inherit>B</inherit>
1938
- <description>
1939
- <p id='_'> I recommend this</p>
1940
- </description>
1941
- </requirement>
1942
- <requirement id='_' subsequence='A'>
1943
- <title>Title</title>
1944
- <inherit>A</inherit>
1945
- <classification>
1946
- <tag>X</tag>
1947
- <value>Y</value>
1948
- </classification>
1949
- <description>
1950
- <p id='_'> I recommend this</p>
1951
- </description>
1952
- </requirement>
1953
- <requirement id='_' subsequence='A'>
1954
- <title>Title</title>
1955
- <inherit>A</inherit>
1956
- <description>
1957
- <p id='_'> I recommend this</p>
1958
- </description>
1959
- </requirement>
1960
- <requirement id='_' subsequence='A'>
1961
- <title>Title</title>
1962
- <inherit>A</inherit>
1963
- <description>
1964
- <p id='_'> </p>
1965
- </description>
1966
- </requirement>
1967
- </clause>
1968
- </sections>
1969
- </standard-document>
1970
- OUTPUT
1971
- end
1946
+ it "sorts symbols lists" do
1947
+ input = <<~INPUT
1948
+ #{ASCIIDOC_BLANK_HDR}
1972
1949
 
1973
- it "moves %beforeclause admonitions to right position" do
1974
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1975
- #{ASCIIDOC_BLANK_HDR}
1976
-
1977
- .Foreword
1978
- Foreword
1979
-
1980
- [NOTE,beforeclauses=true]
1981
- ====
1982
- Note which is very important
1983
- ====
1984
-
1985
- == Introduction
1986
- Introduction
1987
-
1988
- == Scope
1989
- Scope statement
1990
-
1991
- [IMPORTANT,beforeclauses=true]
1992
- ====
1993
- Notice which is very important
1994
- ====
1995
- INPUT
1996
- #{BLANK_HDR}
1997
- <preface>
1998
- <note id='_'>
1999
- <p id='_'>Note which is very important</p>
2000
- </note>
2001
- <foreword id='_' obligation='informative'>
2002
- <title>Foreword</title>
2003
- <p id='_'>Foreword</p>
2004
- </foreword>
2005
- <introduction id='_' obligation='informative'>
2006
- <title>Introduction</title>
2007
- <p id='_'>Introduction</p>
2008
- </introduction>
2009
- </preface>
2010
- <sections>
2011
- <admonition id='_' type='important'>
2012
- <p id='_'>Notice which is very important</p>
2013
- </admonition>
2014
- <clause id='_' inline-header='false' obligation='normative' type="scope">
2015
- <title>Scope</title>
2016
- <p id='_'>Scope statement</p>
2017
- </clause>
2018
- </sections>
2019
- </standard-document>
2020
-
2021
- OUTPUT
2022
- end
1950
+ [[L]]
1951
+ == Symbols and abbreviated terms
2023
1952
 
1953
+ stem:[alpha]:: Definition 1
1954
+ xa:: Definition 2
1955
+ stem:[x_1]:: Definition 3
1956
+ stem:[x_m]:: Definition 4
1957
+ x:: Definition 5
1958
+ INPUT
1959
+ output = <<~OUTPUT
1960
+ #{BLANK_HDR}
1961
+ <sections>
1962
+ <definitions id='L' obligation="normative">
1963
+ <title>Symbols and abbreviated terms</title>
1964
+ <dl id='_'>
1965
+ <dt>x</dt>
1966
+ <dd>
1967
+ <p id='_'>Definition 5</p>
1968
+ </dd>
1969
+ <dt><stem type='MathML'>
1970
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1971
+ <msub>
1972
+ <mrow>
1973
+ <mi>x</mi>
1974
+ </mrow>
1975
+ <mrow>
1976
+ <mi>m</mi>
1977
+ </mrow>
1978
+ </msub>
1979
+ </math>
1980
+ </stem></dt>
1981
+ <dd>
1982
+ <p id='_'>Definition 4</p>
1983
+ </dd>
1984
+ <dt><stem type='MathML'>
1985
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1986
+ <msub>
1987
+ <mrow>
1988
+ <mi>x</mi>
1989
+ </mrow>
1990
+ <mrow>
1991
+ <mn>1</mn>
1992
+ </mrow>
1993
+ </msub>
1994
+ </math>
1995
+ </stem></dt>
1996
+ <dd>
1997
+ <p id='_'>Definition 3</p>
1998
+ </dd>
1999
+ <dt>xa</dt>
2000
+ <dd>
2001
+ <p id='_'>Definition 2</p>
2002
+ </dd>
2003
+ <dt>
2004
+ <stem type='MathML'>
2005
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2006
+ <mi>α</mi>
2007
+ </math>
2008
+ </stem>
2009
+ </dt>
2010
+ <dd>
2011
+ <p id='_'>Definition 1</p>
2012
+ </dd>
2013
+ </dl>
2014
+ </definitions>
2015
+ </sections>
2016
+ </standard-document>
2017
+ OUTPUT
2018
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2019
+ .to be_equivalent_to xmlpp(output)
2020
+ end
2024
2021
 
2025
- it "fixes illegal anchors" do
2026
- input = <<~INPUT
2027
- #{ASCIIDOC_BLANK_HDR}
2028
-
2029
- [[a:b]]
2030
- == A
2031
- <</:ab>>
2032
- <<:>>
2033
- <<1>>
2034
- <<1:>>
2035
- <<1#b>>
2036
- <<:a#b:>>
2037
- <</%ab>>
2038
- <<1!>>
2039
-
2040
- INPUT
2041
- expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true).gsub(/<p id="_[^"]+">/, "").gsub('</p>', ""))).to be_equivalent_to (<<~"OUTPUT")
2042
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
2043
- <bibdata type='standard'>
2044
- <title language='en' format='text/plain'>Document title</title>
2045
- <language>en</language>
2046
- <script>Latn</script>
2047
- <status>
2048
- <stage>published</stage>
2049
- </status>
2050
- <copyright>
2051
- <from>#{Time.now.year}</from>
2052
- </copyright>
2053
- <ext>
2054
- <doctype>article</doctype>
2055
- </ext>
2056
- </bibdata>
2057
- <sections>
2058
- <clause id='a_b' inline-header='false' obligation='normative'>
2059
- <title>A</title>
2060
- <eref bibitemid='__ab' citeas=''/>
2061
- <xref target='_'/>
2062
- <xref target='_1'/>
2063
- <xref target='_1_'/>
2064
- <xref target='1#b'/>
2065
- <xref target='_a#b_'/>
2066
- <xref target='_%ab'/>
2067
- <xref target='_1_'/>
2068
- </clause>
2069
- </sections>
2070
- <bibliography>
2071
- <references hidden='true' normative='false'>
2072
- <bibitem id='__ab' type='internal'>
2073
- <docidentifier type='repository'>//ab</docidentifier>
2074
- </bibitem>
2075
- </references>
2076
- </bibliography>
2077
- </standard-document>
2078
- OUTPUT
2079
- 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
2080
- expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <eref bibitemid="__ab" citeas=""/> from /_ab}).to_stderr
2081
- expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_"/> from :}).to_stderr
2082
- expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_1"/> from 1}).to_stderr
2083
- expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_1_"/> from 1:}).to_stderr
2084
- expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_a#b_"/> from :a#b:}).to_stderr
2085
- end
2022
+ it "moves inherit macros to correct location" do
2023
+ input = <<~INPUT
2024
+ #{ASCIIDOC_BLANK_HDR}
2086
2025
 
2087
- it "moves title footnotes to bibdata" do
2088
- input = <<~INPUT
2089
- = Document title footnote:[ABC] footnote:[DEF]
2090
- Author
2091
- :docfile: test.adoc
2092
- :nodoc:
2093
- :novalid:
2094
- :no-isobib:
2095
-
2096
- INPUT
2097
- expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2098
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
2099
- <bibdata type='standard'>
2100
- <title language='en' format='text/plain'>Document title</title>
2101
- <note type='title-footnote'>
2102
- <p>ABC</p>
2103
- </note>
2104
- <note type='title-footnote'>
2105
- <p>DEF</p>
2106
- </note>
2107
- <language>en</language>
2108
- <script>Latn</script>
2109
- <status>
2110
- <stage>published</stage>
2111
- </status>
2112
- <copyright>
2113
- <from>#{Time.now.year}</from>
2114
- </copyright>
2115
- <ext>
2116
- <doctype>article</doctype>
2117
- </ext>
2118
- </bibdata>
2119
- <sections> </sections>
2120
- </standard-document>
2121
- OUTPUT
2026
+ == Clause
2122
2027
 
2123
- end
2028
+ [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
2029
+ .Title
2030
+ ====
2031
+ inherit:[A]
2032
+ inherit:[B]
2033
+ I recommend this
2034
+ ====
2035
+
2036
+ [.requirement,subsequence="A",classification="X:Y"]
2037
+ .Title
2038
+ ====
2039
+ inherit:[A]
2040
+ I recommend this
2041
+ ====
2042
+
2043
+ [.requirement,subsequence="A"]
2044
+ .Title
2045
+ ====
2046
+ inherit:[A]
2047
+ I recommend this
2048
+ ====
2049
+
2050
+ [.requirement,subsequence="A"]
2051
+ .Title
2052
+ ====
2053
+ inherit:[A]
2054
+ ====
2055
+
2056
+
2057
+ INPUT
2058
+ output = <<~OUTPUT
2059
+ #{BLANK_HDR}
2060
+ <sections>
2061
+ <clause id='_' inline-header='false' obligation='normative'>
2062
+ <title>Clause</title>
2063
+ <requirement id='_' subsequence='A'>
2064
+ <title>Title</title>
2065
+ <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
2066
+ <inherit>A</inherit>
2067
+ <inherit>B</inherit>
2068
+ <description>
2069
+ <p id='_'> I recommend this</p>
2070
+ </description>
2071
+ </requirement>
2072
+ <requirement id='_' subsequence='A'>
2073
+ <title>Title</title>
2074
+ <inherit>A</inherit>
2075
+ <classification>
2076
+ <tag>X</tag>
2077
+ <value>Y</value>
2078
+ </classification>
2079
+ <description>
2080
+ <p id='_'> I recommend this</p>
2081
+ </description>
2082
+ </requirement>
2083
+ <requirement id='_' subsequence='A'>
2084
+ <title>Title</title>
2085
+ <inherit>A</inherit>
2086
+ <description>
2087
+ <p id='_'> I recommend this</p>
2088
+ </description>
2089
+ </requirement>
2090
+ <requirement id='_' subsequence='A'>
2091
+ <title>Title</title>
2092
+ <inherit>A</inherit>
2093
+ <description>
2094
+ <p id='_'> </p>
2095
+ </description>
2096
+ </requirement>
2097
+ </clause>
2098
+ </sections>
2099
+ </standard-document>
2100
+ OUTPUT
2101
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2102
+ .to be_equivalent_to xmlpp(output)
2103
+ end
2104
+
2105
+ it "moves %beforeclause admonitions to right position" do
2106
+ input = <<~INPUT
2107
+ #{ASCIIDOC_BLANK_HDR}
2108
+
2109
+ .Foreword
2110
+ Foreword
2111
+
2112
+ [NOTE,beforeclauses=true]
2113
+ ====
2114
+ Note which is very important
2115
+ ====
2116
+
2117
+ == Introduction
2118
+ Introduction
2119
+
2120
+ == Scope
2121
+ Scope statement
2122
+
2123
+ [IMPORTANT,beforeclauses=true]
2124
+ ====
2125
+ Notice which is very important
2126
+ ====
2127
+ INPUT
2128
+ output = <<~OUTPUT
2129
+ #{BLANK_HDR}
2130
+ <preface>
2131
+ <note id='_'>
2132
+ <p id='_'>Note which is very important</p>
2133
+ </note>
2134
+ <foreword id='_' obligation='informative'>
2135
+ <title>Foreword</title>
2136
+ <p id='_'>Foreword</p>
2137
+ </foreword>
2138
+ <introduction id='_' obligation='informative'>
2139
+ <title>Introduction</title>
2140
+ <p id='_'>Introduction</p>
2141
+ </introduction>
2142
+ </preface>
2143
+ <sections>
2144
+ <admonition id='_' type='important'>
2145
+ <p id='_'>Notice which is very important</p>
2146
+ </admonition>
2147
+ <clause id='_' inline-header='false' obligation='normative' type="scope">
2148
+ <title>Scope</title>
2149
+ <p id='_'>Scope statement</p>
2150
+ </clause>
2151
+ </sections>
2152
+ </standard-document>
2153
+ OUTPUT
2154
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2155
+ .to be_equivalent_to xmlpp(output)
2156
+ end
2124
2157
 
2125
- it "converts UnitsML to MathML" do
2126
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~INPUT, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2127
- = Document title
2128
- Author
2129
- :stem:
2130
-
2131
- [stem]
2132
- ++++
2133
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2134
- <mrow>
2135
- <mn>7</mn>
2136
- <mtext>unitsml(m*kg^-2)</mtext>
2137
- <mo>+</mo>
2138
- <mn>8</mn>
2139
- <mtext>unitsml(m*kg^-2)</mtext>
2140
- </mrow>
2141
- </math>
2142
- ++++
2143
- INPUT
2144
- #{BLANK_HDR}
2145
- <misc-container>
2158
+ it "fixes illegal anchors" do
2159
+ input = <<~INPUT
2160
+ #{ASCIIDOC_BLANK_HDR}
2161
+
2162
+ [[a:b]]
2163
+ == A
2164
+ <</:ab>>
2165
+ <<:>>
2166
+ <<1>>
2167
+ <<1:>>
2168
+ <<1#b>>
2169
+ <<:a#b:>>
2170
+ <</%ab>>
2171
+ <<1!>>
2172
+ INPUT
2173
+ output = <<~OUTPUT
2174
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
2175
+ <bibdata type='standard'>
2176
+ <title language='en' format='text/plain'>Document title</title>
2177
+ <language>en</language>
2178
+ <script>Latn</script>
2179
+ <status>
2180
+ <stage>published</stage>
2181
+ </status>
2182
+ <copyright>
2183
+ <from>#{Time.now.year}</from>
2184
+ </copyright>
2185
+ <ext>
2186
+ <doctype>article</doctype>
2187
+ </ext>
2188
+ </bibdata>
2189
+ <sections>
2190
+ <clause id='a_b' inline-header='false' obligation='normative'>
2191
+ <title>A</title>
2192
+ <eref bibitemid='__ab' citeas=''/>
2193
+ <xref target='_'/>
2194
+ <xref target='_1'/>
2195
+ <xref target='_1_'/>
2196
+ <xref target='1#b'/>
2197
+ <xref target='_a#b_'/>
2198
+ <xref target='_%ab'/>
2199
+ <xref target='_1_'/>
2200
+ </clause>
2201
+ </sections>
2202
+ <bibliography>
2203
+ <references hidden='true' normative='false'>
2204
+ <bibitem id='__ab' type='internal'>
2205
+ <docidentifier type='repository'>//ab</docidentifier>
2206
+ </bibitem>
2207
+ </references>
2208
+ </bibliography>
2209
+ </standard-document>
2210
+ OUTPUT
2211
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)
2212
+ .gsub(/<p id="_[^"]+">/, "").gsub("</p>", "")))
2213
+ .to be_equivalent_to(output)
2214
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2215
+ .to output(%r{normalised identifier in <clause id="a_b" inline-header="false" obligation="normative"/> from a:b})
2216
+ .to_stderr
2217
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2218
+ .to output(%r{normalised identifier in <eref bibitemid="__ab" citeas=""/> from /_ab})
2219
+ .to_stderr
2220
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2221
+ .to output(%r{normalised identifier in <xref target="_"/> from :})
2222
+ .to_stderr
2223
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2224
+ .to output(%r{normalised identifier in <xref target="_1"/> from 1})
2225
+ .to_stderr
2226
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2227
+ .to output(%r{normalised identifier in <xref target="_1_"/> from 1:})
2228
+ .to_stderr
2229
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2230
+ .to output(%r{normalised identifier in <xref target="_a#b_"/> from :a#b:})
2231
+ .to_stderr
2232
+ end
2233
+
2234
+ it "moves title footnotes to bibdata" do
2235
+ input = <<~INPUT
2236
+ = Document title footnote:[ABC] footnote:[DEF]
2237
+ Author
2238
+ :docfile: test.adoc
2239
+ :nodoc:
2240
+ :novalid:
2241
+ :no-isobib:
2242
+
2243
+ INPUT
2244
+ output = <<~OUTPUT
2245
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
2246
+ <bibdata type='standard'>
2247
+ <title language='en' format='text/plain'>Document title</title>
2248
+ <note type='title-footnote'>
2249
+ <p>ABC</p>
2250
+ </note>
2251
+ <note type='title-footnote'>
2252
+ <p>DEF</p>
2253
+ </note>
2254
+ <language>en</language>
2255
+ <script>Latn</script>
2256
+ <status>
2257
+ <stage>published</stage>
2258
+ </status>
2259
+ <copyright>
2260
+ <from>#{Time.now.year}</from>
2261
+ </copyright>
2262
+ <ext>
2263
+ <doctype>article</doctype>
2264
+ </ext>
2265
+ </bibdata>
2266
+ <sections> </sections>
2267
+ </standard-document>
2268
+ OUTPUT
2269
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
2270
+ .to be_equivalent_to xmlpp(output)
2271
+ end
2272
+
2273
+ it "converts UnitsML to MathML" do
2274
+ input = <<~INPUT
2275
+ = Document title
2276
+ Author
2277
+ :stem:
2278
+
2279
+ [stem]
2280
+ ++++
2281
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2282
+ <mrow>
2283
+ <mn>7</mn>
2284
+ <mtext>unitsml(m*kg^-2)</mtext>
2285
+ <mo>+</mo>
2286
+ <mn>8</mn>
2287
+ <mtext>unitsml(m*kg^-2)</mtext>
2288
+ </mrow>
2289
+ </math>
2290
+ ++++
2291
+ INPUT
2292
+ output = <<~OUTPUT
2293
+ #{BLANK_HDR}
2294
+ <misc-container>
2146
2295
  <UnitsML xmlns='https://schema.unitsml.org/unitsml/1.0'>
2147
2296
  <UnitSet>
2148
2297
  <Unit xml:id='U_m.kg-2' dimensionURL='#D_LM-2'>
@@ -2234,178 +2383,187 @@ INPUT
2234
2383
  </formula>
2235
2384
  </sections>
2236
2385
  </standard-document>
2237
- OUTPUT
2238
-
2239
- end
2386
+ OUTPUT
2387
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2388
+ .to be_equivalent_to xmlpp(output)
2389
+ end
2240
2390
 
2241
- it "customises italicisation of MathML" do
2242
- input = <<~INPUT
2243
- = Document title
2244
- Author
2245
- :stem:
2246
-
2247
- [stem]
2248
- ++++
2249
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2250
- <mi>A</mi>
2251
- <mo>+</mo>
2252
- <mi>a</mi>
2253
- <mo>+</mo>
2254
- <mi>Α</mi>
2255
- <mo>+</mo>
2256
- <mi>α</mi>
2257
- <mo>+</mo>
2258
- <mi>AB</mi>
2259
- <mstyle mathvariant="italic">
2260
- <mrow>
2261
- <mi>Α</mi>
2262
- </mrow>
2263
- </mstyle>
2264
- </math>
2265
- ++++
2266
- INPUT
2267
-
2268
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2269
- #{BLANK_HDR}
2270
- <sections>
2271
- <formula id='_'>
2272
- <stem type='MathML'>
2273
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2274
- <mi>A</mi>
2275
- <mo>+</mo>
2276
- <mi>a</mi>
2277
- <mo>+</mo>
2278
- <mi>Α</mi>
2279
- <mo>+</mo>
2280
- <mi>α</mi>
2281
- <mo>+</mo>
2282
- <mi>AB</mi>
2283
- <mstyle mathvariant='italic'>
2284
- <mrow>
2285
- <mi>Α</mi>
2286
- </mrow>
2287
- </mstyle>
2288
- </math>
2289
- </stem>
2290
- </formula>
2291
- </sections>
2292
- </standard-document>
2293
- OUTPUT
2294
- mock_mathml_italicise({ uppergreek: false, upperroman: true, lowergreek: true, lowerroman: true })
2295
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2296
- #{BLANK_HDR}
2297
- <sections>
2298
- <formula id='_'>
2299
- <stem type='MathML'>
2300
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2301
- <mi>A</mi>
2302
- <mo>+</mo>
2303
- <mi>a</mi>
2304
- <mo>+</mo>
2305
- <mi mathvariant="normal">Α</mi>
2306
- <mo>+</mo>
2307
- <mi>α</mi>
2308
- <mo>+</mo>
2309
- <mi>AB</mi>
2310
- <mstyle mathvariant='italic'>
2311
- <mrow>
2312
- <mi>Α</mi>
2313
- </mrow>
2314
- </mstyle>
2315
- </math>
2316
- </stem>
2317
- </formula>
2318
- </sections>
2319
- </standard-document>
2320
- OUTPUT
2321
- mock_mathml_italicise({ uppergreek: true, upperroman: false, lowergreek: true, lowerroman: true })
2322
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2323
- #{BLANK_HDR}
2324
- <sections>
2325
- <formula id='_'>
2326
- <stem type='MathML'>
2327
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2328
- <mi mathvariant="normal">A</mi>
2329
- <mo>+</mo>
2330
- <mi>a</mi>
2331
- <mo>+</mo>
2332
- <mi>Α</mi>
2333
- <mo>+</mo>
2334
- <mi>α</mi>
2335
- <mo>+</mo>
2336
- <mi>AB</mi>
2337
- <mstyle mathvariant='italic'>
2338
- <mrow>
2339
- <mi>Α</mi>
2340
- </mrow>
2341
- </mstyle>
2342
- </math>
2343
- </stem>
2344
- </formula>
2345
- </sections>
2346
- </standard-document>
2347
- OUTPUT
2348
- mock_mathml_italicise({ uppergreek: true, upperroman: true, lowergreek: false, lowerroman: true })
2349
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2350
- #{BLANK_HDR}
2351
- <sections>
2352
- <formula id='_'>
2353
- <stem type='MathML'>
2354
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2355
- <mi>A</mi>
2356
- <mo>+</mo>
2357
- <mi>a</mi>
2358
- <mo>+</mo>
2359
- <mi>Α</mi>
2360
- <mo>+</mo>
2361
- <mi mathvariant="normal">α</mi>
2362
- <mo>+</mo>
2363
- <mi>AB</mi>
2364
- <mstyle mathvariant='italic'>
2365
- <mrow>
2366
- <mi>Α</mi>
2367
- </mrow>
2368
- </mstyle>
2369
- </math>
2370
- </stem>
2371
- </formula>
2372
- </sections>
2373
- </standard-document>
2374
- OUTPUT
2375
- mock_mathml_italicise({ uppergreek: true, upperroman: true, lowergreek: true, lowerroman: false })
2376
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2377
- #{BLANK_HDR}
2378
- <sections>
2379
- <formula id='_'>
2380
- <stem type='MathML'>
2381
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
2382
- <mi>A</mi>
2383
- <mo>+</mo>
2384
- <mi mathvariant="normal">a</mi>
2385
- <mo>+</mo>
2386
- <mi>Α</mi>
2387
- <mo>+</mo>
2388
- <mi>α</mi>
2389
- <mo>+</mo>
2390
- <mi>AB</mi>
2391
- <mstyle mathvariant='italic'>
2392
- <mrow>
2393
- <mi>Α</mi>
2394
- </mrow>
2395
- </mstyle>
2396
- </math>
2397
- </stem>
2398
- </formula>
2399
- </sections>
2400
- </standard-document>
2401
- OUTPUT
2402
- mock_mathml_italicise({ uppergreek: true, upperroman: true, lowergreek: true, lowerroman: true })
2391
+ it "customises italicisation of MathML" do
2392
+ input = <<~INPUT
2393
+ = Document title
2394
+ Author
2395
+ :stem:
2403
2396
 
2397
+ [stem]
2398
+ ++++
2399
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2400
+ <mi>A</mi>
2401
+ <mo>+</mo>
2402
+ <mi>a</mi>
2403
+ <mo>+</mo>
2404
+ <mi>Α</mi>
2405
+ <mo>+</mo>
2406
+ <mi>α</mi>
2407
+ <mo>+</mo>
2408
+ <mi>AB</mi>
2409
+ <mstyle mathvariant="italic">
2410
+ <mrow>
2411
+ <mi>Α</mi>
2412
+ </mrow>
2413
+ </mstyle>
2414
+ </math>
2415
+ ++++
2416
+ INPUT
2404
2417
 
2405
- end
2418
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2419
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2420
+ #{BLANK_HDR}
2421
+ <sections>
2422
+ <formula id='_'>
2423
+ <stem type='MathML'>
2424
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2425
+ <mi>A</mi>
2426
+ <mo>+</mo>
2427
+ <mi>a</mi>
2428
+ <mo>+</mo>
2429
+ <mi>Α</mi>
2430
+ <mo>+</mo>
2431
+ <mi>α</mi>
2432
+ <mo>+</mo>
2433
+ <mi>AB</mi>
2434
+ <mstyle mathvariant='italic'>
2435
+ <mrow>
2436
+ <mi>Α</mi>
2437
+ </mrow>
2438
+ </mstyle>
2439
+ </math>
2440
+ </stem>
2441
+ </formula>
2442
+ </sections>
2443
+ </standard-document>
2444
+ OUTPUT
2445
+ mock_mathml_italicise({ uppergreek: false, upperroman: true,
2446
+ lowergreek: true, lowerroman: true })
2447
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2448
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2449
+ #{BLANK_HDR}
2450
+ <sections>
2451
+ <formula id='_'>
2452
+ <stem type='MathML'>
2453
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2454
+ <mi>A</mi>
2455
+ <mo>+</mo>
2456
+ <mi>a</mi>
2457
+ <mo>+</mo>
2458
+ <mi mathvariant="normal">Α</mi>
2459
+ <mo>+</mo>
2460
+ <mi>α</mi>
2461
+ <mo>+</mo>
2462
+ <mi>AB</mi>
2463
+ <mstyle mathvariant='italic'>
2464
+ <mrow>
2465
+ <mi>Α</mi>
2466
+ </mrow>
2467
+ </mstyle>
2468
+ </math>
2469
+ </stem>
2470
+ </formula>
2471
+ </sections>
2472
+ </standard-document>
2473
+ OUTPUT
2474
+ mock_mathml_italicise({ uppergreek: true, upperroman: false,
2475
+ lowergreek: true, lowerroman: true })
2476
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2477
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2478
+ #{BLANK_HDR}
2479
+ <sections>
2480
+ <formula id='_'>
2481
+ <stem type='MathML'>
2482
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2483
+ <mi mathvariant="normal">A</mi>
2484
+ <mo>+</mo>
2485
+ <mi>a</mi>
2486
+ <mo>+</mo>
2487
+ <mi>Α</mi>
2488
+ <mo>+</mo>
2489
+ <mi>α</mi>
2490
+ <mo>+</mo>
2491
+ <mi>AB</mi>
2492
+ <mstyle mathvariant='italic'>
2493
+ <mrow>
2494
+ <mi>Α</mi>
2495
+ </mrow>
2496
+ </mstyle>
2497
+ </math>
2498
+ </stem>
2499
+ </formula>
2500
+ </sections>
2501
+ </standard-document>
2502
+ OUTPUT
2503
+ mock_mathml_italicise({ uppergreek: true, upperroman: true,
2504
+ lowergreek: false, lowerroman: true })
2505
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2506
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2507
+ #{BLANK_HDR}
2508
+ <sections>
2509
+ <formula id='_'>
2510
+ <stem type='MathML'>
2511
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2512
+ <mi>A</mi>
2513
+ <mo>+</mo>
2514
+ <mi>a</mi>
2515
+ <mo>+</mo>
2516
+ <mi>Α</mi>
2517
+ <mo>+</mo>
2518
+ <mi mathvariant="normal">α</mi>
2519
+ <mo>+</mo>
2520
+ <mi>AB</mi>
2521
+ <mstyle mathvariant='italic'>
2522
+ <mrow>
2523
+ <mi>Α</mi>
2524
+ </mrow>
2525
+ </mstyle>
2526
+ </math>
2527
+ </stem>
2528
+ </formula>
2529
+ </sections>
2530
+ </standard-document>
2531
+ OUTPUT
2532
+ mock_mathml_italicise({ uppergreek: true, upperroman: true,
2533
+ lowergreek: true, lowerroman: false })
2534
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2535
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2536
+ #{BLANK_HDR}
2537
+ <sections>
2538
+ <formula id='_'>
2539
+ <stem type='MathML'>
2540
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2541
+ <mi>A</mi>
2542
+ <mo>+</mo>
2543
+ <mi mathvariant="normal">a</mi>
2544
+ <mo>+</mo>
2545
+ <mi>Α</mi>
2546
+ <mo>+</mo>
2547
+ <mi>α</mi>
2548
+ <mo>+</mo>
2549
+ <mi>AB</mi>
2550
+ <mstyle mathvariant='italic'>
2551
+ <mrow>
2552
+ <mi>Α</mi>
2553
+ </mrow>
2554
+ </mstyle>
2555
+ </math>
2556
+ </stem>
2557
+ </formula>
2558
+ </sections>
2559
+ </standard-document>
2560
+ OUTPUT
2561
+ mock_mathml_italicise({ uppergreek: true, upperroman: true,
2562
+ lowergreek: true, lowerroman: true })
2563
+ end
2406
2564
 
2407
2565
  it "process express_ref macro with existing bibliography" do
2408
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2566
+ input = <<~INPUT
2409
2567
  #{ASCIIDOC_BLANK_HDR}
2410
2568
  == Clause
2411
2569
 
@@ -2425,6 +2583,7 @@ end
2425
2583
  == Bibliography
2426
2584
  * [[[D,E]]] F
2427
2585
  INPUT
2586
+ output = <<~OUTPUT
2428
2587
  #{BLANK_HDR}
2429
2588
  <sections>
2430
2589
  <clause id='_' inline-header='false' obligation='normative'>
@@ -2438,15 +2597,15 @@ end
2438
2597
  </eref>
2439
2598
  <eref bibitemid='uml_A' citeas=""/>
2440
2599
  <xref target='action.AA'>AA</xref>
2441
- <xref target='action'>** Missing target action.AB</xref>
2600
+ <xref target='action'>** Missing target action.AB</xref>
2442
2601
  </p>
2443
2602
  </clause>
2444
2603
  <clause id='action' type='express-schema' inline-header='false' obligation='normative'>
2445
- <title>Action</title>
2446
- <clause id='action.AA' inline-header='false' obligation='normative'>
2447
- <title>AA</title>
2448
- </clause>
2449
- </clause>
2604
+ <title>Action</title>
2605
+ <clause id='action.AA' inline-header='false' obligation='normative'>
2606
+ <title>AA</title>
2607
+ </clause>
2608
+ </clause>
2450
2609
  </sections>
2451
2610
  <bibliography>
2452
2611
  <references id='_' normative='false' obligation='informative'>
@@ -2462,13 +2621,14 @@ end
2462
2621
  </bibitem>
2463
2622
  </references>
2464
2623
  </bibliography>
2465
- </standard-document>
2624
+ </standard-document>
2466
2625
  OUTPUT
2626
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2627
+ .to be_equivalent_to xmlpp(output)
2467
2628
  end
2468
2629
 
2469
-
2470
2630
  it "process express_ref macro with no existing bibliography" do
2471
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2631
+ input = <<~INPUT
2472
2632
  #{ASCIIDOC_BLANK_HDR}
2473
2633
  [[B]]
2474
2634
  [type="express-schema"]
@@ -2482,159 +2642,162 @@ end
2482
2642
  <<express-schema:B>>
2483
2643
  <<express-schema:B1>>
2484
2644
  INPUT
2485
- #{BLANK_HDR}
2486
- <sections>
2487
- <clause id='B' type='express-schema' inline-header='false' obligation='normative'>
2488
- <title>Clause</title>
2489
- <note id='B1'>
2490
- <p id='_'>X</p>
2491
- </note>
2492
- <p id='_'>
2493
- <eref bibitemid='express-schema_A' citeas=''>
2494
- <localityStack>
2495
- <locality type='anchor'>
2496
- <referenceFrom>A.B.C</referenceFrom>
2497
- </locality>
2498
- </localityStack>
2499
- C
2500
- </eref>
2501
- <eref bibitemid='express-schema_A' citeas=''/>
2502
- <xref target='B'/>
2503
- <xref target='B1'/>
2504
- </p>
2505
- </clause>
2506
- </sections>
2507
- <bibliography>
2508
- <references hidden='true' normative='false'>
2509
- <bibitem id='express-schema_A' type='internal'>
2510
- <docidentifier type='repository'>express-schema/A</docidentifier>
2511
- </bibitem>
2512
- </references>
2513
- </bibliography>
2514
- </standard-document>
2645
+ output = <<~OUTPUT
2646
+ #{BLANK_HDR}
2647
+ <sections>
2648
+ <clause id='B' type='express-schema' inline-header='false' obligation='normative'>
2649
+ <title>Clause</title>
2650
+ <note id='B1'>
2651
+ <p id='_'>X</p>
2652
+ </note>
2653
+ <p id='_'>
2654
+ <eref bibitemid='express-schema_A' citeas=''>
2655
+ <localityStack>
2656
+ <locality type='anchor'>
2657
+ <referenceFrom>A.B.C</referenceFrom>
2658
+ </locality>
2659
+ </localityStack>
2660
+ C
2661
+ </eref>
2662
+ <eref bibitemid='express-schema_A' citeas=''/>
2663
+ <xref target='B'/>
2664
+ <xref target='B1'/>
2665
+ </p>
2666
+ </clause>
2667
+ </sections>
2668
+ <bibliography>
2669
+ <references hidden='true' normative='false'>
2670
+ <bibitem id='express-schema_A' type='internal'>
2671
+ <docidentifier type='repository'>express-schema/A</docidentifier>
2672
+ </bibitem>
2673
+ </references>
2674
+ </bibliography>
2675
+ </standard-document>
2515
2676
  OUTPUT
2677
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2678
+ .to be_equivalent_to xmlpp(output)
2516
2679
  end
2517
2680
 
2518
-
2519
2681
  private
2520
2682
 
2521
- def mock_mathml_italicise(x)
2522
- allow_any_instance_of(::Asciidoctor::Standoc::Cleanup).to receive(:mathml_mi_italics).and_return(x)
2683
+ def mock_mathml_italicise(string)
2684
+ allow_any_instance_of(::Asciidoctor::Standoc::Cleanup)
2685
+ .to receive(:mathml_mi_italics).and_return(string)
2523
2686
  end
2524
2687
 
2525
-
2526
- def mock_iecbib_get_iec60050_103_01
2527
- expect(Iecbib::IecBibliography).to receive(:get).with("IEC 60050-103", nil, {keep_year: true}) do
2688
+ def mock_iecbib_get_iec60050_103_01
2689
+ expect(Iecbib::IecBibliography).to receive(:get)
2690
+ .with("IEC 60050-103", nil, { keep_year: true }) do
2528
2691
  IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
2529
- <bibitem type="standard" id="IEC60050-103">
2530
- <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
2531
- <docidentifier>IEC 60050-103:2009</docidentifier>
2532
- <date type="published">
2533
- <on>2009</on>
2534
- </date>
2535
- <contributor>
2536
- <role type="publisher"/>
2537
- <organization>
2538
- <name>International Electrotechnical Commission</name>
2539
- <abbreviation>IEC</abbreviation>
2540
- <uri>www.iec.ch</uri>
2541
- </organization>
2542
- </contributor>
2543
- <language>en</language>
2544
- <language>fr</language>
2545
- <script>Latn</script>
2546
- <status>
2547
- <stage>60</stage>
2548
- </status>
2549
- <copyright>
2550
- <from>2018</from>
2551
- <owner>
2692
+ <bibitem type="standard" id="IEC60050-103">
2693
+ <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
2694
+ <docidentifier>IEC 60050-103:2009</docidentifier>
2695
+ <date type="published">
2696
+ <on>2009</on>
2697
+ </date>
2698
+ <contributor>
2699
+ <role type="publisher"/>
2552
2700
  <organization>
2553
2701
  <name>International Electrotechnical Commission</name>
2554
2702
  <abbreviation>IEC</abbreviation>
2555
2703
  <uri>www.iec.ch</uri>
2556
2704
  </organization>
2557
- </owner>
2558
- </copyright>
2559
- </bibitem>
2560
- OUTPUT
2705
+ </contributor>
2706
+ <language>en</language>
2707
+ <language>fr</language>
2708
+ <script>Latn</script>
2709
+ <status>
2710
+ <stage>60</stage>
2711
+ </status>
2712
+ <copyright>
2713
+ <from>2018</from>
2714
+ <owner>
2715
+ <organization>
2716
+ <name>International Electrotechnical Commission</name>
2717
+ <abbreviation>IEC</abbreviation>
2718
+ <uri>www.iec.ch</uri>
2719
+ </organization>
2720
+ </owner>
2721
+ </copyright>
2722
+ </bibitem>
2723
+ OUTPUT
2561
2724
  end
2562
- end
2725
+ end
2563
2726
 
2564
- def mock_iecbib_get_iec60050_102_01
2565
- expect(Iecbib::IecBibliography).to receive(:get).with("IEC 60050-102", nil, {keep_year: true}) do
2727
+ def mock_iecbib_get_iec60050_102_01
2728
+ expect(Iecbib::IecBibliography).to receive(:get)
2729
+ .with("IEC 60050-102", nil, { keep_year: true }) do
2566
2730
  IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
2567
- <bibitem type="standard" id="IEC60050-102">
2568
- <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
2569
- <docidentifier>IEC 60050-102:2007</docidentifier>
2570
- <date type="published">
2571
- <on>2007</on>
2572
- </date>
2573
- <contributor>
2574
- <role type="publisher"/>
2575
- <organization>
2576
- <name>International Electrotechnical Commission</name>
2577
- <abbreviation>IEC</abbreviation>
2578
- <uri>www.iec.ch</uri>
2579
- </organization>
2580
- </contributor>
2581
- <language>en</language>
2582
- <language>fr</language>
2583
- <script>Latn</script>
2584
- <status>
2585
- <stage>60</stage>
2586
- </status>
2587
- <copyright>
2588
- <from>2018</from>
2589
- <owner>
2731
+ <bibitem type="standard" id="IEC60050-102">
2732
+ <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
2733
+ <docidentifier>IEC 60050-102:2007</docidentifier>
2734
+ <date type="published">
2735
+ <on>2007</on>
2736
+ </date>
2737
+ <contributor>
2738
+ <role type="publisher"/>
2590
2739
  <organization>
2591
2740
  <name>International Electrotechnical Commission</name>
2592
2741
  <abbreviation>IEC</abbreviation>
2593
2742
  <uri>www.iec.ch</uri>
2594
2743
  </organization>
2595
- </owner>
2596
- </copyright>
2597
- </bibitem>
2598
- OUTPUT
2744
+ </contributor>
2745
+ <language>en</language>
2746
+ <language>fr</language>
2747
+ <script>Latn</script>
2748
+ <status>
2749
+ <stage>60</stage>
2750
+ </status>
2751
+ <copyright>
2752
+ <from>2018</from>
2753
+ <owner>
2754
+ <organization>
2755
+ <name>International Electrotechnical Commission</name>
2756
+ <abbreviation>IEC</abbreviation>
2757
+ <uri>www.iec.ch</uri>
2758
+ </organization>
2759
+ </owner>
2760
+ </copyright>
2761
+ </bibitem>
2762
+ OUTPUT
2599
2763
  end
2600
- end
2764
+ end
2601
2765
 
2602
- def mock_iev
2603
- expect(Iecbib::IecBibliography).to receive(:get).with("IEV", nil, {}) do
2766
+ def mock_iev
2767
+ expect(Iecbib::IecBibliography).to receive(:get).with("IEV", nil, {}) do
2604
2768
  IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
2605
- <bibitem type="standard" id="IEC60050:2001">
2606
- <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
2607
- <docidentifier>IEC 60050:2011</docidentifier>
2608
- <date type="published">
2609
- <on>2007</on>
2610
- </date>
2611
- <contributor>
2612
- <role type="publisher"/>
2613
- <organization>
2614
- <name>International Electrotechnical Commission</name>
2615
- <abbreviation>IEC</abbreviation>
2616
- <uri>www.iec.ch</uri>
2617
- </organization>
2618
- </contributor>
2619
- <language>en</language>
2620
- <language>fr</language>
2621
- <script>Latn</script>
2622
- <status>
2623
- <stage>60</stage>
2624
- </status>
2625
- <copyright>
2626
- <from>2018</from>
2627
- <owner>
2769
+ <bibitem type="standard" id="IEC60050:2001">
2770
+ <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
2771
+ <docidentifier>IEC 60050:2011</docidentifier>
2772
+ <date type="published">
2773
+ <on>2007</on>
2774
+ </date>
2775
+ <contributor>
2776
+ <role type="publisher"/>
2628
2777
  <organization>
2629
2778
  <name>International Electrotechnical Commission</name>
2630
2779
  <abbreviation>IEC</abbreviation>
2631
2780
  <uri>www.iec.ch</uri>
2632
2781
  </organization>
2633
- </owner>
2634
- </copyright>
2635
- </bibitem>
2636
- OUTPUT
2782
+ </contributor>
2783
+ <language>en</language>
2784
+ <language>fr</language>
2785
+ <script>Latn</script>
2786
+ <status>
2787
+ <stage>60</stage>
2788
+ </status>
2789
+ <copyright>
2790
+ <from>2018</from>
2791
+ <owner>
2792
+ <organization>
2793
+ <name>International Electrotechnical Commission</name>
2794
+ <abbreviation>IEC</abbreviation>
2795
+ <uri>www.iec.ch</uri>
2796
+ </organization>
2797
+ </owner>
2798
+ </copyright>
2799
+ </bibitem>
2800
+ OUTPUT
2637
2801
  end.at_least :once
2638
- end
2639
-
2802
+ end
2640
2803
  end