metanorma-standoc 1.9.3 → 1.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,32 @@ 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>
1512
1626
  OUTPUT
1627
+ expect(Asciidoctor::Standoc::Converter.new(nil, *OPTIONS)
1628
+ .cleanup(Nokogiri::XML(input)).to_xml)
1629
+ .to be_equivalent_to xmlpp(output)
1513
1630
  end
1514
1631
 
1515
1632
  it "renumbers numeric references in Bibliography sequentially" do
1516
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1633
+ input = <<~INPUT
1517
1634
  #{ASCIIDOC_BLANK_HDR}
1518
1635
 
1519
1636
  == Clause
@@ -1526,6 +1643,7 @@ RSpec.describe Asciidoctor::Standoc do
1526
1643
  * [[[iso124,ISO 124]]] _Standard 124_
1527
1644
  * [[[iso123,1]]] _Standard 123_
1528
1645
  INPUT
1646
+ output = <<~OUTPUT
1529
1647
  #{BLANK_HDR}
1530
1648
  <sections><clause id="_" inline-header="false" obligation="normative">
1531
1649
  <title>Clause</title>
@@ -1554,10 +1672,12 @@ RSpec.describe Asciidoctor::Standoc do
1554
1672
  </references></bibliography>
1555
1673
  </standard-document>
1556
1674
  OUTPUT
1675
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1676
+ .to be_equivalent_to xmlpp(output)
1557
1677
  end
1558
1678
 
1559
1679
  it "renumbers numeric references in Bibliography subclauses sequentially" do
1560
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1680
+ input = <<~INPUT
1561
1681
  #{ASCIIDOC_BLANK_HDR}
1562
1682
 
1563
1683
  == Clause
@@ -1588,6 +1708,7 @@ RSpec.describe Asciidoctor::Standoc do
1588
1708
  * [[[iso128,1]]] _Standard 123_
1589
1709
 
1590
1710
  INPUT
1711
+ output = <<~OUTPUT
1591
1712
  #{BLANK_HDR}
1592
1713
  <sections><clause id="_" inline-header="false" obligation="normative">
1593
1714
  <title>Clause</title>
@@ -1660,10 +1781,12 @@ RSpec.describe Asciidoctor::Standoc do
1660
1781
  </references></clause></bibliography>
1661
1782
  </standard-document>
1662
1783
  OUTPUT
1784
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1785
+ .to be_equivalent_to xmlpp(output)
1663
1786
  end
1664
1787
 
1665
1788
  it "removes bibdata bibitem IDs" do
1666
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1789
+ input = <<~INPUT
1667
1790
  = Document title
1668
1791
  Author
1669
1792
  :docfile: test.adoc
@@ -1676,6 +1799,7 @@ RSpec.describe Asciidoctor::Standoc do
1676
1799
  == Normative References
1677
1800
 
1678
1801
  INPUT
1802
+ output = <<~OUTPUT
1679
1803
  <?xml version='1.0' encoding='UTF-8'?>
1680
1804
  <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1681
1805
  <bibdata type='standard'>
@@ -1707,10 +1831,12 @@ RSpec.describe Asciidoctor::Standoc do
1707
1831
  </bibliography>
1708
1832
  </standard-document>
1709
1833
  OUTPUT
1834
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1835
+ .to be_equivalent_to xmlpp(output)
1710
1836
  end
1711
1837
 
1712
1838
  it "imports boilerplate file" do
1713
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1839
+ input = <<~INPUT
1714
1840
  = Document title
1715
1841
  Author
1716
1842
  :docfile: test.adoc
@@ -1723,6 +1849,7 @@ RSpec.describe Asciidoctor::Standoc do
1723
1849
  == Clause 1
1724
1850
 
1725
1851
  INPUT
1852
+ output = <<~OUTPUT
1726
1853
  <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1727
1854
  <bibdata type='standard'>
1728
1855
  <title language='en' format='text/plain'>Document title</title>
@@ -1748,23 +1875,26 @@ RSpec.describe Asciidoctor::Standoc do
1748
1875
  </sections>
1749
1876
  </standard-document>
1750
1877
  OUTPUT
1878
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1879
+ .to be_equivalent_to xmlpp(output)
1751
1880
  end
1752
1881
 
1753
1882
  it "sorts symbols lists" do
1754
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1755
- #{ASCIIDOC_BLANK_HDR}
1756
-
1757
- [[L]]
1758
- == Symbols and abbreviated terms
1759
-
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
1883
+ input = <<~INPUT
1884
+ #{ASCIIDOC_BLANK_HDR}
1885
+
1886
+ [[L]]
1887
+ == Symbols and abbreviated terms
1888
+
1889
+ α:: Definition 1
1890
+ Xa:: Definition 2
1891
+ x_1_:: Definition 3
1892
+ x_m_:: Definition 4
1893
+ x:: Definition 5
1894
+ stem:[n]:: Definition 6
1895
+ m:: Definition 7
1767
1896
  INPUT
1897
+ output = <<~OUTPUT
1768
1898
  #{BLANK_HDR}
1769
1899
  <sections>
1770
1900
  <definitions id='L' obligation="normative">
@@ -1809,21 +1939,24 @@ RSpec.describe Asciidoctor::Standoc do
1809
1939
  </sections>
1810
1940
  </standard-document>
1811
1941
  OUTPUT
1942
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1943
+ .to be_equivalent_to xmlpp(output)
1812
1944
  end
1813
1945
 
1814
1946
  it "sorts symbols lists" do
1815
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1816
- #{ASCIIDOC_BLANK_HDR}
1947
+ input = <<~INPUT
1948
+ #{ASCIIDOC_BLANK_HDR}
1817
1949
 
1818
- [[L]]
1819
- == Symbols and abbreviated terms
1950
+ [[L]]
1951
+ == Symbols and abbreviated terms
1820
1952
 
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
1953
+ stem:[alpha]:: Definition 1
1954
+ xa:: Definition 2
1955
+ stem:[x_1]:: Definition 3
1956
+ stem:[x_m]:: Definition 4
1957
+ x:: Definition 5
1826
1958
  INPUT
1959
+ output = <<~OUTPUT
1827
1960
  #{BLANK_HDR}
1828
1961
  <sections>
1829
1962
  <definitions id='L' obligation="normative">
@@ -1882,10 +2015,12 @@ RSpec.describe Asciidoctor::Standoc do
1882
2015
  </sections>
1883
2016
  </standard-document>
1884
2017
  OUTPUT
2018
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2019
+ .to be_equivalent_to xmlpp(output)
1885
2020
  end
1886
2021
 
1887
2022
  it "moves inherit macros to correct location" do
1888
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2023
+ input = <<~INPUT
1889
2024
  #{ASCIIDOC_BLANK_HDR}
1890
2025
 
1891
2026
  == Clause
@@ -1920,6 +2055,7 @@ RSpec.describe Asciidoctor::Standoc do
1920
2055
 
1921
2056
 
1922
2057
  INPUT
2058
+ output = <<~OUTPUT
1923
2059
  #{BLANK_HDR}
1924
2060
  <sections>
1925
2061
  <clause id='_' inline-header='false' obligation='normative'>
@@ -1962,74 +2098,79 @@ RSpec.describe Asciidoctor::Standoc do
1962
2098
  </sections>
1963
2099
  </standard-document>
1964
2100
  OUTPUT
2101
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2102
+ .to be_equivalent_to xmlpp(output)
1965
2103
  end
1966
2104
 
1967
2105
  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}
2106
+ input = <<~INPUT
2107
+ #{ASCIIDOC_BLANK_HDR}
1970
2108
 
1971
- .Foreword
1972
- Foreword
2109
+ .Foreword
2110
+ Foreword
1973
2111
 
1974
- [NOTE,beforeclauses=true]
1975
- ====
1976
- Note which is very important
1977
- ====
2112
+ [NOTE,beforeclauses=true]
2113
+ ====
2114
+ Note which is very important
2115
+ ====
1978
2116
 
1979
- == Introduction
1980
- Introduction
2117
+ == Introduction
2118
+ Introduction
1981
2119
 
1982
- == Scope
1983
- Scope statement
2120
+ == Scope
2121
+ Scope statement
1984
2122
 
1985
- [IMPORTANT,beforeclauses=true]
1986
- ====
1987
- Notice which is very important
1988
- ====
2123
+ [IMPORTANT,beforeclauses=true]
2124
+ ====
2125
+ Notice which is very important
2126
+ ====
1989
2127
  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>
2128
+ output = <<~OUTPUT
2129
+ #{BLANK_HDR}
2130
+ <preface>
2131
+ <note id='_'>
2132
+ <p id='_'>Note which is very important</p>
2133
+ </note>
2134
+ <foreword id='_' obligation='informative'>
2135
+ <title>Foreword</title>
2136
+ <p id='_'>Foreword</p>
2137
+ </foreword>
2138
+ <introduction id='_' obligation='informative'>
2139
+ <title>Introduction</title>
2140
+ <p id='_'>Introduction</p>
2141
+ </introduction>
2142
+ </preface>
2143
+ <sections>
2144
+ <admonition id='_' type='important'>
2145
+ <p id='_'>Notice which is very important</p>
2146
+ </admonition>
2147
+ <clause id='_' inline-header='false' obligation='normative' type="scope">
2148
+ <title>Scope</title>
2149
+ <p id='_'>Scope statement</p>
2150
+ </clause>
2151
+ </sections>
2152
+ </standard-document>
2014
2153
  OUTPUT
2154
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2155
+ .to be_equivalent_to xmlpp(output)
2015
2156
  end
2016
2157
 
2017
2158
  it "fixes illegal anchors" do
2018
2159
  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!>>
2160
+ #{ASCIIDOC_BLANK_HDR}
2161
+
2162
+ [[a:b]]
2163
+ == A
2164
+ <</:ab>>
2165
+ <<:>>
2166
+ <<1>>
2167
+ <<1:>>
2168
+ <<1#b>>
2169
+ <<:a#b:>>
2170
+ <</%ab>>
2171
+ <<1!>>
2031
2172
  INPUT
2032
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS).gsub(/<p id="_[^"]+">/, "").gsub("</p>", ""))).to be_equivalent_to (<<~"OUTPUT")
2173
+ output = <<~OUTPUT
2033
2174
  <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
2034
2175
  <bibdata type='standard'>
2035
2176
  <title language='en' format='text/plain'>Document title</title>
@@ -2067,25 +2208,40 @@ RSpec.describe Asciidoctor::Standoc do
2067
2208
  </bibliography>
2068
2209
  </standard-document>
2069
2210
  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
2211
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)
2212
+ .gsub(/<p id="_[^"]+">/, "").gsub("</p>", "")))
2213
+ .to be_equivalent_to(output)
2214
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2215
+ .to output(%r{normalised identifier in <clause id="a_b" inline-header="false" obligation="normative"/> from a:b})
2216
+ .to_stderr
2217
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2218
+ .to output(%r{normalised identifier in <eref bibitemid="__ab" citeas=""/> from /_ab})
2219
+ .to_stderr
2220
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2221
+ .to output(%r{normalised identifier in <xref target="_"/> from :})
2222
+ .to_stderr
2223
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2224
+ .to output(%r{normalised identifier in <xref target="_1"/> from 1})
2225
+ .to_stderr
2226
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2227
+ .to output(%r{normalised identifier in <xref target="_1_"/> from 1:})
2228
+ .to_stderr
2229
+ expect { Asciidoctor.convert(input, *OPTIONS) }
2230
+ .to output(%r{normalised identifier in <xref target="_a#b_"/> from :a#b:})
2231
+ .to_stderr
2076
2232
  end
2077
2233
 
2078
2234
  it "moves title footnotes to bibdata" do
2079
2235
  input = <<~INPUT
2080
- = Document title footnote:[ABC] footnote:[DEF]
2081
- Author
2082
- :docfile: test.adoc
2083
- :nodoc:
2084
- :novalid:
2085
- :no-isobib:
2236
+ = Document title footnote:[ABC] footnote:[DEF]
2237
+ Author
2238
+ :docfile: test.adoc
2239
+ :nodoc:
2240
+ :novalid:
2241
+ :no-isobib:
2086
2242
 
2087
2243
  INPUT
2088
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2244
+ output = <<~OUTPUT
2089
2245
  <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
2090
2246
  <bibdata type='standard'>
2091
2247
  <title language='en' format='text/plain'>Document title</title>
@@ -2110,289 +2266,304 @@ RSpec.describe Asciidoctor::Standoc do
2110
2266
  <sections> </sections>
2111
2267
  </standard-document>
2112
2268
  OUTPUT
2269
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
2270
+ .to be_equivalent_to xmlpp(output)
2113
2271
  end
2114
2272
 
2115
2273
  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
- ++++
2274
+ input = <<~INPUT
2275
+ = Document title
2276
+ Author
2277
+ :stem:
2278
+
2279
+ [stem]
2280
+ ++++
2281
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2282
+ <mrow>
2283
+ <mn>7</mn>
2284
+ <mtext>unitsml(m*kg^-2)</mtext>
2285
+ <mo>+</mo>
2286
+ <mn>8</mn>
2287
+ <mtext>unitsml(m*kg^-2)</mtext>
2288
+ </mrow>
2289
+ </math>
2290
+ ++++
2133
2291
  INPUT
2292
+ output = <<~OUTPUT
2134
2293
  #{BLANK_HDR}
2135
2294
  <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>
2295
+ <UnitsML xmlns='https://schema.unitsml.org/unitsml/1.0'>
2296
+ <UnitSet>
2297
+ <Unit xml:id='U_m.kg-2' dimensionURL='#D_LM-2'>
2298
+ <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
2299
+ <UnitName xml:lang='en'>m*kg^-2</UnitName>
2300
+ <UnitSymbol type='HTML'>
2301
+ m&#160;kg
2302
+ <sup>&#8722;2</sup>
2303
+ </UnitSymbol>
2304
+ <UnitSymbol type='MathML'>
2305
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2306
+ <mrow>
2307
+ <mi mathvariant='normal'>m</mi>
2308
+ <mo rspace='thickmathspace'>&#8290;</mo>
2309
+ <msup>
2310
+ <mrow>
2311
+ <mi mathvariant='normal'>kg</mi>
2204
2312
  </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>
2313
+ <mrow>
2314
+ <mo>&#8722;</mo>
2315
+ <mn>2</mn>
2220
2316
  </mrow>
2317
+ </msup>
2318
+ </mrow>
2319
+ </math>
2320
+ </UnitSymbol>
2321
+ <RootUnits>
2322
+ <EnumeratedRootUnit unit='meter'/>
2323
+ <EnumeratedRootUnit unit='gram' prefix='k' powerNumerator='-2'/>
2324
+ </RootUnits>
2325
+ </Unit>
2326
+ </UnitSet>
2327
+ <DimensionSet>
2328
+ <Dimension xml:id='D_LM-2'>
2329
+ <Length symbol='L' powerNumerator='1'/>
2330
+ <Mass symbol='M' powerNumerator='-2'/>
2331
+ </Dimension>
2332
+ </DimensionSet>
2333
+ <PrefixSet>
2334
+ <Prefix prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
2335
+ <PrefixName xml:lang='en'>kilo</PrefixName>
2336
+ <PrefixSymbol type='ASCII'>k</PrefixSymbol>
2337
+ <PrefixSymbol type='unicode'>k</PrefixSymbol>
2338
+ <PrefixSymbol type='LaTeX'>k</PrefixSymbol>
2339
+ <PrefixSymbol type='HTML'>k</PrefixSymbol>
2340
+ </Prefix>
2341
+ </PrefixSet>
2342
+ </UnitsML>
2343
+ </misc-container>
2344
+ <sections>
2345
+ <formula id='_'>
2346
+ <stem type='MathML'>
2347
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2348
+ <mrow>
2349
+ <mn>7</mn>
2350
+ <mo rspace='thickmathspace'>&#8290;</mo>
2351
+ <mrow xref='U_m.kg-2'>
2352
+ <mi mathvariant='normal'>m</mi>
2353
+ <mo rspace='thickmathspace'>&#8290;</mo>
2354
+ <msup>
2355
+ <mrow>
2356
+ <mi mathvariant='normal'>kg</mi>
2221
2357
  </mrow>
2222
- </math>
2223
- </stem>
2224
- </formula>
2225
- </sections>
2226
- </standard-document>
2358
+ <mrow>
2359
+ <mo>&#8722;</mo>
2360
+ <mn>2</mn>
2361
+ </mrow>
2362
+ </msup>
2363
+ </mrow>
2364
+ <mo>+</mo>
2365
+ <mn>8</mn>
2366
+ <mo rspace='thickmathspace'>&#8290;</mo>
2367
+ <mrow xref='U_m.kg-2'>
2368
+ <mi mathvariant='normal'>m</mi>
2369
+ <mo rspace='thickmathspace'>&#8290;</mo>
2370
+ <msup>
2371
+ <mrow>
2372
+ <mi mathvariant='normal'>kg</mi>
2373
+ </mrow>
2374
+ <mrow>
2375
+ <mo>&#8722;</mo>
2376
+ <mn>2</mn>
2377
+ </mrow>
2378
+ </msup>
2379
+ </mrow>
2380
+ </mrow>
2381
+ </math>
2382
+ </stem>
2383
+ </formula>
2384
+ </sections>
2385
+ </standard-document>
2227
2386
  OUTPUT
2387
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2388
+ .to be_equivalent_to xmlpp(output)
2228
2389
  end
2229
2390
 
2230
2391
  it "customises italicisation of MathML" do
2231
2392
  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
2393
+ = Document title
2394
+ Author
2395
+ :stem:
2256
2396
 
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'>
2397
+ [stem]
2398
+ ++++
2399
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2400
+ <mi>A</mi>
2401
+ <mo>+</mo>
2402
+ <mi>a</mi>
2403
+ <mo>+</mo>
2404
+ <mi>Α</mi>
2405
+ <mo>+</mo>
2406
+ <mi>α</mi>
2407
+ <mo>+</mo>
2408
+ <mi>AB</mi>
2409
+ <mstyle mathvariant="italic">
2381
2410
  <mrow>
2382
- <mi>Α</mi>
2411
+ <mi>Α</mi>
2383
2412
  </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 })
2413
+ </mstyle>
2414
+ </math>
2415
+ ++++
2416
+ INPUT
2417
+
2418
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2419
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2420
+ #{BLANK_HDR}
2421
+ <sections>
2422
+ <formula id='_'>
2423
+ <stem type='MathML'>
2424
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2425
+ <mi>A</mi>
2426
+ <mo>+</mo>
2427
+ <mi>a</mi>
2428
+ <mo>+</mo>
2429
+ <mi>Α</mi>
2430
+ <mo>+</mo>
2431
+ <mi>α</mi>
2432
+ <mo>+</mo>
2433
+ <mi>AB</mi>
2434
+ <mstyle mathvariant='italic'>
2435
+ <mrow>
2436
+ <mi>Α</mi>
2437
+ </mrow>
2438
+ </mstyle>
2439
+ </math>
2440
+ </stem>
2441
+ </formula>
2442
+ </sections>
2443
+ </standard-document>
2444
+ OUTPUT
2445
+ mock_mathml_italicise({ uppergreek: false, upperroman: true,
2446
+ lowergreek: true, lowerroman: true })
2447
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2448
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2449
+ #{BLANK_HDR}
2450
+ <sections>
2451
+ <formula id='_'>
2452
+ <stem type='MathML'>
2453
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2454
+ <mi>A</mi>
2455
+ <mo>+</mo>
2456
+ <mi>a</mi>
2457
+ <mo>+</mo>
2458
+ <mi mathvariant="normal">Α</mi>
2459
+ <mo>+</mo>
2460
+ <mi>α</mi>
2461
+ <mo>+</mo>
2462
+ <mi>AB</mi>
2463
+ <mstyle mathvariant='italic'>
2464
+ <mrow>
2465
+ <mi>Α</mi>
2466
+ </mrow>
2467
+ </mstyle>
2468
+ </math>
2469
+ </stem>
2470
+ </formula>
2471
+ </sections>
2472
+ </standard-document>
2473
+ OUTPUT
2474
+ mock_mathml_italicise({ uppergreek: true, upperroman: false,
2475
+ lowergreek: true, lowerroman: true })
2476
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2477
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2478
+ #{BLANK_HDR}
2479
+ <sections>
2480
+ <formula id='_'>
2481
+ <stem type='MathML'>
2482
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2483
+ <mi mathvariant="normal">A</mi>
2484
+ <mo>+</mo>
2485
+ <mi>a</mi>
2486
+ <mo>+</mo>
2487
+ <mi>Α</mi>
2488
+ <mo>+</mo>
2489
+ <mi>α</mi>
2490
+ <mo>+</mo>
2491
+ <mi>AB</mi>
2492
+ <mstyle mathvariant='italic'>
2493
+ <mrow>
2494
+ <mi>Α</mi>
2495
+ </mrow>
2496
+ </mstyle>
2497
+ </math>
2498
+ </stem>
2499
+ </formula>
2500
+ </sections>
2501
+ </standard-document>
2502
+ OUTPUT
2503
+ mock_mathml_italicise({ uppergreek: true, upperroman: true,
2504
+ lowergreek: false, lowerroman: true })
2505
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2506
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2507
+ #{BLANK_HDR}
2508
+ <sections>
2509
+ <formula id='_'>
2510
+ <stem type='MathML'>
2511
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2512
+ <mi>A</mi>
2513
+ <mo>+</mo>
2514
+ <mi>a</mi>
2515
+ <mo>+</mo>
2516
+ <mi>Α</mi>
2517
+ <mo>+</mo>
2518
+ <mi mathvariant="normal">α</mi>
2519
+ <mo>+</mo>
2520
+ <mi>AB</mi>
2521
+ <mstyle mathvariant='italic'>
2522
+ <mrow>
2523
+ <mi>Α</mi>
2524
+ </mrow>
2525
+ </mstyle>
2526
+ </math>
2527
+ </stem>
2528
+ </formula>
2529
+ </sections>
2530
+ </standard-document>
2531
+ OUTPUT
2532
+ mock_mathml_italicise({ uppergreek: true, upperroman: true,
2533
+ lowergreek: true, lowerroman: false })
2534
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2535
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2536
+ #{BLANK_HDR}
2537
+ <sections>
2538
+ <formula id='_'>
2539
+ <stem type='MathML'>
2540
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2541
+ <mi>A</mi>
2542
+ <mo>+</mo>
2543
+ <mi mathvariant="normal">a</mi>
2544
+ <mo>+</mo>
2545
+ <mi>Α</mi>
2546
+ <mo>+</mo>
2547
+ <mi>α</mi>
2548
+ <mo>+</mo>
2549
+ <mi>AB</mi>
2550
+ <mstyle mathvariant='italic'>
2551
+ <mrow>
2552
+ <mi>Α</mi>
2553
+ </mrow>
2554
+ </mstyle>
2555
+ </math>
2556
+ </stem>
2557
+ </formula>
2558
+ </sections>
2559
+ </standard-document>
2560
+ OUTPUT
2561
+ mock_mathml_italicise({ uppergreek: true, upperroman: true,
2562
+ lowergreek: true, lowerroman: true })
2392
2563
  end
2393
2564
 
2394
2565
  it "process express_ref macro with existing bibliography" do
2395
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2566
+ input = <<~INPUT
2396
2567
  #{ASCIIDOC_BLANK_HDR}
2397
2568
  == Clause
2398
2569
 
@@ -2412,49 +2583,52 @@ RSpec.describe Asciidoctor::Standoc do
2412
2583
  == Bibliography
2413
2584
  * [[[D,E]]] F
2414
2585
  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>
2586
+ output = <<~OUTPUT
2587
+ #{BLANK_HDR}
2588
+ <sections>
2589
+ <clause id='_' inline-header='false' obligation='normative'>
2590
+ <title>Clause</title>
2591
+ <p id='_'>
2592
+ <eref bibitemid='uml_A' citeas="">
2593
+ <localityStack>
2594
+ <locality type='anchor'><referenceFrom>A.B.C</referenceFrom></locality>
2595
+ </localityStack>
2596
+ C
2597
+ </eref>
2598
+ <eref bibitemid='uml_A' citeas=""/>
2599
+ <xref target='action.AA'>AA</xref>
2600
+ <xref target='action'>** Missing target action.AB</xref>
2601
+ </p>
2602
+ </clause>
2603
+ <clause id='action' type='express-schema' inline-header='false' obligation='normative'>
2604
+ <title>Action</title>
2605
+ <clause id='action.AA' inline-header='false' obligation='normative'>
2606
+ <title>AA</title>
2607
+ </clause>
2608
+ </clause>
2609
+ </sections>
2610
+ <bibliography>
2611
+ <references id='_' normative='false' obligation='informative'>
2612
+ <title>Bibliography</title>
2613
+ <bibitem id='D'>
2614
+ <formattedref format='application/x-isodoc+xml'>F</formattedref>
2615
+ <docidentifier>E</docidentifier>
2616
+ </bibitem>
2617
+ </references>
2618
+ <references hidden='true' normative='false'>
2619
+ <bibitem id='uml_A' type='internal'>
2620
+ <docidentifier type='repository'>uml/A</docidentifier>
2621
+ </bibitem>
2622
+ </references>
2623
+ </bibliography>
2452
2624
  </standard-document>
2453
2625
  OUTPUT
2626
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2627
+ .to be_equivalent_to xmlpp(output)
2454
2628
  end
2455
2629
 
2456
2630
  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")
2631
+ input = <<~INPUT
2458
2632
  #{ASCIIDOC_BLANK_HDR}
2459
2633
  [[B]]
2460
2634
  [type="express-schema"]
@@ -2468,6 +2642,7 @@ RSpec.describe Asciidoctor::Standoc do
2468
2642
  <<express-schema:B>>
2469
2643
  <<express-schema:B1>>
2470
2644
  INPUT
2645
+ output = <<~OUTPUT
2471
2646
  #{BLANK_HDR}
2472
2647
  <sections>
2473
2648
  <clause id='B' type='express-schema' inline-header='false' obligation='normative'>
@@ -2499,16 +2674,20 @@ RSpec.describe Asciidoctor::Standoc do
2499
2674
  </bibliography>
2500
2675
  </standard-document>
2501
2676
  OUTPUT
2677
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2678
+ .to be_equivalent_to xmlpp(output)
2502
2679
  end
2503
2680
 
2504
2681
  private
2505
2682
 
2506
- def mock_mathml_italicise(x)
2507
- allow_any_instance_of(::Asciidoctor::Standoc::Cleanup).to receive(:mathml_mi_italics).and_return(x)
2683
+ def mock_mathml_italicise(string)
2684
+ allow_any_instance_of(::Asciidoctor::Standoc::Cleanup)
2685
+ .to receive(:mathml_mi_italics).and_return(string)
2508
2686
  end
2509
2687
 
2510
2688
  def mock_iecbib_get_iec60050_103_01
2511
- expect(Iecbib::IecBibliography).to receive(:get).with("IEC 60050-103", nil, { keep_year: true }) do
2689
+ expect(Iecbib::IecBibliography).to receive(:get)
2690
+ .with("IEC 60050-103", nil, { keep_year: true }) do
2512
2691
  IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
2513
2692
  <bibitem type="standard" id="IEC60050-103">
2514
2693
  <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
@@ -2546,7 +2725,8 @@ RSpec.describe Asciidoctor::Standoc do
2546
2725
  end
2547
2726
 
2548
2727
  def mock_iecbib_get_iec60050_102_01
2549
- expect(Iecbib::IecBibliography).to receive(:get).with("IEC 60050-102", nil, { keep_year: true }) do
2728
+ expect(Iecbib::IecBibliography).to receive(:get)
2729
+ .with("IEC 60050-102", nil, { keep_year: true }) do
2550
2730
  IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
2551
2731
  <bibitem type="standard" id="IEC60050-102">
2552
2732
  <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>