metanorma-iso 1.7.3 → 1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +7 -1
- data/lib/asciidoctor/iso/base.rb +14 -11
- data/lib/asciidoctor/iso/biblio.rng +5 -6
- data/lib/asciidoctor/iso/cleanup.rb +40 -24
- data/lib/asciidoctor/iso/front.rb +29 -17
- data/lib/asciidoctor/iso/front_id.rb +81 -60
- data/lib/asciidoctor/iso/isodoc.rng +305 -4
- data/lib/asciidoctor/iso/isostandard.rng +1 -0
- data/lib/asciidoctor/iso/section.rb +2 -1
- data/lib/asciidoctor/iso/validate.rb +22 -110
- data/lib/asciidoctor/iso/validate_image.rb +97 -0
- data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
- data/lib/asciidoctor/iso/validate_section.rb +55 -29
- data/lib/asciidoctor/iso/validate_style.rb +36 -24
- data/lib/asciidoctor/iso/validate_title.rb +23 -17
- data/lib/isodoc/iso/base_convert.rb +8 -2
- data/lib/isodoc/iso/html/style-human.css +7 -0
- data/lib/isodoc/iso/html/style-iso.css +7 -0
- data/lib/isodoc/iso/html_convert.rb +0 -1
- data/lib/isodoc/iso/index.rb +2 -1
- data/lib/isodoc/iso/iso.amendment.xsl +659 -194
- data/lib/isodoc/iso/iso.international-standard.xsl +659 -194
- data/lib/isodoc/iso/metadata.rb +1 -0
- data/lib/isodoc/iso/presentation_xml_convert.rb +44 -33
- data/lib/isodoc/iso/sts_convert.rb +10 -13
- data/lib/isodoc/iso/word_convert.rb +0 -1
- data/lib/isodoc/iso/xref.rb +43 -26
- data/lib/metanorma/iso/processor.rb +1 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +8 -8
- data/spec/asciidoctor/amd_spec.rb +5 -5
- data/spec/asciidoctor/base_spec.rb +428 -307
- data/spec/asciidoctor/blocks_spec.rb +96 -34
- data/spec/asciidoctor/cleanup_spec.rb +383 -25
- data/spec/asciidoctor/section_spec.rb +0 -14
- data/spec/asciidoctor/validate_spec.rb +235 -83
- data/spec/isodoc/postproc_spec.rb +481 -438
- data/spec/spec_helper.rb +16 -13
- metadata +50 -50
- data/lib/isodoc/iso/html/scripts.html +0 -178
@@ -101,20 +101,6 @@ RSpec.describe Asciidoctor::ISO do
|
|
101
101
|
<title>Terms, definitions, symbols and abbreviated terms</title>
|
102
102
|
<terms id="_" obligation="normative">
|
103
103
|
<title>Normal Terms</title>
|
104
|
-
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
105
|
-
<p id="_">ISO and IEC maintain terminological databases for use in standardization at the following addresses:</p>
|
106
|
-
<ul id="_">
|
107
|
-
<li>
|
108
|
-
<p id="_">ISO Online browsing platform: available at
|
109
|
-
|
110
|
-
<link target="http://www.iso.org/obp"/></p>
|
111
|
-
</li>
|
112
|
-
<li>
|
113
|
-
<p id="_">IEC Electropedia: available at
|
114
|
-
|
115
|
-
<link target="http://www.electropedia.org"/></p>
|
116
|
-
</li>
|
117
|
-
</ul>
|
118
104
|
<term id="term-term2">
|
119
105
|
<preferred>Term2</preferred>
|
120
106
|
</term>
|
@@ -4,6 +4,7 @@ require "fileutils"
|
|
4
4
|
RSpec.describe Asciidoctor::ISO do
|
5
5
|
context "when xref_error.adoc compilation" do
|
6
6
|
it "generates error file" do
|
7
|
+
FileUtils.rm_f "xref_error.err"
|
7
8
|
File.write("xref_error.adoc", <<~"CONTENT")
|
8
9
|
= X
|
9
10
|
A
|
@@ -70,47 +71,67 @@ RSpec.describe Asciidoctor::ISO do
|
|
70
71
|
|
71
72
|
INPUT
|
72
73
|
expect(File.read("test.err")).to include \
|
73
|
-
"image name spec/examples/rice_images/rice_image1.png does not match
|
74
|
+
"image name spec/examples/rice_images/rice_image1.png does not match "\
|
75
|
+
"DRG requirements: expect 1000-1_ed2amd3fig"
|
74
76
|
expect(File.read("test.err")).to include \
|
75
|
-
"image name spec/examples/rice_images/1001_ed2amd3fig1.png does not
|
76
|
-
|
77
|
+
"image name spec/examples/rice_images/1001_ed2amd3fig1.png does not "\
|
78
|
+
"match DRG requirements: " \
|
79
|
+
"expect 1000-1_ed2amd3fig"
|
77
80
|
expect(File.read("test.err")).not_to include \
|
78
|
-
"image name spec/examples/rice_images/SL1000-1_ed2amd3fig1.png does not
|
79
|
-
|
81
|
+
"image name spec/examples/rice_images/SL1000-1_ed2amd3fig1.png does not "\
|
82
|
+
"match DRG requirements: " \
|
83
|
+
"expect 1000-1_ed2amd3fig"
|
80
84
|
expect(File.read("test.err")).not_to include \
|
81
|
-
"image name spec/examples/rice_images/ISO_1213_1.png does not match DRG
|
85
|
+
"image name spec/examples/rice_images/ISO_1213_1.png does not match DRG "\
|
86
|
+
"requirements: expect 1000-1_ed2amd3fig"
|
82
87
|
expect(File.read("test.err")).to include \
|
83
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3figA.png does not
|
88
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3figA.png does not "\
|
89
|
+
"match DRG requirements"
|
84
90
|
expect(File.read("test.err")).not_to include \
|
85
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3figTab1.png does
|
91
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3figTab1.png does "\
|
92
|
+
"not match DRG requirements"
|
86
93
|
expect(File.read("test.err")).not_to include \
|
87
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3figTab1.png is
|
94
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3figTab1.png is "\
|
95
|
+
"under a table but is not so labelled"
|
88
96
|
expect(File.read("test.err")).to include \
|
89
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig2.png is under
|
97
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig2.png is under "\
|
98
|
+
"a table but is not so labelled"
|
90
99
|
expect(File.read("test.err")).to include \
|
91
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3figTab2.png is
|
100
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3figTab2.png is "\
|
101
|
+
"labelled as under a table but is not"
|
92
102
|
expect(File.read("test.err")).not_to include \
|
93
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png is
|
103
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png is "\
|
104
|
+
"labelled as under a table but is not"
|
94
105
|
expect(File.read("test.err")).not_to include \
|
95
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3figA2.png is
|
106
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3figA2.png is "\
|
107
|
+
"under an annex but is not so labelled"
|
96
108
|
expect(File.read("test.err")).to include \
|
97
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig3.png is
|
109
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig3.png is "\
|
110
|
+
"under an annex but is not so labelled"
|
98
111
|
expect(File.read("test.err")).to include \
|
99
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3figA1.png is
|
112
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3figA1.png is "\
|
113
|
+
"labelled as under an annex but is not"
|
100
114
|
expect(File.read("test.err")).not_to include \
|
101
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png is
|
115
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png is "\
|
116
|
+
"labelled as under an annex but is not"
|
102
117
|
expect(File.read("test.err")).not_to include \
|
103
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig1b.png has a
|
118
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig1b.png has a "\
|
119
|
+
"subfigure letter but is not a subfigure"
|
104
120
|
expect(File.read("test.err")).to include \
|
105
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig4.png does not
|
121
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig4.png does not "\
|
122
|
+
"have a subfigure letter but is a subfigure"
|
106
123
|
expect(File.read("test.err")).to include \
|
107
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig1a.png has a
|
124
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig1a.png has a "\
|
125
|
+
"subfigure letter but is not a subfigure"
|
108
126
|
expect(File.read("test.err")).not_to include \
|
109
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png has a
|
127
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png has a "\
|
128
|
+
"subfigure letter but is not a subfigure"
|
110
129
|
expect(File.read("test.err")).to include \
|
111
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig5_f.png expected
|
130
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig5_f.png expected "\
|
131
|
+
"to have suffix _e"
|
112
132
|
expect(File.read("test.err")).not_to include \
|
113
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png expected
|
133
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png expected "\
|
134
|
+
"to have suffix _e"
|
114
135
|
end
|
115
136
|
|
116
137
|
context "Warns of missing scope" do
|
@@ -187,7 +208,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
187
208
|
[bibliography]
|
188
209
|
== Normative references
|
189
210
|
INPUT
|
190
|
-
expect(File.read("test.err"))
|
211
|
+
expect(File.read("test.err"))
|
212
|
+
.not_to include "Normative references missing"
|
191
213
|
end
|
192
214
|
|
193
215
|
it "Normative references not missing 2" do
|
@@ -201,7 +223,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
201
223
|
|
202
224
|
text
|
203
225
|
INPUT
|
204
|
-
expect(File.read("test.err"))
|
226
|
+
expect(File.read("test.err"))
|
227
|
+
.not_to include "Normative references missing"
|
205
228
|
end
|
206
229
|
end
|
207
230
|
|
@@ -261,7 +284,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
261
284
|
|
262
285
|
text
|
263
286
|
INPUT
|
264
|
-
expect(File.read("test.err"))
|
287
|
+
expect(File.read("test.err"))
|
288
|
+
.to include "pizza is not a recognised document type"
|
265
289
|
end
|
266
290
|
|
267
291
|
it "Warns of illegal script" do
|
@@ -304,7 +328,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
304
328
|
|
305
329
|
text
|
306
330
|
INPUT
|
307
|
-
expect(File.read("test.err"))
|
331
|
+
expect(File.read("test.err"))
|
332
|
+
.to include "pizza is not a recognised substage"
|
308
333
|
end
|
309
334
|
|
310
335
|
it "Warns of illegal iteration" do
|
@@ -319,7 +344,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
319
344
|
|
320
345
|
text
|
321
346
|
INPUT
|
322
|
-
expect(File.read("test.err"))
|
347
|
+
expect(File.read("test.err"))
|
348
|
+
.to include "pizza is not a recognised iteration"
|
323
349
|
end
|
324
350
|
|
325
351
|
it "Warns of illegal script" do
|
@@ -349,7 +375,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
349
375
|
|
350
376
|
The widget is required not to be larger than 15 cm.
|
351
377
|
INPUT
|
352
|
-
expect(File.read("test.err"))
|
378
|
+
expect(File.read("test.err"))
|
379
|
+
.to include "Technical Report clause may contain requirement"
|
353
380
|
end
|
354
381
|
|
355
382
|
it "warns that introduction may contain requirement" do
|
@@ -359,7 +386,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
359
386
|
|
360
387
|
The widget is required not to be larger than 15 cm.
|
361
388
|
INPUT
|
362
|
-
expect(File.read("test.err"))
|
389
|
+
expect(File.read("test.err"))
|
390
|
+
.to include "Introduction may contain requirement"
|
363
391
|
end
|
364
392
|
|
365
393
|
it "warns that foreword may contain recommendation" do
|
@@ -370,7 +398,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
370
398
|
|
371
399
|
== Clause
|
372
400
|
INPUT
|
373
|
-
expect(File.read("test.err"))
|
401
|
+
expect(File.read("test.err"))
|
402
|
+
.to include "Foreword may contain recommendation"
|
374
403
|
end
|
375
404
|
|
376
405
|
it "warns that foreword may contain permission" do
|
@@ -405,7 +434,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
405
434
|
It is required that there is a definition.
|
406
435
|
|
407
436
|
INPUT
|
408
|
-
expect(File.read("test.err"))
|
437
|
+
expect(File.read("test.err"))
|
438
|
+
.to include "Definition may contain requirement"
|
409
439
|
end
|
410
440
|
|
411
441
|
it "warns that term example may contain recommendation" do
|
@@ -419,7 +449,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
419
449
|
[example]
|
420
450
|
It is not recommended that widgets should be larger than 15 cm.
|
421
451
|
INPUT
|
422
|
-
expect(File.read("test.err"))
|
452
|
+
expect(File.read("test.err"))
|
453
|
+
.to include "Example may contain recommendation"
|
423
454
|
end
|
424
455
|
|
425
456
|
it "warns that note may contain recommendation" do
|
@@ -437,7 +468,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
437
468
|
|
438
469
|
footnote:[It is not recommended that widgets should be larger than 15 cm.]
|
439
470
|
INPUT
|
440
|
-
expect(File.read("test.err"))
|
471
|
+
expect(File.read("test.err"))
|
472
|
+
.to include "Footnote may contain recommendation"
|
441
473
|
end
|
442
474
|
|
443
475
|
it "warns that term source is not in expected format" do
|
@@ -447,7 +479,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
447
479
|
[.source]
|
448
480
|
I am a generic paragraph
|
449
481
|
INPUT
|
450
|
-
expect(File.read("test.err"))
|
482
|
+
expect(File.read("test.err"))
|
483
|
+
.to include "term reference not in expected format"
|
451
484
|
end
|
452
485
|
|
453
486
|
it "warns that figure does not have title" do
|
@@ -472,7 +505,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
472
505
|
<1> This is one callout
|
473
506
|
<2> This is another callout
|
474
507
|
INPUT
|
475
|
-
expect(File.read("test.err"))
|
508
|
+
expect(File.read("test.err"))
|
509
|
+
.to include "mismatch of callouts and annotations"
|
476
510
|
end
|
477
511
|
|
478
512
|
it "warns that term source is not a real reference" do
|
@@ -482,7 +516,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
482
516
|
[.source]
|
483
517
|
<<iso123>>
|
484
518
|
INPUT
|
485
|
-
expect(File.read("test.err"))
|
519
|
+
expect(File.read("test.err"))
|
520
|
+
.to include "iso123 does not have a corresponding anchor ID "\
|
521
|
+
"in the bibliography"
|
486
522
|
end
|
487
523
|
|
488
524
|
it "warns that undated reference has locality" do
|
@@ -496,7 +532,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
496
532
|
== Normative References
|
497
533
|
* [[[iso123,ISO 123]]] _Standard_
|
498
534
|
INPUT
|
499
|
-
expect(File.read("test.err"))
|
535
|
+
expect(File.read("test.err"))
|
536
|
+
.to include "undated reference ISO 123 should not contain "\
|
537
|
+
"specific elements"
|
500
538
|
end
|
501
539
|
|
502
540
|
it "do not warn that undated reference which is a bibliographic reference has locality" do
|
@@ -510,7 +548,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
510
548
|
== Bibliography
|
511
549
|
* [[[iso123,1]]] _Standard_
|
512
550
|
INPUT
|
513
|
-
expect(File.read("test.err"))
|
551
|
+
expect(File.read("test.err"))
|
552
|
+
.not_to include "undated reference [1] should not contain specific "\
|
553
|
+
"elements"
|
514
554
|
end
|
515
555
|
|
516
556
|
it "do not warn that undated IEV reference has locality" do
|
@@ -524,7 +564,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
524
564
|
== Normative References
|
525
565
|
* [[[iev,IEV]]] _Standard_
|
526
566
|
INPUT
|
527
|
-
expect(File.read("test.err"))
|
567
|
+
expect(File.read("test.err"))
|
568
|
+
.not_to include "undated reference IEV should not contain specific "\
|
569
|
+
"elements"
|
528
570
|
end
|
529
571
|
|
530
572
|
it "do not warn that in print has locality" do
|
@@ -538,7 +580,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
538
580
|
== Normative References
|
539
581
|
* [[[iev,ISO 123:--]]] _Standard_
|
540
582
|
INPUT
|
541
|
-
expect(File.read("test.err"))
|
583
|
+
expect(File.read("test.err"))
|
584
|
+
.not_to include "undated reference ISO 123 should not contain specific "\
|
585
|
+
"elements"
|
542
586
|
end
|
543
587
|
|
544
588
|
it "warns of Non-reference in bibliography" do
|
@@ -559,7 +603,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
559
603
|
== Normative References
|
560
604
|
* [[[XYZ,IESO 121]]] _Standard_
|
561
605
|
INPUT
|
562
|
-
expect(File.read("test.err"))
|
606
|
+
expect(File.read("test.err"))
|
607
|
+
.to include "non-ISO/IEC reference not expected as normative"
|
563
608
|
end
|
564
609
|
|
565
610
|
it "warns that Scope contains subclauses" do
|
@@ -570,7 +615,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
570
615
|
|
571
616
|
=== Scope subclause
|
572
617
|
INPUT
|
573
|
-
expect(File.read("test.err"))
|
618
|
+
expect(File.read("test.err"))
|
619
|
+
.to include "Scope contains subclauses: should be succinct"
|
574
620
|
end
|
575
621
|
|
576
622
|
it "warns that Table should have title" do
|
@@ -601,7 +647,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
601
647
|
== Clause
|
602
648
|
ISO 12121
|
603
649
|
INPUT
|
604
|
-
expect(File.read("test.err"))
|
650
|
+
expect(File.read("test.err"))
|
651
|
+
.not_to include "number not broken up in threes"
|
605
652
|
end
|
606
653
|
|
607
654
|
it "Style warning if decimal point" do
|
@@ -641,7 +688,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
641
688
|
== Clause
|
642
689
|
95 ± 5 %
|
643
690
|
INPUT
|
644
|
-
expect(File.read("test.err"))
|
691
|
+
expect(File.read("test.err"))
|
692
|
+
.to include "unbracketed tolerance before percent sign"
|
645
693
|
end
|
646
694
|
|
647
695
|
it "Style warning if dots in abbreviation" do
|
@@ -681,7 +729,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
681
729
|
== Clause
|
682
730
|
5 °
|
683
731
|
INPUT
|
684
|
-
expect(File.read("test.err"))
|
732
|
+
expect(File.read("test.err"))
|
733
|
+
.to include "space between number and degrees/minutes/seconds"
|
685
734
|
end
|
686
735
|
|
687
736
|
it "Style warning if no space between number and SI unit" do
|
@@ -691,7 +740,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
691
740
|
== Clause
|
692
741
|
A measurement of 5Bq was taken.
|
693
742
|
INPUT
|
694
|
-
expect(File.read("test.err"))
|
743
|
+
expect(File.read("test.err"))
|
744
|
+
.to include "no space between number and SI unit"
|
695
745
|
end
|
696
746
|
|
697
747
|
it "Style warning if mins used" do
|
@@ -736,7 +786,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
736
786
|
|
737
787
|
== Symbols and Abbreviated Terms
|
738
788
|
INPUT
|
739
|
-
expect(File.read("test.err"))
|
789
|
+
expect(File.read("test.err"))
|
790
|
+
.to include "Only one Symbols and Abbreviated Terms section "\
|
791
|
+
"in the standard"
|
740
792
|
end
|
741
793
|
|
742
794
|
it "Style warning if Symbols and Abbreviated Terms contains extraneous matter" do
|
@@ -747,7 +799,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
747
799
|
|
748
800
|
Paragraph
|
749
801
|
INPUT
|
750
|
-
expect(File.read("test.err"))
|
802
|
+
expect(File.read("test.err"))
|
803
|
+
.to include "Symbols and Abbreviated Terms can only contain "\
|
804
|
+
"a definition list"
|
751
805
|
end
|
752
806
|
|
753
807
|
it "Warning if missing foreword" do
|
@@ -758,7 +812,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
758
812
|
|
759
813
|
Paragraph
|
760
814
|
INPUT
|
761
|
-
expect(File.read("test.err"))
|
815
|
+
expect(File.read("test.err"))
|
816
|
+
.to include "Initial section must be (content) Foreword"
|
762
817
|
|
763
818
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
764
819
|
= Document title
|
@@ -772,7 +827,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
772
827
|
|
773
828
|
Paragraph
|
774
829
|
INPUT
|
775
|
-
expect(File.read("test.err"))
|
830
|
+
expect(File.read("test.err"))
|
831
|
+
.not_to include "Initial section must be (content) Foreword"
|
776
832
|
end
|
777
833
|
|
778
834
|
it "Warning if do not start with scope or introduction" do
|
@@ -784,7 +840,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
784
840
|
|
785
841
|
Paragraph
|
786
842
|
INPUT
|
787
|
-
expect(File.read("test.err"))
|
843
|
+
expect(File.read("test.err"))
|
844
|
+
.to include "Prefatory material must be followed by (clause) Scope"
|
788
845
|
|
789
846
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
790
847
|
= Document title
|
@@ -800,7 +857,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
800
857
|
|
801
858
|
Paragraph
|
802
859
|
INPUT
|
803
|
-
expect(File.read("test.err"))
|
860
|
+
expect(File.read("test.err"))
|
861
|
+
.not_to include "Prefatory material must be followed by (clause) Scope"
|
804
862
|
end
|
805
863
|
|
806
864
|
it "Warning if introduction not followed by scope" do
|
@@ -816,7 +874,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
816
874
|
|
817
875
|
Paragraph
|
818
876
|
INPUT
|
819
|
-
expect(File.read("test.err"))
|
877
|
+
expect(File.read("test.err"))
|
878
|
+
.to include "Prefatory material must be followed by (clause) Scope"
|
820
879
|
|
821
880
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
822
881
|
= Document title
|
@@ -835,7 +894,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
835
894
|
|
836
895
|
Paragraph
|
837
896
|
INPUT
|
838
|
-
expect(File.read("test.err"))
|
897
|
+
expect(File.read("test.err"))
|
898
|
+
.not_to include "Prefatory material must be followed by (clause) Scope"
|
839
899
|
end
|
840
900
|
|
841
901
|
it "Warning if normative references not followed by terms and definitions" do
|
@@ -854,7 +914,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
854
914
|
|
855
915
|
Paragraph
|
856
916
|
INPUT
|
857
|
-
expect(File.read("test.err"))
|
917
|
+
expect(File.read("test.err"))
|
918
|
+
.to include "Normative References must be followed by "\
|
919
|
+
"Terms and Definitions"
|
858
920
|
|
859
921
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
860
922
|
= Document title
|
@@ -876,7 +938,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
876
938
|
|
877
939
|
Paragraph
|
878
940
|
INPUT
|
879
|
-
expect(File.read("test.err"))
|
941
|
+
expect(File.read("test.err"))
|
942
|
+
.not_to include "Normative References must be followed by "\
|
943
|
+
"Terms and Definitions"
|
880
944
|
end
|
881
945
|
|
882
946
|
it "Warning if there are no clauses in the document" do
|
@@ -896,7 +960,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
896
960
|
== Symbols and Abbreviated Terms
|
897
961
|
|
898
962
|
INPUT
|
899
|
-
expect(File.read("test.err"))
|
963
|
+
expect(File.read("test.err"))
|
964
|
+
.to include "Document must contain at least one clause"
|
900
965
|
|
901
966
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
902
967
|
= Document title
|
@@ -919,7 +984,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
919
984
|
== Symbols and Abbreviated Terms
|
920
985
|
|
921
986
|
INPUT
|
922
|
-
expect(File.read("test.err"))
|
987
|
+
expect(File.read("test.err"))
|
988
|
+
.not_to include "Document must contain at least one clause"
|
923
989
|
end
|
924
990
|
|
925
991
|
it "Warning if scope occurs after Terms and Definitions" do
|
@@ -941,7 +1007,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
941
1007
|
== Scope
|
942
1008
|
|
943
1009
|
INPUT
|
944
|
-
expect(File.read("test.err"))
|
1010
|
+
expect(File.read("test.err"))
|
1011
|
+
.to include "Scope must occur before Terms and Definitions"
|
945
1012
|
|
946
1013
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
947
1014
|
= Document title
|
@@ -966,7 +1033,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
966
1033
|
== Scope
|
967
1034
|
|
968
1035
|
INPUT
|
969
|
-
expect(File.read("test.err"))
|
1036
|
+
expect(File.read("test.err"))
|
1037
|
+
.not_to include "Scope must occur before Terms and Definitions"
|
970
1038
|
end
|
971
1039
|
|
972
1040
|
it "Warning if Symbols and Abbreviated Terms does not occur immediately after Terms and Definitions" do
|
@@ -988,7 +1056,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
988
1056
|
== Symbols and Abbreviated Terms
|
989
1057
|
|
990
1058
|
INPUT
|
991
|
-
expect(File.read("test.err"))
|
1059
|
+
expect(File.read("test.err"))
|
1060
|
+
.to include "Only annexes and references can follow clauses"
|
992
1061
|
|
993
1062
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
994
1063
|
= Document title
|
@@ -1014,7 +1083,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1014
1083
|
== Symbols and Abbreviated Terms
|
1015
1084
|
|
1016
1085
|
INPUT
|
1017
|
-
expect(File.read("test.err"))
|
1086
|
+
expect(File.read("test.err"))
|
1087
|
+
.not_to include "Only annexes and references can follow clauses"
|
1018
1088
|
end
|
1019
1089
|
|
1020
1090
|
it "Warning if no normative references" do
|
@@ -1040,7 +1110,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1040
1110
|
== Appendix C
|
1041
1111
|
|
1042
1112
|
INPUT
|
1043
|
-
expect(File.read("test.err"))
|
1113
|
+
expect(File.read("test.err"))
|
1114
|
+
.to include "Document must include (references) Normative References"
|
1044
1115
|
|
1045
1116
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
1046
1117
|
= Document title
|
@@ -1069,9 +1140,57 @@ RSpec.describe Asciidoctor::ISO do
|
|
1069
1140
|
== Appendix C
|
1070
1141
|
|
1071
1142
|
INPUT
|
1072
|
-
expect(File.read("test.err"))
|
1143
|
+
expect(File.read("test.err"))
|
1144
|
+
.not_to include "Document must include (references) Normative References"
|
1073
1145
|
end
|
1074
1146
|
|
1147
|
+
it "Warning if there are two Terms sections" do
|
1148
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
1149
|
+
#{VALIDATING_BLANK_HDR}
|
1150
|
+
|
1151
|
+
== Scope
|
1152
|
+
|
1153
|
+
== Terms and definitions
|
1154
|
+
|
1155
|
+
== A Clause
|
1156
|
+
|
1157
|
+
[heading=terms and definitions]
|
1158
|
+
== Terms related to clinical psychology
|
1159
|
+
|
1160
|
+
INPUT
|
1161
|
+
expect(File.read("test.err"))
|
1162
|
+
.to include "Only annexes and references can follow clauses"
|
1163
|
+
end
|
1164
|
+
|
1165
|
+
it "No warning if there are two Terms sections in a Vocabulary document" do
|
1166
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
1167
|
+
= Document title
|
1168
|
+
Author
|
1169
|
+
:docfile: test.adoc
|
1170
|
+
:nodoc:
|
1171
|
+
:no-isobib:
|
1172
|
+
:docsubtype: vocabulary
|
1173
|
+
|
1174
|
+
== Scope
|
1175
|
+
|
1176
|
+
== Terms and definitions
|
1177
|
+
|
1178
|
+
== A Clause
|
1179
|
+
|
1180
|
+
[heading=terms and definitions]
|
1181
|
+
== Terms related to clinical psychology
|
1182
|
+
|
1183
|
+
[heading=symbols and abbreviated terms]
|
1184
|
+
== Symbols related to clinical psychology
|
1185
|
+
|
1186
|
+
INPUT
|
1187
|
+
expect(File.read("test.err"))
|
1188
|
+
.not_to include "Only annexes and references can follow clauses"
|
1189
|
+
expect(File.read("test.err"))
|
1190
|
+
.to include "Only terms, annexes and references can follow clauses"
|
1191
|
+
end
|
1192
|
+
|
1193
|
+
|
1075
1194
|
it "Warning if final section is not named Bibliography" do
|
1076
1195
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
1077
1196
|
#{VALIDATING_BLANK_HDR}
|
@@ -1101,7 +1220,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1101
1220
|
== Appendix C
|
1102
1221
|
|
1103
1222
|
INPUT
|
1104
|
-
expect(File.read("test.err"))
|
1223
|
+
expect(File.read("test.err"))
|
1224
|
+
.to include "There are sections after the final Bibliography"
|
1105
1225
|
|
1106
1226
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
1107
1227
|
= Document title
|
@@ -1136,7 +1256,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1136
1256
|
== Appendix C
|
1137
1257
|
|
1138
1258
|
INPUT
|
1139
|
-
expect(File.read("test.err"))
|
1259
|
+
expect(File.read("test.err"))
|
1260
|
+
.not_to include "There are sections after the final Bibliography"
|
1140
1261
|
end
|
1141
1262
|
|
1142
1263
|
it "Warning if final section is not styled Bibliography" do
|
@@ -1164,7 +1285,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1164
1285
|
== Bibliography
|
1165
1286
|
|
1166
1287
|
INPUT
|
1167
|
-
expect(File.read("test.err"))
|
1288
|
+
expect(File.read("test.err"))
|
1289
|
+
.to include "Section not marked up as [bibliography]"
|
1168
1290
|
end
|
1169
1291
|
|
1170
1292
|
it "Warning if final section is not styled Bibliography false" do
|
@@ -1197,7 +1319,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1197
1319
|
== Bibliography
|
1198
1320
|
|
1199
1321
|
INPUT
|
1200
|
-
expect(File.read("test.err"))
|
1322
|
+
expect(File.read("test.err"))
|
1323
|
+
.not_to include "Section not marked up as [bibliography]"
|
1201
1324
|
end
|
1202
1325
|
|
1203
1326
|
it "Warning if English title intro and no French title intro" do
|
@@ -1226,7 +1349,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
1226
1349
|
expect(File.read("test.err")).to include "No English Title Intro"
|
1227
1350
|
end
|
1228
1351
|
|
1229
|
-
it "Warning if English title and no French
|
1352
|
+
it "Warning if English title and no French title" do
|
1230
1353
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
1231
1354
|
= Document title
|
1232
1355
|
Author
|
@@ -1237,6 +1360,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
1237
1360
|
|
1238
1361
|
INPUT
|
1239
1362
|
expect(File.read("test.err")).to include "No French Title"
|
1363
|
+
expect(File.read("test.err")).not_to include "No French Intro"
|
1240
1364
|
end
|
1241
1365
|
|
1242
1366
|
it "Warning if French title and no English title" do
|
@@ -1278,6 +1402,21 @@ RSpec.describe Asciidoctor::ISO do
|
|
1278
1402
|
expect(File.read("test.err")).to include "No English Title Part"
|
1279
1403
|
end
|
1280
1404
|
|
1405
|
+
it "No warning if French main title and English main title" do
|
1406
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
1407
|
+
= Document title
|
1408
|
+
Author
|
1409
|
+
:docfile: test.adoc
|
1410
|
+
:nodoc:
|
1411
|
+
:title-part-fr: Title
|
1412
|
+
:title-part-en: Title
|
1413
|
+
:no-isobib:
|
1414
|
+
|
1415
|
+
INPUT
|
1416
|
+
expect(File.read("test.err")).not_to include "No French Title Intro"
|
1417
|
+
expect(File.read("test.err")).not_to include "No French Title Part"
|
1418
|
+
end
|
1419
|
+
|
1281
1420
|
it "Warning if non-IEC document with subpart" do
|
1282
1421
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
1283
1422
|
= Document title
|
@@ -1290,7 +1429,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1290
1429
|
:no-isobib:
|
1291
1430
|
|
1292
1431
|
INPUT
|
1293
|
-
expect(File.read("test.err"))
|
1432
|
+
expect(File.read("test.err"))
|
1433
|
+
.to include "Subpart defined on non-IEC document"
|
1294
1434
|
end
|
1295
1435
|
|
1296
1436
|
it "No warning if joint IEC/non-IEC document with subpart" do
|
@@ -1305,7 +1445,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1305
1445
|
:no-isobib:
|
1306
1446
|
|
1307
1447
|
INPUT
|
1308
|
-
expect(File.read("test.err"))
|
1448
|
+
expect(File.read("test.err"))
|
1449
|
+
.not_to include "Subpart defined on non-IEC document"
|
1309
1450
|
end
|
1310
1451
|
|
1311
1452
|
it "Warning if main title contains document type" do
|
@@ -1331,7 +1472,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1331
1472
|
:no-isobib:
|
1332
1473
|
|
1333
1474
|
INPUT
|
1334
|
-
expect(File.read("test.err"))
|
1475
|
+
expect(File.read("test.err"))
|
1476
|
+
.to include "Title Intro may name document type"
|
1335
1477
|
end
|
1336
1478
|
|
1337
1479
|
it "Each first-level subclause must have a title" do
|
@@ -1341,7 +1483,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1341
1483
|
|
1342
1484
|
=== {blank}
|
1343
1485
|
INPUT
|
1344
|
-
expect(File.read("test.err"))
|
1486
|
+
expect(File.read("test.err"))
|
1487
|
+
.to include "each first-level subclause must have a title"
|
1345
1488
|
end
|
1346
1489
|
|
1347
1490
|
it "All subclauses must have a title, or none" do
|
@@ -1355,7 +1498,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1355
1498
|
|
1356
1499
|
==== Subsubclause
|
1357
1500
|
INPUT
|
1358
|
-
expect(File.read("test.err"))
|
1501
|
+
expect(File.read("test.err"))
|
1502
|
+
.to include "all subclauses must have a title, or none"
|
1359
1503
|
end
|
1360
1504
|
|
1361
1505
|
it "Warning if subclause is only child of its parent, or none" do
|
@@ -1417,7 +1561,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1417
1561
|
== Clause
|
1418
1562
|
See <<terms>>
|
1419
1563
|
INPUT
|
1420
|
-
expect(File.read("test.err"))
|
1564
|
+
expect(File.read("test.err"))
|
1565
|
+
.to include "'see terms' is pointing to a normative section"
|
1421
1566
|
end
|
1422
1567
|
|
1423
1568
|
it "Warning if 'see' reference points to normative reference" do
|
@@ -1430,7 +1575,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1430
1575
|
== Clause
|
1431
1576
|
See <<terms>>
|
1432
1577
|
INPUT
|
1433
|
-
expect(File.read("test.err"))
|
1578
|
+
expect(File.read("test.err"))
|
1579
|
+
.to include "is pointing to a normative reference"
|
1434
1580
|
end
|
1435
1581
|
|
1436
1582
|
it "Warning if term definition starts with article" do
|
@@ -1442,7 +1588,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1442
1588
|
|
1443
1589
|
The definition of a term is a part of the specialized vocabulary of a particular field
|
1444
1590
|
INPUT
|
1445
|
-
expect(File.read("test.err"))
|
1591
|
+
expect(File.read("test.err"))
|
1592
|
+
.to include "term definition starts with article"
|
1446
1593
|
end
|
1447
1594
|
|
1448
1595
|
it "Warning if term definition ends with period" do
|
@@ -1464,7 +1611,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1464
1611
|
[align=mid-air]
|
1465
1612
|
Para
|
1466
1613
|
INPUT
|
1467
|
-
expect(File.read("test.err"))
|
1614
|
+
expect(File.read("test.err"))
|
1615
|
+
.to include 'value of attribute "align" is invalid; must be equal to'
|
1468
1616
|
end
|
1469
1617
|
|
1470
1618
|
it "Warn if more than 7 levels of subclause" do
|
@@ -1496,7 +1644,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1496
1644
|
====== Clause
|
1497
1645
|
|
1498
1646
|
INPUT
|
1499
|
-
expect(File.read("test.err"))
|
1647
|
+
expect(File.read("test.err"))
|
1648
|
+
.to include "Exceeds the maximum clause depth of 7"
|
1500
1649
|
end
|
1501
1650
|
|
1502
1651
|
it "Do not warn if not more than 7 levels of subclause" do
|
@@ -1525,7 +1674,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1525
1674
|
====== Clause
|
1526
1675
|
|
1527
1676
|
INPUT
|
1528
|
-
expect(File.read("test.err"))
|
1677
|
+
expect(File.read("test.err"))
|
1678
|
+
.not_to include "exceeds the maximum clause depth of 7"
|
1529
1679
|
end
|
1530
1680
|
|
1531
1681
|
it "Warn if term citation in Terms & Definitions not preceded with italicised term" do
|
@@ -1538,7 +1688,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1538
1688
|
|
1539
1689
|
The definition of a term (<<term>>) is a part of the specialized vocabulary of a particular field
|
1540
1690
|
INPUT
|
1541
|
-
expect(File.read("test.err"))
|
1691
|
+
expect(File.read("test.err"))
|
1692
|
+
.to include "term citation not preceded with italicised term"
|
1542
1693
|
end
|
1543
1694
|
|
1544
1695
|
it "Warn if an undated reference has no associated footnote" do
|
@@ -1549,7 +1700,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1549
1700
|
== Bibliography
|
1550
1701
|
* [[[ISO8,ISO 8:--]]], _Title_
|
1551
1702
|
INPUT
|
1552
|
-
expect(File.read("test.err"))
|
1553
|
-
"Reference ISO8 does not have an associated footnote
|
1703
|
+
expect(File.read("test.err"))
|
1704
|
+
.to include "Reference ISO8 does not have an associated footnote "\
|
1705
|
+
"indicating unpublished status"
|
1554
1706
|
end
|
1555
1707
|
end
|