metanorma-iso 1.8.1 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -2
- data/lib/asciidoctor/iso/base.rb +1 -0
- data/lib/asciidoctor/iso/cleanup.rb +17 -5
- data/lib/asciidoctor/iso/front.rb +3 -1
- data/lib/asciidoctor/iso/front_id.rb +66 -50
- data/lib/asciidoctor/iso/isodoc.rng +174 -0
- data/lib/asciidoctor/iso/isostandard.rng +1 -0
- data/lib/asciidoctor/iso/section.rb +2 -1
- data/lib/isodoc/iso/iso.amendment.xsl +65 -0
- data/lib/isodoc/iso/iso.international-standard.xsl +65 -0
- data/lib/isodoc/iso/metadata.rb +1 -0
- data/lib/isodoc/iso/sts_convert.rb +10 -13
- data/lib/isodoc/iso/xref.rb +31 -18
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +1 -1
- data/spec/asciidoctor/base_spec.rb +426 -334
- data/spec/asciidoctor/cleanup_spec.rb +383 -25
- data/spec/asciidoctor/section_spec.rb +0 -14
- data/spec/asciidoctor/validate_spec.rb +72 -39
- data/spec/isodoc/postproc_spec.rb +475 -434
- metadata +4 -4
@@ -2,20 +2,23 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe Asciidoctor::ISO do
|
4
4
|
it "removes empty text elements" do
|
5
|
-
|
5
|
+
input = <<~INPUT
|
6
6
|
#{ASCIIDOC_BLANK_HDR}
|
7
7
|
== {blank}
|
8
8
|
INPUT
|
9
|
+
output = <<~OUTPUT
|
9
10
|
#{BLANK_HDR}
|
10
11
|
<sections>
|
11
12
|
<clause id="_" inline-header="false" obligation="normative"/>
|
12
13
|
</sections>
|
13
14
|
</iso-standard>
|
14
15
|
OUTPUT
|
16
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
17
|
+
.to be_equivalent_to xmlpp(output)
|
15
18
|
end
|
16
19
|
|
17
20
|
it "processes stem-only terms as admitted" do
|
18
|
-
|
21
|
+
input = <<~INPUT
|
19
22
|
#{ASCIIDOC_BLANK_HDR}
|
20
23
|
== Terms and Definitions
|
21
24
|
|
@@ -25,6 +28,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
25
28
|
|
26
29
|
Time
|
27
30
|
INPUT
|
31
|
+
output = <<~OUTPUT
|
28
32
|
#{BLANK_HDR}
|
29
33
|
<sections>
|
30
34
|
<terms id="_" obligation="normative">
|
@@ -66,10 +70,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
66
70
|
</sections>
|
67
71
|
</iso-standard>
|
68
72
|
OUTPUT
|
73
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
74
|
+
.to be_equivalent_to xmlpp(output)
|
69
75
|
end
|
70
76
|
|
71
77
|
it "moves term domains out of the term definition paragraph" do
|
72
|
-
|
78
|
+
input = <<~INPUT
|
73
79
|
#{ASCIIDOC_BLANK_HDR}
|
74
80
|
== Terms and Definitions
|
75
81
|
|
@@ -77,6 +83,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
77
83
|
|
78
84
|
domain:[relativity] Time
|
79
85
|
INPUT
|
86
|
+
output = <<~OUTPUT
|
80
87
|
#{BLANK_HDR}
|
81
88
|
<sections>
|
82
89
|
<terms id="_" obligation="normative">
|
@@ -92,10 +99,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
92
99
|
</sections>
|
93
100
|
</iso-standard>
|
94
101
|
OUTPUT
|
102
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
103
|
+
.to be_equivalent_to xmlpp(output)
|
95
104
|
end
|
96
105
|
|
97
106
|
it "permits multiple blocks in term definition paragraph" do
|
98
|
-
|
107
|
+
input = <<~INPUT
|
99
108
|
= Document title
|
100
109
|
Author
|
101
110
|
:docfile: test.adoc
|
@@ -115,6 +124,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
115
124
|
|
116
125
|
This paragraph is extraneous
|
117
126
|
INPUT
|
127
|
+
output = <<~OUTPUT
|
118
128
|
#{BLANK_HDR}
|
119
129
|
<sections>
|
120
130
|
<terms id="_" obligation="normative">
|
@@ -156,10 +166,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
156
166
|
</sections>
|
157
167
|
</iso-standard>
|
158
168
|
OUTPUT
|
169
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
170
|
+
.to be_equivalent_to xmlpp(output)
|
159
171
|
end
|
160
172
|
|
161
173
|
it "keeps any initial boilerplate from terms and definitions" do
|
162
|
-
|
174
|
+
input = <<~INPUT
|
163
175
|
#{ASCIIDOC_BLANK_HDR}
|
164
176
|
== Terms and Definitions
|
165
177
|
|
@@ -171,6 +183,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
171
183
|
|
172
184
|
This paragraph is extraneous
|
173
185
|
INPUT
|
186
|
+
output = <<~OUTPUT
|
174
187
|
#{BLANK_HDR}
|
175
188
|
<sections>
|
176
189
|
<terms id="_" obligation="normative">
|
@@ -191,10 +204,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
191
204
|
</sections>
|
192
205
|
</iso-standard>
|
193
206
|
OUTPUT
|
207
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
208
|
+
.to be_equivalent_to xmlpp(output)
|
194
209
|
end
|
195
210
|
|
196
211
|
it "moves notes inside preceding blocks, if they are not at clause end, and the blocks are not delimited" do
|
197
|
-
|
212
|
+
input = <<~INPUT
|
198
213
|
#{ASCIIDOC_BLANK_HDR}
|
199
214
|
[stem]
|
200
215
|
++++
|
@@ -206,6 +221,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
206
221
|
|
207
222
|
Indeed.
|
208
223
|
INPUT
|
224
|
+
output = <<~OUTPUT
|
209
225
|
#{BLANK_HDR}
|
210
226
|
<sections>
|
211
227
|
<formula id="_">
|
@@ -229,10 +245,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
229
245
|
</sections>
|
230
246
|
</iso-standard>
|
231
247
|
OUTPUT
|
248
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
249
|
+
.to be_equivalent_to xmlpp(output)
|
232
250
|
end
|
233
251
|
|
234
252
|
it "does not move notes inside preceding blocks, if they are at clause end" do
|
235
|
-
|
253
|
+
input = <<~INPUT
|
236
254
|
#{ASCIIDOC_BLANK_HDR}
|
237
255
|
[source,ruby]
|
238
256
|
[1...x].each do |y|
|
@@ -241,6 +259,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
241
259
|
|
242
260
|
NOTE: That loop does not do much
|
243
261
|
INPUT
|
262
|
+
output = <<~OUTPUT
|
244
263
|
#{BLANK_HDR}
|
245
264
|
<sections>
|
246
265
|
<sourcecode id="_" lang="ruby">[1...x].each do |y|
|
@@ -252,10 +271,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
252
271
|
</sections>
|
253
272
|
</iso-standard>
|
254
273
|
OUTPUT
|
274
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
275
|
+
.to be_equivalent_to xmlpp(output)
|
255
276
|
end
|
256
277
|
|
257
278
|
it "converts xrefs to references into erefs" do
|
258
|
-
|
279
|
+
input = <<~INPUT
|
259
280
|
#{ASCIIDOC_BLANK_HDR}
|
260
281
|
<<iso216>>
|
261
282
|
|
@@ -263,6 +284,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
263
284
|
== Normative References
|
264
285
|
* [[[iso216,ISO 216:2001]]], _Reference_
|
265
286
|
INPUT
|
287
|
+
output = <<~OUTPUT
|
266
288
|
#{BLANK_HDR}
|
267
289
|
<preface>
|
268
290
|
<foreword id="_" obligation="informative">
|
@@ -297,10 +319,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
297
319
|
</bibliography>
|
298
320
|
</iso-standard>
|
299
321
|
OUTPUT
|
322
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
323
|
+
.to be_equivalent_to xmlpp(output)
|
300
324
|
end
|
301
325
|
|
302
326
|
it "extracts localities from erefs" do
|
303
|
-
|
327
|
+
input = <<~INPUT
|
304
328
|
#{ASCIIDOC_BLANK_HDR}
|
305
329
|
<<iso216,whole,clause=3,example=9-11,locality:prelude=33,locality:entirety:the reference>>
|
306
330
|
|
@@ -308,6 +332,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
308
332
|
== Normative References
|
309
333
|
* [[[iso216,ISO 216]]], _Reference_
|
310
334
|
INPUT
|
335
|
+
output = <<~OUTPUT
|
311
336
|
#{BLANK_HDR}
|
312
337
|
<preface>
|
313
338
|
<foreword id="_" obligation="informative">
|
@@ -353,10 +378,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
353
378
|
</bibliography>
|
354
379
|
</iso-standard>
|
355
380
|
OUTPUT
|
381
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
382
|
+
.to be_equivalent_to xmlpp(output)
|
356
383
|
end
|
357
384
|
|
358
385
|
it "strips type from xrefs" do
|
359
|
-
|
386
|
+
input = <<~INPUT
|
360
387
|
#{ASCIIDOC_BLANK_HDR}
|
361
388
|
<<iso216>>
|
362
389
|
|
@@ -364,6 +391,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
364
391
|
== Clause
|
365
392
|
* [[[iso216,ISO 216]]], _Reference_
|
366
393
|
INPUT
|
394
|
+
output = <<~OUTPUT
|
367
395
|
#{BLANK_HDR}
|
368
396
|
<preface>
|
369
397
|
<foreword id="_" obligation="informative">
|
@@ -394,10 +422,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
394
422
|
</bibliography>
|
395
423
|
</iso-standard>
|
396
424
|
OUTPUT
|
425
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
426
|
+
.to be_equivalent_to xmlpp(output)
|
397
427
|
end
|
398
428
|
|
399
429
|
it "processes localities in term sources" do
|
400
|
-
|
430
|
+
input = <<~INPUT
|
401
431
|
#{ASCIIDOC_BLANK_HDR}
|
402
432
|
== Terms and Definitions
|
403
433
|
|
@@ -406,6 +436,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
406
436
|
[.source]
|
407
437
|
<<ISO2191,section=1>>
|
408
438
|
INPUT
|
439
|
+
output = <<~OUTPUT
|
409
440
|
#{BLANK_HDR}
|
410
441
|
<sections>
|
411
442
|
<terms id="_" obligation="normative">
|
@@ -426,10 +457,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
426
457
|
</sections>
|
427
458
|
</iso-standard>
|
428
459
|
OUTPUT
|
460
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
461
|
+
.to be_equivalent_to xmlpp(output)
|
429
462
|
end
|
430
463
|
|
431
464
|
it "removes extraneous material from Normative References" do
|
432
|
-
|
465
|
+
input = <<~INPUT
|
433
466
|
#{ASCIIDOC_BLANK_HDR}
|
434
467
|
[bibliography]
|
435
468
|
== Normative References
|
@@ -438,6 +471,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
438
471
|
|
439
472
|
* [[[iso216,ISO 216]]], _Reference_
|
440
473
|
INPUT
|
474
|
+
output = <<~OUTPUT
|
441
475
|
#{BLANK_HDR}
|
442
476
|
<sections></sections>
|
443
477
|
<bibliography>
|
@@ -460,29 +494,35 @@ RSpec.describe Asciidoctor::ISO do
|
|
460
494
|
</bibliography>
|
461
495
|
</iso-standard>
|
462
496
|
OUTPUT
|
497
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
498
|
+
.to be_equivalent_to xmlpp(output)
|
463
499
|
end
|
464
500
|
|
465
501
|
it "inserts IDs into paragraphs" do
|
466
|
-
|
502
|
+
input = <<~INPUT
|
467
503
|
#{ASCIIDOC_BLANK_HDR}
|
468
504
|
Paragraph
|
469
505
|
INPUT
|
506
|
+
output = <<~OUTPUT
|
470
507
|
#{BLANK_HDR}
|
471
508
|
<sections>
|
472
509
|
<p id="_">Paragraph</p>
|
473
510
|
</sections>
|
474
511
|
</iso-standard>
|
475
512
|
OUTPUT
|
513
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
514
|
+
.to be_equivalent_to xmlpp(output)
|
476
515
|
end
|
477
516
|
|
478
517
|
it "inserts IDs into notes" do
|
479
|
-
|
518
|
+
input = <<~INPUT
|
480
519
|
#{ASCIIDOC_BLANK_HDR}
|
481
520
|
[example]
|
482
521
|
====
|
483
522
|
NOTE: This note has no ID
|
484
523
|
====
|
485
524
|
INPUT
|
525
|
+
output = <<~OUTPUT
|
486
526
|
#{BLANK_HDR}
|
487
527
|
<sections>
|
488
528
|
<example id="_">
|
@@ -493,10 +533,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
493
533
|
</sections>
|
494
534
|
</iso-standard>
|
495
535
|
OUTPUT
|
536
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
537
|
+
.to be_equivalent_to xmlpp(output)
|
496
538
|
end
|
497
539
|
|
498
540
|
it "moves table key inside table" do
|
499
|
-
|
541
|
+
input = <<~INPUT
|
500
542
|
#{ASCIIDOC_BLANK_HDR}
|
501
543
|
|===
|
502
544
|
|a |b |c
|
@@ -506,6 +548,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
506
548
|
|
507
549
|
a:: b
|
508
550
|
INPUT
|
551
|
+
output = <<~OUTPUT
|
509
552
|
#{BLANK_HDR}
|
510
553
|
<sections>
|
511
554
|
<table id="_">
|
@@ -526,10 +569,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
526
569
|
</sections>
|
527
570
|
</iso-standard>
|
528
571
|
OUTPUT
|
572
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
573
|
+
.to be_equivalent_to xmlpp(output)
|
529
574
|
end
|
530
575
|
|
531
576
|
it "processes headerrows attribute for table without header rows" do
|
532
|
-
|
577
|
+
input = <<~INPUT
|
533
578
|
#{ASCIIDOC_BLANK_HDR}
|
534
579
|
[headerrows=3]
|
535
580
|
|===
|
@@ -539,6 +584,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
539
584
|
|a |b |c
|
540
585
|
|===
|
541
586
|
INPUT
|
587
|
+
output = <<~OUTPUT
|
542
588
|
#{BLANK_HDR}
|
543
589
|
<sections>
|
544
590
|
<table id="_">
|
@@ -570,10 +616,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
570
616
|
</sections>
|
571
617
|
</iso-standard>
|
572
618
|
OUTPUT
|
619
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
620
|
+
.to be_equivalent_to xmlpp(output)
|
573
621
|
end
|
574
622
|
|
575
623
|
it "processes headerrows attribute for table with header rows" do
|
576
|
-
|
624
|
+
input = <<~INPUT
|
577
625
|
#{ASCIIDOC_BLANK_HDR}
|
578
626
|
[headerrows=3]
|
579
627
|
|===
|
@@ -584,6 +632,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
584
632
|
|a |b |c
|
585
633
|
|===
|
586
634
|
INPUT
|
635
|
+
output = <<~OUTPUT
|
587
636
|
#{BLANK_HDR}
|
588
637
|
<sections>
|
589
638
|
<table id="_">
|
@@ -615,10 +664,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
615
664
|
</sections>
|
616
665
|
</iso-standard>
|
617
666
|
OUTPUT
|
667
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
668
|
+
.to be_equivalent_to xmlpp(output)
|
618
669
|
end
|
619
670
|
|
620
671
|
it "moves table notes inside table" do
|
621
|
-
|
672
|
+
input = <<~INPUT
|
622
673
|
#{ASCIIDOC_BLANK_HDR}
|
623
674
|
|===
|
624
675
|
|a |b |c
|
@@ -628,6 +679,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
628
679
|
|
629
680
|
NOTE: Note 2
|
630
681
|
INPUT
|
682
|
+
output = <<~OUTPUT
|
631
683
|
#{BLANK_HDR}
|
632
684
|
<sections>
|
633
685
|
<table id="_">
|
@@ -648,10 +700,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
648
700
|
</sections>
|
649
701
|
</iso-standard>
|
650
702
|
OUTPUT
|
703
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
704
|
+
.to be_equivalent_to xmlpp(output)
|
651
705
|
end
|
652
706
|
|
653
707
|
it "moves formula key inside formula" do
|
654
|
-
|
708
|
+
input = <<~INPUT
|
655
709
|
#{ASCIIDOC_BLANK_HDR}
|
656
710
|
[stem]
|
657
711
|
++++
|
@@ -662,6 +716,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
662
716
|
|
663
717
|
a:: b
|
664
718
|
INPUT
|
719
|
+
output = <<~OUTPUT
|
665
720
|
#{BLANK_HDR}
|
666
721
|
<sections>
|
667
722
|
<formula id="_">
|
@@ -684,10 +739,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
684
739
|
</sections>
|
685
740
|
</iso-standard>
|
686
741
|
OUTPUT
|
742
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
743
|
+
.to be_equivalent_to xmlpp(output)
|
687
744
|
end
|
688
745
|
|
689
746
|
it "moves footnotes inside figures" do
|
690
|
-
|
747
|
+
input = <<~INPUT
|
691
748
|
#{ASCIIDOC_BLANK_HDR}
|
692
749
|
image::spec/examples/rice_images/rice_image1.png[]
|
693
750
|
|
@@ -695,6 +752,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
695
752
|
|
696
753
|
footnote:[This is another footnote to a figure]
|
697
754
|
INPUT
|
755
|
+
output = <<~OUTPUT
|
698
756
|
#{BLANK_HDR}
|
699
757
|
<sections>
|
700
758
|
<figure id="_">
|
@@ -709,10 +767,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
709
767
|
</sections>
|
710
768
|
</iso-standard>
|
711
769
|
OUTPUT
|
770
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
771
|
+
.to be_equivalent_to xmlpp(output)
|
712
772
|
end
|
713
773
|
|
714
774
|
it "moves figure key inside figure" do
|
715
|
-
|
775
|
+
input = <<~INPUT
|
716
776
|
#{ASCIIDOC_BLANK_HDR}
|
717
777
|
image::spec/examples/rice_images/rice_image1.png[]
|
718
778
|
|
@@ -720,6 +780,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
720
780
|
|
721
781
|
a:: b
|
722
782
|
INPUT
|
783
|
+
output = <<~OUTPUT
|
723
784
|
#{BLANK_HDR}
|
724
785
|
<sections>
|
725
786
|
<figure id="_">
|
@@ -734,10 +795,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
734
795
|
</sections>
|
735
796
|
</iso-standard>
|
736
797
|
OUTPUT
|
798
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
799
|
+
.to be_equivalent_to xmlpp(output)
|
737
800
|
end
|
738
801
|
|
739
802
|
it "numbers bibliographic notes and footnotes sequentially" do
|
740
|
-
|
803
|
+
input = <<~INPUT
|
741
804
|
#{ASCIIDOC_BLANK_HDR}
|
742
805
|
footnote:[Footnote]
|
743
806
|
|
@@ -749,6 +812,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
749
812
|
== Clause
|
750
813
|
footnote:[Footnote2]
|
751
814
|
INPUT
|
815
|
+
output = <<~OUTPUT
|
752
816
|
#{BLANK_HDR}
|
753
817
|
<preface>
|
754
818
|
<foreword id="_" obligation="informative">
|
@@ -794,10 +858,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
794
858
|
</bibliography>
|
795
859
|
</iso-standard>
|
796
860
|
OUTPUT
|
861
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
862
|
+
.to be_equivalent_to xmlpp(output)
|
797
863
|
end
|
798
864
|
|
799
865
|
it "defaults section obligations" do
|
800
|
-
|
866
|
+
input = <<~INPUT
|
801
867
|
#{ASCIIDOC_BLANK_HDR}
|
802
868
|
|
803
869
|
== Clause
|
@@ -808,6 +874,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
808
874
|
|
809
875
|
Text
|
810
876
|
INPUT
|
877
|
+
output = <<~OUTPUT
|
811
878
|
#{BLANK_HDR}
|
812
879
|
<sections>
|
813
880
|
<clause id="_" inline-header="false" obligation="normative">
|
@@ -821,10 +888,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
821
888
|
</annex>
|
822
889
|
</iso-standard>
|
823
890
|
OUTPUT
|
891
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
892
|
+
.to be_equivalent_to xmlpp(output)
|
824
893
|
end
|
825
894
|
|
826
895
|
it "extends clause levels past 5" do
|
827
|
-
|
896
|
+
input = <<~INPUT
|
828
897
|
#{ASCIIDOC_BLANK_HDR}
|
829
898
|
|
830
899
|
== Clause1
|
@@ -852,6 +921,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
852
921
|
====== Clause 5B
|
853
922
|
|
854
923
|
INPUT
|
924
|
+
output = <<~OUTPUT
|
855
925
|
#{BLANK_HDR}
|
856
926
|
<sections>
|
857
927
|
<clause id="_" inline-header="false" obligation="normative">
|
@@ -887,10 +957,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
887
957
|
</sections>
|
888
958
|
</iso-standard>
|
889
959
|
OUTPUT
|
960
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
961
|
+
.to be_equivalent_to xmlpp(output)
|
890
962
|
end
|
891
963
|
|
892
964
|
it "reorders references in bibliography, and renumbers citations accordingly" do
|
893
|
-
|
965
|
+
input = <<~INPUT
|
894
966
|
#{ASCIIDOC_BLANK_HDR}
|
895
967
|
|
896
968
|
== Clause 1
|
@@ -932,6 +1004,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
932
1004
|
* [[[ref16,(B)]]], _Standard 20_
|
933
1005
|
* [[[ref17,(A)]]], _Standard 30_
|
934
1006
|
INPUT
|
1007
|
+
output = <<~OUTPUT
|
935
1008
|
#{BLANK_HDR}
|
936
1009
|
<sections>
|
937
1010
|
<clause id="_" inline-header="false" obligation="normative">
|
@@ -1130,5 +1203,290 @@ RSpec.describe Asciidoctor::ISO do
|
|
1130
1203
|
</bibliography>
|
1131
1204
|
</iso-standard>
|
1132
1205
|
OUTPUT
|
1206
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1207
|
+
.to be_equivalent_to xmlpp(output)
|
1208
|
+
end
|
1209
|
+
|
1210
|
+
context "terms & definitions boilerplate" do
|
1211
|
+
it "places normal terms & definitions boilerplate in flat clause" do
|
1212
|
+
input = <<~INPUT
|
1213
|
+
#{ASCIIDOC_BLANK_HDR}
|
1214
|
+
|
1215
|
+
== Terms and definitions
|
1216
|
+
|
1217
|
+
=== Term1
|
1218
|
+
INPUT
|
1219
|
+
output = <<~OUTPUT
|
1220
|
+
#{BLANK_HDR}
|
1221
|
+
<sections>
|
1222
|
+
<terms id='_' obligation='normative'>
|
1223
|
+
<title>Terms and definitions</title>
|
1224
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
1225
|
+
<p id='_'>
|
1226
|
+
ISO and IEC maintain terminological databases for use in standardization
|
1227
|
+
at the following addresses:
|
1228
|
+
</p>
|
1229
|
+
<ul id='_'>
|
1230
|
+
<li>
|
1231
|
+
<p id='_'>
|
1232
|
+
ISO Online browsing platform: available at
|
1233
|
+
<link target='http://www.iso.org/obp'/>
|
1234
|
+
</p>
|
1235
|
+
</li>
|
1236
|
+
<li>
|
1237
|
+
<p id='_'>
|
1238
|
+
IEC Electropedia: available at
|
1239
|
+
<link target='http://www.electropedia.org'/>
|
1240
|
+
</p>
|
1241
|
+
</li>
|
1242
|
+
</ul>
|
1243
|
+
<term id='term-term1'>
|
1244
|
+
<preferred>Term1</preferred>
|
1245
|
+
</term>
|
1246
|
+
</terms>
|
1247
|
+
</sections>
|
1248
|
+
</iso-standard>
|
1249
|
+
OUTPUT
|
1250
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1251
|
+
.to be_equivalent_to xmlpp(output)
|
1252
|
+
end
|
1253
|
+
|
1254
|
+
it "places normal terms & definitions boilerplate in multi-clause" do
|
1255
|
+
input = <<~INPUT
|
1256
|
+
#{ASCIIDOC_BLANK_HDR}
|
1257
|
+
|
1258
|
+
== Terms and definitions
|
1259
|
+
|
1260
|
+
=== Normal Terms
|
1261
|
+
|
1262
|
+
==== Term1
|
1263
|
+
|
1264
|
+
=== Abnormal terms
|
1265
|
+
|
1266
|
+
==== Term 2
|
1267
|
+
INPUT
|
1268
|
+
output = <<~OUTPUT
|
1269
|
+
#{BLANK_HDR}
|
1270
|
+
<sections>
|
1271
|
+
<clause id='_' obligation='normative'>
|
1272
|
+
<title>Terms and definitions</title>
|
1273
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
1274
|
+
<p id='_'>
|
1275
|
+
ISO and IEC maintain terminological databases for use in standardization
|
1276
|
+
at the following addresses:
|
1277
|
+
</p>
|
1278
|
+
<ul id='_'>
|
1279
|
+
<li>
|
1280
|
+
<p id='_'>
|
1281
|
+
ISO Online browsing platform: available at
|
1282
|
+
<link target='http://www.iso.org/obp'/>
|
1283
|
+
</p>
|
1284
|
+
</li>
|
1285
|
+
<li>
|
1286
|
+
<p id='_'>
|
1287
|
+
IEC Electropedia: available at
|
1288
|
+
<link target='http://www.electropedia.org'/>
|
1289
|
+
</p>
|
1290
|
+
</li>
|
1291
|
+
</ul>
|
1292
|
+
<terms id='_' obligation='normative'>
|
1293
|
+
<title>Normal Terms</title>
|
1294
|
+
<term id='term-term1'>
|
1295
|
+
<preferred>Term1</preferred>
|
1296
|
+
</term>
|
1297
|
+
</terms>
|
1298
|
+
<terms id='_' obligation='normative'>
|
1299
|
+
<title>Abnormal terms</title>
|
1300
|
+
<term id='term-term-2'>
|
1301
|
+
<preferred>Term 2</preferred>
|
1302
|
+
</term>
|
1303
|
+
</terms>
|
1304
|
+
</clause>
|
1305
|
+
</sections>
|
1306
|
+
</iso-standard>
|
1307
|
+
OUTPUT
|
1308
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1309
|
+
.to be_equivalent_to xmlpp(output)
|
1310
|
+
end
|
1311
|
+
|
1312
|
+
it "places normal terms & definitions boilerplate in single clause that excludes symbols" do
|
1313
|
+
input = <<~INPUT
|
1314
|
+
#{ASCIIDOC_BLANK_HDR}
|
1315
|
+
|
1316
|
+
== Terms, definitions, symbols and abbreviated terms
|
1317
|
+
|
1318
|
+
=== Terms and definitions
|
1319
|
+
|
1320
|
+
==== Normal Terms
|
1321
|
+
|
1322
|
+
===== Term1
|
1323
|
+
|
1324
|
+
==== Abnormal terms
|
1325
|
+
|
1326
|
+
===== Term 2
|
1327
|
+
|
1328
|
+
=== Symbols and abbreviated terms
|
1329
|
+
INPUT
|
1330
|
+
output = <<~OUTPUT
|
1331
|
+
#{BLANK_HDR}
|
1332
|
+
<sections>
|
1333
|
+
<clause id='_' obligation='normative'>
|
1334
|
+
<title>Terms, definitions, symbols and abbreviated terms</title>
|
1335
|
+
<clause id='_' obligation='normative'>
|
1336
|
+
<title>Terms and definitions</title>
|
1337
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
1338
|
+
<p id='_'>
|
1339
|
+
ISO and IEC maintain terminological databases for use in
|
1340
|
+
standardization at the following addresses:
|
1341
|
+
</p>
|
1342
|
+
<ul id='_'>
|
1343
|
+
<li>
|
1344
|
+
<p id='_'>
|
1345
|
+
ISO Online browsing platform: available at
|
1346
|
+
<link target='http://www.iso.org/obp'/>
|
1347
|
+
</p>
|
1348
|
+
</li>
|
1349
|
+
<li>
|
1350
|
+
<p id='_'>
|
1351
|
+
IEC Electropedia: available at
|
1352
|
+
<link target='http://www.electropedia.org'/>
|
1353
|
+
</p>
|
1354
|
+
</li>
|
1355
|
+
</ul>
|
1356
|
+
<terms id='_' obligation='normative'>
|
1357
|
+
<title>Normal Terms</title>
|
1358
|
+
<term id='term-term1'>
|
1359
|
+
<preferred>Term1</preferred>
|
1360
|
+
</term>
|
1361
|
+
</terms>
|
1362
|
+
<terms id='_' obligation='normative'>
|
1363
|
+
<title>Abnormal terms</title>
|
1364
|
+
<term id='term-term-2'>
|
1365
|
+
<preferred>Term 2</preferred>
|
1366
|
+
</term>
|
1367
|
+
</terms>
|
1368
|
+
</clause>
|
1369
|
+
<definitions id='_' obligation='normative'>
|
1370
|
+
<title>Symbols and abbreviated terms</title>
|
1371
|
+
</definitions>
|
1372
|
+
</clause>
|
1373
|
+
</sections>
|
1374
|
+
</iso-standard>
|
1375
|
+
OUTPUT
|
1376
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1377
|
+
.to be_equivalent_to xmlpp(output)
|
1378
|
+
end
|
1379
|
+
|
1380
|
+
it "places normal terms & definitions boilerplate in first of multiple clauses that excludes symbols" do
|
1381
|
+
input = <<~INPUT
|
1382
|
+
#{ASCIIDOC_BLANK_HDR}
|
1383
|
+
|
1384
|
+
== Terms, definitions, symbols and abbreviated terms
|
1385
|
+
|
1386
|
+
=== Terms and definitions
|
1387
|
+
|
1388
|
+
==== Term1
|
1389
|
+
|
1390
|
+
[heading=terms]
|
1391
|
+
=== Other Terms
|
1392
|
+
|
1393
|
+
==== Term 2
|
1394
|
+
|
1395
|
+
=== Symbols and abbreviated terms
|
1396
|
+
INPUT
|
1397
|
+
output = <<~OUTPUT
|
1398
|
+
#{BLANK_HDR}
|
1399
|
+
<sections>
|
1400
|
+
<clause id='_' obligation='normative'>
|
1401
|
+
<title>Terms, definitions, symbols and abbreviated terms</title>
|
1402
|
+
<terms id='_' obligation='normative'>
|
1403
|
+
<title>Terms and definitions</title>
|
1404
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
1405
|
+
<p id='_'>
|
1406
|
+
ISO and IEC maintain terminological databases for use in
|
1407
|
+
standardization at the following addresses:
|
1408
|
+
</p>
|
1409
|
+
<ul id='_'>
|
1410
|
+
<li>
|
1411
|
+
<p id='_'>
|
1412
|
+
ISO Online browsing platform: available at
|
1413
|
+
<link target='http://www.iso.org/obp'/>
|
1414
|
+
</p>
|
1415
|
+
</li>
|
1416
|
+
<li>
|
1417
|
+
<p id='_'>
|
1418
|
+
IEC Electropedia: available at
|
1419
|
+
<link target='http://www.electropedia.org'/>
|
1420
|
+
</p>
|
1421
|
+
</li>
|
1422
|
+
</ul>
|
1423
|
+
<term id='term-term1'>
|
1424
|
+
<preferred>Term1</preferred>
|
1425
|
+
</term>
|
1426
|
+
</terms>
|
1427
|
+
<terms id='_' obligation='normative'>
|
1428
|
+
<title>Other Terms</title>
|
1429
|
+
<term id='term-term-2'>
|
1430
|
+
<preferred>Term 2</preferred>
|
1431
|
+
</term>
|
1432
|
+
</terms>
|
1433
|
+
<definitions id='_' obligation='normative'>
|
1434
|
+
<title>Symbols and abbreviated terms</title>
|
1435
|
+
</definitions>
|
1436
|
+
</clause>
|
1437
|
+
</sections>
|
1438
|
+
</iso-standard>
|
1439
|
+
OUTPUT
|
1440
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1441
|
+
.to be_equivalent_to xmlpp(output)
|
1442
|
+
end
|
1443
|
+
|
1444
|
+
it "modifies normal terms & definitions boilerplate in vocabulary document" do
|
1445
|
+
input = <<~INPUT
|
1446
|
+
= Document title
|
1447
|
+
Author
|
1448
|
+
:docfile: test.adoc
|
1449
|
+
:nodoc:
|
1450
|
+
:novalid:
|
1451
|
+
:no-isobib:
|
1452
|
+
:docsubtype: vocabulary
|
1453
|
+
|
1454
|
+
== Terms and definitions
|
1455
|
+
|
1456
|
+
=== Term1
|
1457
|
+
INPUT
|
1458
|
+
output = <<~OUTPUT
|
1459
|
+
#{BLANK_HDR.sub(%r{</doctype>}, '</doctype><subdoctype>vocabulary</subdoctype>')}
|
1460
|
+
<sections>
|
1461
|
+
<terms id='_' obligation='normative'>
|
1462
|
+
<title>Terms and definitions</title>
|
1463
|
+
<p id='_'>
|
1464
|
+
ISO and IEC maintain terminological databases for use in standardization
|
1465
|
+
at the following addresses:
|
1466
|
+
</p>
|
1467
|
+
<ul id='_'>
|
1468
|
+
<li>
|
1469
|
+
<p id='_'>
|
1470
|
+
ISO Online browsing platform: available at
|
1471
|
+
<link target='http://www.iso.org/obp'/>
|
1472
|
+
</p>
|
1473
|
+
</li>
|
1474
|
+
<li>
|
1475
|
+
<p id='_'>
|
1476
|
+
IEC Electropedia: available at
|
1477
|
+
<link target='http://www.electropedia.org'/>
|
1478
|
+
</p>
|
1479
|
+
</li>
|
1480
|
+
</ul>
|
1481
|
+
<term id='term-term1'>
|
1482
|
+
<preferred>Term1</preferred>
|
1483
|
+
</term>
|
1484
|
+
</terms>
|
1485
|
+
</sections>
|
1486
|
+
</iso-standard>
|
1487
|
+
OUTPUT
|
1488
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1489
|
+
.to be_equivalent_to xmlpp(output)
|
1490
|
+
end
|
1133
1491
|
end
|
1134
1492
|
end
|