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
@@ -1,42 +1,45 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe Asciidoctor::Standoc do
4
- it "handles spacing around markup" do
5
- expect((strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to (<<~"OUTPUT")
4
+ it "handles spacing around markup" do
5
+ input = <<~INPUT
6
6
  #{ASCIIDOC_BLANK_HDR}
7
7
  This is
8
8
  a paragraph with <<x>>
9
9
  markup _for_
10
10
  text, including **__nest__**ed markup.
11
- INPUT
12
- <?xml version="1.0" encoding="UTF-8"?>
13
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
14
- <bibdata type="standard">
15
- <title language="en" format="text/plain">Document title</title>
16
- <language>en</language>
17
- <script>Latn</script>
18
- <status>
19
- <stage>published</stage>
20
- </status>
21
- <copyright>
22
- <from>#{Date.today.year}</from>
23
- </copyright>
24
- <ext>
25
- <doctype>article</doctype>
26
- </ext>
27
- </bibdata>
28
- <sections>
29
- <p id="_">This is
30
- a paragraph with <xref target="x"/>
31
- markup <em>for</em>
32
- text, including <strong><em>nest</em></strong>ed markup.</p>
33
- </sections>
34
- </standard-document>
35
- OUTPUT
11
+ INPUT
12
+ output = <<~OUTPUT
13
+ <?xml version="1.0" encoding="UTF-8"?>
14
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
15
+ <bibdata type="standard">
16
+ <title language="en" format="text/plain">Document title</title>
17
+ <language>en</language>
18
+ <script>Latn</script>
19
+ <status>
20
+ <stage>published</stage>
21
+ </status>
22
+ <copyright>
23
+ <from>#{Date.today.year}</from>
24
+ </copyright>
25
+ <ext>
26
+ <doctype>article</doctype>
27
+ </ext>
28
+ </bibdata>
29
+ <sections>
30
+ <p id="_">This is
31
+ a paragraph with <xref target="x"/>
32
+ markup <em>for</em>
33
+ text, including <strong><em>nest</em></strong>ed markup.</p>
34
+ </sections>
35
+ </standard-document>
36
+ OUTPUT
37
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
38
+ .to be_equivalent_to(output)
36
39
  end
37
40
 
38
41
  it "processes inline_quoted formatting" do
39
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
42
+ input = <<~INPUT
40
43
  #{DUMBQUOTE_BLANK_HDR}
41
44
  _Physical noise
42
45
  sources_
@@ -57,187 +60,203 @@ text, including <strong><em>nest</em></strong>ed markup.</p>
57
60
  [smallcap]#smallcap#
58
61
  [keyword]#keyword#
59
62
  INPUT
60
- #{BLANK_HDR}
61
- <sections>
62
- <em>Physical noise sources</em>
63
- <strong>strong</strong>
64
- <tt>monospace</tt>
65
- "double quote"
66
- 'single quote'
67
- super<sup>script</sup>
68
- sub<sub>script</sub>
69
- sub<sub><em>scr</em>ipt</sub>
70
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
71
- mark
72
- <admitted>alt</admitted>
73
- <deprecates>deprecated</deprecates>
74
- <domain>domain</domain>
75
- <strike>strike</strike>
76
- <underline>underline</underline>
77
- <smallcap>smallcap</smallcap>
78
- <keyword>keyword</keyword>
79
- </sections>
80
- </standard-document>
63
+ output = <<~OUTPUT
64
+ #{BLANK_HDR}
65
+ <sections>
66
+ <em>Physical noise sources</em>
67
+ <strong>strong</strong>
68
+ <tt>monospace</tt>
69
+ "double quote"
70
+ 'single quote'
71
+ super<sup>script</sup>
72
+ sub<sub>script</sub>
73
+ sub<sub><em>scr</em>ipt</sub>
74
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
75
+ mark
76
+ <admitted>alt</admitted>
77
+ <deprecates>deprecated</deprecates>
78
+ <domain>domain</domain>
79
+ <strike>strike</strike>
80
+ <underline>underline</underline>
81
+ <smallcap>smallcap</smallcap>
82
+ <keyword>keyword</keyword>
83
+ </sections>
84
+ </standard-document>
81
85
  OUTPUT
86
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
87
+ .to be_equivalent_to(output)
82
88
  end
83
89
 
84
90
  it "process mtext spaces" do
85
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
91
+ input = <<~INPUT
86
92
  #{DUMBQUOTE_BLANK_HDR}
87
93
 
88
94
  stem:[n < 1 " for all text "]
89
- INPUT
90
- #{BLANK_HDR}
91
- <sections>
92
- <p id='_'>
93
- <stem type='MathML'>
94
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
95
- <mi>n</mi>
96
- <mo/>
97
- <mn>1</mn>
98
- <mtext> for all text </mtext>
99
- </math>
100
- </stem>
101
- </p>
102
- </sections>
103
- </standard-document>
104
- OUTPUT
95
+ INPUT
96
+ output = <<~OUTPUT
97
+ #{BLANK_HDR}
98
+ <sections>
99
+ <p id='_'>
100
+ <stem type='MathML'>
101
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
102
+ <mi>n</mi>
103
+ <mo/>
104
+ <mn>1</mn>
105
+ <mtext> for all text </mtext>
106
+ </math>
107
+ </stem>
108
+ </p>
109
+ </sections>
110
+ </standard-document>
111
+ OUTPUT
112
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
113
+ .to be_equivalent_to(output)
105
114
  end
106
115
 
107
116
  it "properly handles inline substitution" do
108
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
117
+ input = <<~INPUT
109
118
  #{DUMBQUOTE_BLANK_HDR}
110
119
 
111
120
  stem:[n < 1] +
112
121
  latexmath:[n < 1]
113
122
  stem:["&#x200c;"^199 "Hg"^+]
114
- INPUT
115
- #{BLANK_HDR}
116
- <sections>
117
- <p id="_">
118
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo>&lt;</mo><mn>1</mn></math></stem><br/>
119
- <stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo>&lt;</mo> <mn>1</mn> </mrow> </math></stem>
120
- <stem type='MathML'>
121
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
122
- <msup>
123
- <mrow>
124
- <mtext>‌</mtext>
125
- </mrow>
126
- <mrow>
127
- <mn>199</mn>
128
- </mrow>
129
- </msup>
130
- <msup>
131
- <mrow>
132
- <mtext>Hg</mtext>
133
- </mrow>
134
- <mrow>
135
- <mo>+</mo>
136
- </mrow>
137
- </msup>
138
- </math>
139
- </stem>
140
- </p>
141
- </sections>
142
- </standard-document>
143
- OUTPUT
123
+ INPUT
124
+ output = <<~OUTPUT
125
+ #{BLANK_HDR}
126
+ <sections>
127
+ <p id="_">
128
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo>&lt;</mo><mn>1</mn></math></stem><br/>
129
+ <stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo>&lt;</mo> <mn>1</mn> </mrow> </math></stem>
130
+ <stem type='MathML'>
131
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
132
+ <msup>
133
+ <mrow>
134
+ <mtext>‌</mtext>
135
+ </mrow>
136
+ <mrow>
137
+ <mn>199</mn>
138
+ </mrow>
139
+ </msup>
140
+ <msup>
141
+ <mrow>
142
+ <mtext>Hg</mtext>
143
+ </mrow>
144
+ <mrow>
145
+ <mo>+</mo>
146
+ </mrow>
147
+ </msup>
148
+ </math>
149
+ </stem>
150
+ </p>
151
+ </sections>
152
+ </standard-document>
153
+ OUTPUT
154
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
155
+ .to be_equivalent_to(output)
144
156
  end
145
157
 
146
158
  it "normalises inline stem, straight quotes" do
147
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
159
+ input = <<~INPUT
148
160
  #{DUMBQUOTE_BLANK_HDR}
149
161
 
150
162
  stem:[n < 1]
151
163
  latexmath:[n < 1]
152
164
  stem:["&#x200c;"^199 "Hg"^+]
153
- INPUT
154
- #{BLANK_HDR}
155
- <sections>
156
- <p id="_">
157
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo>&lt;</mo><mn>1</mn></math></stem>
158
- <stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo>&lt;</mo> <mn>1</mn> </mrow> </math></stem>
159
- <stem type='MathML'>
160
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
161
- <msup>
162
- <mrow>
163
- <mtext>‌</mtext>
164
- </mrow>
165
- <mrow>
166
- <mn>199</mn>
167
- </mrow>
168
- </msup>
169
- <msup>
170
- <mrow>
171
- <mtext>Hg</mtext>
172
- </mrow>
173
- <mrow>
174
- <mo>+</mo>
175
- </mrow>
176
- </msup>
177
- </math>
178
- </stem>
179
- </p>
180
- </sections>
181
- </standard-document>
182
- OUTPUT
165
+ INPUT
166
+ output = <<~OUTPUT
167
+ #{BLANK_HDR}
168
+ <sections>
169
+ <p id="_">
170
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo>&lt;</mo><mn>1</mn></math></stem>
171
+ <stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo>&lt;</mo> <mn>1</mn> </mrow> </math></stem>
172
+ <stem type='MathML'>
173
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
174
+ <msup>
175
+ <mrow>
176
+ <mtext>‌</mtext>
177
+ </mrow>
178
+ <mrow>
179
+ <mn>199</mn>
180
+ </mrow>
181
+ </msup>
182
+ <msup>
183
+ <mrow>
184
+ <mtext>Hg</mtext>
185
+ </mrow>
186
+ <mrow>
187
+ <mo>+</mo>
188
+ </mrow>
189
+ </msup>
190
+ </math>
191
+ </stem>
192
+ </p>
193
+ </sections>
194
+ </standard-document>
195
+ OUTPUT
196
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
197
+ .to be_equivalent_to(output)
183
198
  end
184
199
 
185
200
  it "normalises inline stem, smart quotes" do
186
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
201
+ input = <<~INPUT
187
202
  #{ASCIIDOC_BLANK_HDR}
188
203
 
189
204
  stem:[n < 1]
190
205
  latexmath:[n < 1]
191
206
  stem:["&#x200c;"^199 "Hg"^+]
192
- INPUT
193
- #{BLANK_HDR}
194
- <sections>
195
- <p id="_">
196
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo>&lt;</mo><mn>1</mn></math></stem>
197
- <stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo>&lt;</mo> <mn>1</mn> </mrow> </math></stem>
198
- <stem type='MathML'>
199
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
200
- <msup>
201
- <mrow>
202
- <mtext>‌</mtext>
203
- </mrow>
204
- <mrow>
205
- <mn>199</mn>
206
- </mrow>
207
- </msup>
208
- <msup>
209
- <mrow>
210
- <mtext>Hg</mtext>
211
- </mrow>
212
- <mrow>
213
- <mo>+</mo>
214
- </mrow>
215
- </msup>
216
- </math>
217
- </stem>
218
- </p>
219
- </sections>
220
- </standard-document>
221
- OUTPUT
207
+ INPUT
208
+ output = <<~OUTPUT
209
+ #{BLANK_HDR}
210
+ <sections>
211
+ <p id="_">
212
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo>&lt;</mo><mn>1</mn></math></stem>
213
+ <stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo>&lt;</mo> <mn>1</mn> </mrow> </math></stem>
214
+ <stem type='MathML'>
215
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
216
+ <msup>
217
+ <mrow>
218
+ <mtext>‌</mtext>
219
+ </mrow>
220
+ <mrow>
221
+ <mn>199</mn>
222
+ </mrow>
223
+ </msup>
224
+ <msup>
225
+ <mrow>
226
+ <mtext>Hg</mtext>
227
+ </mrow>
228
+ <mrow>
229
+ <mo>+</mo>
230
+ </mrow>
231
+ </msup>
232
+ </math>
233
+ </stem>
234
+ </p>
235
+ </sections>
236
+ </standard-document>
237
+ OUTPUT
238
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
239
+ .to be_equivalent_to(output)
222
240
  end
223
241
 
224
-
225
242
  it "generates desired smart quotes for 'dd'" do
226
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
243
+ input = <<~INPUT
227
244
  #{ASCIIDOC_BLANK_HDR}
228
245
  '99'.
229
246
 
230
247
  INPUT
231
- #{BLANK_HDR}
232
- <sections><p id="_">‘99’.</p>
233
- </sections>
234
- </standard-document>
248
+ output = <<~OUTPUT
249
+ #{BLANK_HDR}
250
+ <sections><p id="_">‘99’.</p>
251
+ </sections>
252
+ </standard-document>
235
253
  OUTPUT
254
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
255
+ .to be_equivalent_to(output)
236
256
  end
237
257
 
238
-
239
258
  it "processes breaks" do
240
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
259
+ input = <<~INPUT
241
260
  #{ASCIIDOC_BLANK_HDR}
242
261
  Line break +
243
262
  line break
@@ -252,55 +271,70 @@ OUTPUT
252
271
  [%portrait]
253
272
  <<<
254
273
  INPUT
255
- #{BLANK_HDR}
256
- <sections><p id="_">Line break<br/>
257
- line break</p>
258
- <hr/>
259
- <pagebreak/>
260
- <pagebreak orientation="landscape"/>
261
- <pagebreak orientation="portrait"/>
262
- </sections>
263
- </standard-document>
274
+ output = <<~OUTPUT
275
+ #{BLANK_HDR}
276
+ <sections><p id="_">Line break<br/>
277
+ line break</p>
278
+ <hr/>
279
+ <pagebreak/>
280
+ <pagebreak orientation="landscape"/>
281
+ <pagebreak orientation="portrait"/>
282
+ </sections>
283
+ </standard-document>
264
284
  OUTPUT
285
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
286
+ .to be_equivalent_to(output)
265
287
  end
266
288
 
267
289
  it "processes links" do
268
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
290
+ input = <<~INPUT
269
291
  #{ASCIIDOC_BLANK_HDR}
270
292
  mailto:fred@example.com
271
293
  http://example.com[]
272
294
  http://example.com[Link]
273
295
  http://example.com[Link,title="tip"]
274
296
  link:++https://asciidoctor.org/now_this__link_works.html++[]
297
+ http://example.com[Link,updatetype=true]
298
+ link:../example[updatetype=true]
299
+ link:../example[Link,updatetype=true]
275
300
  INPUT
276
- #{BLANK_HDR}
277
- <sections>
278
- <p id="_">mailto:fred@example.com
279
- <link target="http://example.com"/>
280
- <link target="http://example.com">Link</link>
281
- <link target="http://example.com" alt="tip">Link</link>
282
- <link target='https://asciidoctor.org/now_this__link_works.html'/>
283
- </p>
284
- </sections>
285
- </standard-document>
301
+ output = <<~OUTPUT
302
+ #{BLANK_HDR}
303
+ <sections>
304
+ <p id="_">mailto:fred@example.com
305
+ <link target="http://example.com"/>
306
+ <link target="http://example.com">Link</link>
307
+ <link target="http://example.com" alt="tip">Link</link>
308
+ <link target='https://asciidoctor.org/now_this__link_works.html'/>
309
+ <link target="http://example.com" updatetype="true">Link</link>
310
+ <link target="../example" updatetype="true"/>
311
+ <link target="../example" updatetype="true">Link</link></p>
312
+ </p>
313
+ </sections>
314
+ </standard-document>
286
315
  OUTPUT
316
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
317
+ .to be_equivalent_to(output)
287
318
  end
288
319
 
289
- it "processes bookmarks" do
290
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
320
+ it "processes bookmarks" do
321
+ input = <<~INPUT
291
322
  #{ASCIIDOC_BLANK_HDR}
292
323
  Text [[bookmark]] Text
293
324
  INPUT
294
- #{BLANK_HDR}
295
- <sections>
296
- <p id="_">Text <bookmark id="bookmark"/> Text</p>
297
- </sections>
298
- </standard-document>
325
+ output = <<~OUTPUT
326
+ #{BLANK_HDR}
327
+ <sections>
328
+ <p id="_">Text <bookmark id="bookmark"/> Text</p>
329
+ </sections>
330
+ </standard-document>
299
331
  OUTPUT
300
- end
332
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
333
+ .to be_equivalent_to(output)
334
+ end
301
335
 
302
- it "processes crossreferences" do
303
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
336
+ it "processes crossreferences" do
337
+ input = <<~INPUT
304
338
  #{ASCIIDOC_BLANK_HDR}
305
339
  [[reference]]
306
340
  == Section
@@ -318,39 +352,45 @@ OUTPUT
318
352
  Lowercase Footnoted Reference to <<reference,droploc%fn>>
319
353
  Capitalised Reference to <<reference,droploc%capital%>>
320
354
  Lowercase Footnoted Reference to <<reference,droploc%capital%fn>>
355
+ Lowercase Footnoted Reference to <<reference,droploc%capital%text>>
321
356
  INPUT
322
- #{BLANK_HDR}
323
- <sections>
324
- <clause id="reference" inline-header="false" obligation="normative">
325
- <title>Section</title>
326
- <p id="_">Inline Reference to <xref target="reference"/>
327
- Footnoted Reference to <xref target="reference"/>
328
- Inline Reference with Text to <xref target="reference">text</xref>
329
- Footnoted Reference with Text to <xref target="reference">text</xref>
330
- Anchored Crossreference to other document <xref target="a#b"/>
331
- Capitalised Reference to <xref target='reference' case='capital' droploc="true"></xref>
332
- Lowercase Footnoted Reference to <xref target='reference' case='capital' droploc="true"></xref>
333
- Capitalised Reference to
334
- <xref target='reference' case='capital'/>
335
- Lowercase Footnoted Reference to
336
- <xref target='reference' case='capital'/>
337
- Capitalised Reference to
338
- <xref target='reference' droploc='true'/>
339
- Lowercase Footnoted Reference to
340
- <xref target='reference' droploc='true'/>
341
- Capitalised Reference to
342
- <xref target='reference' case='capital' droploc='true'/>
343
- Lowercase Footnoted Reference to
344
- <xref target='reference' case='capital' droploc='true'/>
345
- </p>
346
- </clause>
347
- </sections>
348
- </standard-document>
349
- OUTPUT
350
- end
357
+ output = <<~OUTPUT
358
+ #{BLANK_HDR}
359
+ <sections>
360
+ <clause id="reference" inline-header="false" obligation="normative">
361
+ <title>Section</title>
362
+ <p id="_">Inline Reference to <xref target="reference"/>
363
+ Footnoted Reference to <xref target="reference"/>
364
+ Inline Reference with Text to <xref target="reference">text</xref>
365
+ Footnoted Reference with Text to <xref target="reference">text</xref>
366
+ Anchored Crossreference to other document <xref target="a#b"/>
367
+ Capitalised Reference to <xref target='reference' case='capital' droploc="true"></xref>
368
+ Lowercase Footnoted Reference to <xref target='reference' case='capital' droploc="true"></xref>
369
+ Capitalised Reference to
370
+ <xref target='reference' case='capital'/>
371
+ Lowercase Footnoted Reference to
372
+ <xref target='reference' case='capital'/>
373
+ Capitalised Reference to
374
+ <xref target='reference' droploc='true'/>
375
+ Lowercase Footnoted Reference to
376
+ <xref target='reference' droploc='true'/>
377
+ Capitalised Reference to
378
+ <xref target='reference' case='capital' droploc='true'/>
379
+ Lowercase Footnoted Reference to
380
+ <xref target='reference' case='capital' droploc='true'/>
381
+ Lowercase Footnoted Reference to
382
+ <xref target='reference' case='capital' droploc='true'>text</xref>
383
+ </p>
384
+ </clause>
385
+ </sections>
386
+ </standard-document>
387
+ OUTPUT
388
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
389
+ .to be_equivalent_to(output)
390
+ end
351
391
 
352
- it "processes bibliographic anchors" do
353
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
392
+ it "processes bibliographic anchors" do
393
+ input = <<~INPUT
354
394
  #{ASCIIDOC_BLANK_HDR}
355
395
  [bibliography]
356
396
  == Normative References
@@ -359,29 +399,32 @@ OUTPUT
359
399
  * [[[ISO713]]] Reference
360
400
 
361
401
  INPUT
362
- #{BLANK_HDR}
363
- <sections>
402
+ output = <<~OUTPUT
403
+ #{BLANK_HDR}
404
+ <sections>
364
405
 
365
- </sections><bibliography><references id="_" obligation="informative" normative="true">
366
- <title>Normative references</title>
367
- <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
368
- <bibitem id="ISO712">
369
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
370
- <docidentifier>x</docidentifier>
371
- </bibitem>
372
- <bibitem id="ISO713">
373
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
374
- <docidentifier>ISO713</docidentifier>
375
- <docnumber>713</docnumber>
376
- </bibitem>
377
- </references>
378
- </bibliography>
379
- </standard-document>
406
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
407
+ <title>Normative references</title>
408
+ <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
409
+ <bibitem id="ISO712">
410
+ <formattedref format="application/x-isodoc+xml">Reference</formattedref>
411
+ <docidentifier>x</docidentifier>
412
+ </bibitem>
413
+ <bibitem id="ISO713">
414
+ <formattedref format="application/x-isodoc+xml">Reference</formattedref>
415
+ <docidentifier>ISO713</docidentifier>
416
+ <docnumber>713</docnumber>
417
+ </bibitem>
418
+ </references>
419
+ </bibliography>
420
+ </standard-document>
380
421
  OUTPUT
422
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
423
+ .to be_equivalent_to(output)
381
424
  end
382
425
 
383
426
  it "processes footnotes" do
384
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
427
+ input = <<~INPUT
385
428
  #{ASCIIDOC_BLANK_HDR}
386
429
  Hello!footnote:[Footnote text]
387
430
 
@@ -389,48 +432,52 @@ OUTPUT
389
432
 
390
433
  Hello.footnote:abc[This is a repeated footnote]
391
434
 
392
- Repetition.footnote:abc[]
435
+ Repetition.footnote:abc[]
393
436
  INPUT
394
- #{BLANK_HDR}
395
- <preface><foreword id="_" obligation="informative">
396
- <title>Foreword</title>
397
- <p id="_">Hello!<fn reference="1">
398
- <p id="_">Footnote text</p>
399
- </fn></p>
400
- </foreword></preface><sections>
401
- <clause id="_" inline-header="false" obligation="normative">
402
- <title>Title<fn reference="2">
403
- <p id="_">Footnote text 2</p>
404
- </fn></title>
405
- <p id='_'>
406
- Hello.
407
- <fn reference='3'>
408
- <p id='_'>This is a repeated footnote</p>
409
- </fn>
410
- </p>
411
- <p id='_'>
412
- Repetition.
413
- <fn reference='3'>
414
- <p id='_'>This is a repeated footnote</p>
415
- </fn>
416
- </p>
417
- </clause></sections>
418
- </standard-document>
437
+ output = <<~OUTPUT
438
+ #{BLANK_HDR}
439
+ <preface><foreword id="_" obligation="informative">
440
+ <title>Foreword</title>
441
+ <p id="_">Hello!<fn reference="1">
442
+ <p id="_">Footnote text</p>
443
+ </fn></p>
444
+ </foreword></preface><sections>
445
+ <clause id="_" inline-header="false" obligation="normative">
446
+ <title>Title<fn reference="2">
447
+ <p id="_">Footnote text 2</p>
448
+ </fn></title>
449
+ <p id='_'>
450
+ Hello.
451
+ <fn reference='3'>
452
+ <p id='_'>This is a repeated footnote</p>
453
+ </fn>
454
+ </p>
455
+ <p id='_'>
456
+ Repetition.
457
+ <fn reference='3'>
458
+ <p id='_'>This is a repeated footnote</p>
459
+ </fn>
460
+ </p>
461
+ </clause></sections>
462
+ </standard-document>
419
463
  OUTPUT
464
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
465
+ .to be_equivalent_to(output)
420
466
  end
421
467
 
422
- it "processes index terms" do
423
- expect((strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to (<<~"OUTPUT")
468
+ it "processes index terms" do
469
+ input = <<~INPUT
424
470
  #{ASCIIDOC_BLANK_HDR}
425
471
  ((See)) Index ((_term_)) and(((A~B~, stem:[alpha], &#x2c80;))).
426
- INPUT
427
- #{BLANK_HDR}
428
- <sections>
429
- <p id="_">See<index><primary>See</primary></index> Index <em>term</em><index><primary><em>term</em></primary></index> and<index><primary>A<sub>B</sub></primary><secondary><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>α</mi></math></stem></secondary><tertiary>Ⲁ</tertiary></index>.</p>
430
- </sections>
431
- </standard-document>
432
- OUTPUT
472
+ INPUT
473
+ output = <<~OUTPUT
474
+ #{BLANK_HDR}
475
+ <sections>
476
+ <p id="_">See<index><primary>See</primary></index> Index <em>term</em><index><primary><em>term</em></primary></index> and<index><primary>A<sub>B</sub></primary><secondary><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>α</mi></math></stem></secondary><tertiary>Ⲁ</tertiary></index>.</p>
477
+ </sections>
478
+ </standard-document>
479
+ OUTPUT
480
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
481
+ .to be_equivalent_to(output)
433
482
  end
434
-
435
-
436
483
  end