metanorma-standoc 1.9.3 → 1.10.2

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