metanorma-iso 1.7.1 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +11 -41
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +6 -2
  5. data/lib/asciidoctor/iso/base.rb +18 -16
  6. data/lib/asciidoctor/iso/biblio.rng +4 -6
  7. data/lib/asciidoctor/iso/cleanup.rb +28 -24
  8. data/lib/asciidoctor/iso/front.rb +26 -16
  9. data/lib/asciidoctor/iso/front_id.rb +30 -25
  10. data/lib/asciidoctor/iso/isodoc.rng +172 -3
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +17 -97
  13. data/lib/asciidoctor/iso/validate.rb +22 -109
  14. data/lib/asciidoctor/iso/validate_image.rb +97 -0
  15. data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
  16. data/lib/asciidoctor/iso/validate_section.rb +39 -20
  17. data/lib/asciidoctor/iso/validate_style.rb +36 -24
  18. data/lib/asciidoctor/iso/validate_title.rb +23 -17
  19. data/lib/isodoc/iso/base_convert.rb +19 -2
  20. data/lib/isodoc/iso/html/style-human.css +7 -0
  21. data/lib/isodoc/iso/html/style-iso.css +7 -0
  22. data/lib/isodoc/iso/html_convert.rb +0 -1
  23. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  24. data/lib/isodoc/iso/i18n-fr.yaml +4 -0
  25. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  26. data/lib/isodoc/iso/index.rb +140 -0
  27. data/lib/isodoc/iso/iso.amendment.xsl +1092 -208
  28. data/lib/isodoc/iso/iso.international-standard.xsl +1092 -208
  29. data/lib/isodoc/iso/presentation_xml_convert.rb +45 -37
  30. data/lib/isodoc/iso/word_convert.rb +0 -1
  31. data/lib/isodoc/iso/xref.rb +15 -7
  32. data/lib/metanorma/iso/processor.rb +1 -0
  33. data/lib/metanorma/iso/version.rb +1 -1
  34. data/metanorma-iso.gemspec +8 -8
  35. data/spec/asciidoctor/amd_spec.rb +696 -0
  36. data/spec/asciidoctor/base_spec.rb +733 -0
  37. data/spec/asciidoctor/blocks_spec.rb +527 -0
  38. data/spec/asciidoctor/cleanup_spec.rb +1134 -0
  39. data/spec/asciidoctor/inline_spec.rb +195 -0
  40. data/spec/asciidoctor/lists_spec.rb +197 -0
  41. data/spec/asciidoctor/refs_spec.rb +375 -0
  42. data/spec/asciidoctor/section_spec.rb +393 -0
  43. data/spec/asciidoctor/table_spec.rb +329 -0
  44. data/spec/asciidoctor/validate_spec.rb +1627 -0
  45. data/spec/isodoc/amd_spec.rb +967 -946
  46. data/spec/isodoc/blocks_spec.rb +530 -507
  47. data/spec/isodoc/i18n_spec.rb +953 -911
  48. data/spec/isodoc/inline_spec.rb +355 -293
  49. data/spec/isodoc/iso_spec.rb +338 -314
  50. data/spec/isodoc/metadata_spec.rb +392 -382
  51. data/spec/isodoc/postproc_spec.rb +836 -657
  52. data/spec/isodoc/ref_spec.rb +374 -331
  53. data/spec/isodoc/section_spec.rb +821 -519
  54. data/spec/isodoc/table_spec.rb +472 -411
  55. data/spec/isodoc/terms_spec.rb +209 -185
  56. data/spec/isodoc/xref_spec.rb +1370 -1236
  57. data/spec/metanorma/processor_spec.rb +28 -26
  58. data/spec/spec_helper.rb +178 -193
  59. metadata +65 -66
  60. data/.rubocop.ribose.yml +0 -66
  61. data/lib/isodoc/iso/html/scripts.html +0 -178
  62. data/spec/asciidoctor-iso/amd_spec.rb +0 -694
  63. data/spec/asciidoctor-iso/base_spec.rb +0 -713
  64. data/spec/asciidoctor-iso/blocks_spec.rb +0 -482
  65. data/spec/asciidoctor-iso/cleanup_spec.rb +0 -1025
  66. data/spec/asciidoctor-iso/inline_spec.rb +0 -170
  67. data/spec/asciidoctor-iso/lists_spec.rb +0 -190
  68. data/spec/asciidoctor-iso/refs_spec.rb +0 -317
  69. data/spec/asciidoctor-iso/section_spec.rb +0 -362
  70. data/spec/asciidoctor-iso/table_spec.rb +0 -313
  71. data/spec/asciidoctor-iso/validate_spec.rb +0 -1621
  72. data/spec/assets/xref_error.adoc +0 -7
@@ -0,0 +1,1627 @@
1
+ require "spec_helper"
2
+ require "fileutils"
3
+
4
+ RSpec.describe Asciidoctor::ISO do
5
+ context "when xref_error.adoc compilation" do
6
+ it "generates error file" do
7
+ FileUtils.rm_f "xref_error.err"
8
+ File.write("xref_error.adoc", <<~"CONTENT")
9
+ = X
10
+ A
11
+
12
+ == Clause
13
+
14
+ <<a,b>>
15
+ CONTENT
16
+
17
+ expect do
18
+ mock_pdf
19
+ Metanorma::Compile
20
+ .new
21
+ .compile("xref_error.adoc", type: "iso", no_install_fonts: true)
22
+ end.to(change { File.exist?("xref_error.err") }
23
+ .from(false).to(true))
24
+ end
25
+ end
26
+
27
+ it "Warns of image names not compliant with DRG" do
28
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
29
+ = Document title
30
+ Author
31
+ :docfile: test.adoc
32
+ :nodoc:
33
+ :no-isobib:
34
+ :docnumber: 1000
35
+ :partnumber: 1
36
+ :edition: 2
37
+ :amendment-number: 3
38
+
39
+ .Split-it-right sample divider
40
+ image::spec/examples/rice_images/rice_image1.png[]
41
+ image::spec/examples/rice_images/SL1000-1_ed2amd3fig1.png[]
42
+ image::spec/examples/rice_images/1001_ed2amd3fig1.png[]
43
+ image::spec/examples/rice_images/ISO_1213_1.png[]
44
+ image::spec/examples/rice_images/1000-1_ed2amd3figA.png[]
45
+
46
+ |===
47
+ |a |b
48
+
49
+ a|image::spec/examples/rice_images/1000-1_ed2amd3figTab1.png[]#{' '}
50
+ a|image::spec/examples/rice_images/1000-1_ed2amd3fig2.png[]
51
+ |===
52
+
53
+ image::spec/examples/rice_images/1000-1_ed2amd3figTab2.png[]
54
+
55
+ image::spec/examples/rice_images/1000-1_ed2amd3figA1.png[]
56
+ image::spec/examples/rice_images/1000-1_ed2amd3fig1a.png[]
57
+
58
+ .Stages of gelatinization
59
+ ====
60
+ image::spec/examples/rice_images/1000-1_ed2amd3fig1b.png[]
61
+
62
+ image::spec/examples/rice_images/1000-1_ed2amd3fig4.png[]
63
+ ====
64
+
65
+ image::spec/examples/rice_images/1000-1_ed2amd3fig5_f.png[]
66
+
67
+ [appendix]
68
+ == Annex
69
+ image::spec/examples/rice_images/1000-1_ed2amd3figA2.png[]
70
+ image::spec/examples/rice_images/1000-1_ed2amd3fig3.png[]
71
+
72
+ INPUT
73
+ expect(File.read("test.err")).to include \
74
+ "image name spec/examples/rice_images/rice_image1.png does not match "\
75
+ "DRG requirements: expect 1000-1_ed2amd3fig"
76
+ expect(File.read("test.err")).to include \
77
+ "image name spec/examples/rice_images/1001_ed2amd3fig1.png does not "\
78
+ "match DRG requirements: " \
79
+ "expect 1000-1_ed2amd3fig"
80
+ expect(File.read("test.err")).not_to include \
81
+ "image name spec/examples/rice_images/SL1000-1_ed2amd3fig1.png does not "\
82
+ "match DRG requirements: " \
83
+ "expect 1000-1_ed2amd3fig"
84
+ expect(File.read("test.err")).not_to include \
85
+ "image name spec/examples/rice_images/ISO_1213_1.png does not match DRG "\
86
+ "requirements: expect 1000-1_ed2amd3fig"
87
+ expect(File.read("test.err")).to include \
88
+ "image name spec/examples/rice_images/1000-1_ed2amd3figA.png does not "\
89
+ "match DRG requirements"
90
+ expect(File.read("test.err")).not_to include \
91
+ "image name spec/examples/rice_images/1000-1_ed2amd3figTab1.png does "\
92
+ "not match DRG requirements"
93
+ expect(File.read("test.err")).not_to include \
94
+ "image name spec/examples/rice_images/1000-1_ed2amd3figTab1.png is "\
95
+ "under a table but is not so labelled"
96
+ expect(File.read("test.err")).to include \
97
+ "image name spec/examples/rice_images/1000-1_ed2amd3fig2.png is under "\
98
+ "a table but is not so labelled"
99
+ expect(File.read("test.err")).to include \
100
+ "image name spec/examples/rice_images/1000-1_ed2amd3figTab2.png is "\
101
+ "labelled as under a table but is not"
102
+ expect(File.read("test.err")).not_to include \
103
+ "image name spec/examples/rice_images/1000-1_ed2amd3fig1.png is "\
104
+ "labelled as under a table but is not"
105
+ expect(File.read("test.err")).not_to include \
106
+ "image name spec/examples/rice_images/1000-1_ed2amd3figA2.png is "\
107
+ "under an annex but is not so labelled"
108
+ expect(File.read("test.err")).to include \
109
+ "image name spec/examples/rice_images/1000-1_ed2amd3fig3.png is "\
110
+ "under an annex but is not so labelled"
111
+ expect(File.read("test.err")).to include \
112
+ "image name spec/examples/rice_images/1000-1_ed2amd3figA1.png is "\
113
+ "labelled as under an annex but is not"
114
+ expect(File.read("test.err")).not_to include \
115
+ "image name spec/examples/rice_images/1000-1_ed2amd3fig1.png is "\
116
+ "labelled as under an annex but is not"
117
+ expect(File.read("test.err")).not_to include \
118
+ "image name spec/examples/rice_images/1000-1_ed2amd3fig1b.png has a "\
119
+ "subfigure letter but is not a subfigure"
120
+ expect(File.read("test.err")).to include \
121
+ "image name spec/examples/rice_images/1000-1_ed2amd3fig4.png does not "\
122
+ "have a subfigure letter but is a subfigure"
123
+ expect(File.read("test.err")).to include \
124
+ "image name spec/examples/rice_images/1000-1_ed2amd3fig1a.png has a "\
125
+ "subfigure letter but is not a subfigure"
126
+ expect(File.read("test.err")).not_to include \
127
+ "image name spec/examples/rice_images/1000-1_ed2amd3fig1.png has a "\
128
+ "subfigure letter but is not a subfigure"
129
+ expect(File.read("test.err")).to include \
130
+ "image name spec/examples/rice_images/1000-1_ed2amd3fig5_f.png expected "\
131
+ "to have suffix _e"
132
+ expect(File.read("test.err")).not_to include \
133
+ "image name spec/examples/rice_images/1000-1_ed2amd3fig1.png expected "\
134
+ "to have suffix _e"
135
+ end
136
+
137
+ context "Warns of missing scope" do
138
+ it "Scope clause missing" do
139
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
140
+ = Document title
141
+ Author
142
+ :docfile: test.adoc
143
+ :nodoc:
144
+ :no-isobib:
145
+ :doctype: pizza
146
+
147
+ text
148
+ INPUT
149
+
150
+ expect(File.read("test.err")).to include "Scope clause missing"
151
+ end
152
+
153
+ it "Scope clause not missing 1" do
154
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
155
+ = Document title
156
+ Author
157
+ :docfile: test.adoc
158
+ :nodoc:
159
+ :no-isobib:
160
+ :doctype: pizza
161
+
162
+ == Scope
163
+ INPUT
164
+ expect(File.read("test.err")).not_to include "Scope clause missing"
165
+ end
166
+
167
+ it "Scope clause not missing 2" do
168
+ FileUtils.rm_f "test.err"
169
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
170
+ = Document title
171
+ Author
172
+ :docfile: test.adoc
173
+ :nodoc:
174
+ :no-isobib:
175
+ :doctype: amendment
176
+
177
+ text
178
+ INPUT
179
+ expect(File.read("test.err")).not_to include "Scope clause missing"
180
+ end
181
+ end
182
+
183
+ context "Warns of missing normative references" do
184
+ it "Normative references missing" do
185
+ FileUtils.rm_f "test.err"
186
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
187
+ = Document title
188
+ Author
189
+ :docfile: test.adoc
190
+ :nodoc:
191
+ :no-isobib:
192
+ :doctype: pizza
193
+
194
+ text
195
+ INPUT
196
+ expect(File.read("test.err")).to include "Normative references missing"
197
+ end
198
+
199
+ it "Normative references not missing 1" do
200
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
201
+ = Document title
202
+ Author
203
+ :docfile: test.adoc
204
+ :nodoc:
205
+ :no-isobib:
206
+ :doctype: pizza
207
+
208
+ [bibliography]
209
+ == Normative references
210
+ INPUT
211
+ expect(File.read("test.err"))
212
+ .not_to include "Normative references missing"
213
+ end
214
+
215
+ it "Normative references not missing 2" do
216
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
217
+ = Document title
218
+ Author
219
+ :docfile: test.adoc
220
+ :nodoc:
221
+ :no-isobib:
222
+ :doctype: amendment
223
+
224
+ text
225
+ INPUT
226
+ expect(File.read("test.err"))
227
+ .not_to include "Normative references missing"
228
+ end
229
+ end
230
+
231
+ context "Warns of missing terms & definitions" do
232
+ it "Terms & definitions missing" do
233
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
234
+ = Document title
235
+ Author
236
+ :docfile: test.adoc
237
+ :nodoc:
238
+ :no-isobib:
239
+ :doctype: pizza
240
+
241
+ text
242
+ INPUT
243
+ expect(File.read("test.err")).to include "Terms & definitions missing"
244
+ end
245
+
246
+ it "Terms & definitions not missing 1" do
247
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
248
+ = Document title
249
+ Author
250
+ :docfile: test.adoc
251
+ :nodoc:
252
+ :no-isobib:
253
+ :doctype: pizza
254
+
255
+ == Terms and definitions
256
+ === Term 1
257
+ INPUT
258
+ expect(File.read("test.err")).not_to include "Terms & definitions missing"
259
+ end
260
+
261
+ it "Terms & definitions not missing 2" do
262
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
263
+ = Document title
264
+ Author
265
+ :docfile: test.adoc
266
+ :nodoc:
267
+ :no-isobib:
268
+ :doctype: amendment
269
+
270
+ text
271
+ INPUT
272
+ expect(File.read("test.err")).not_to include "Terms & definitions missing"
273
+ end
274
+ end
275
+
276
+ it "Warns of illegal doctype" do
277
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
278
+ = Document title
279
+ Author
280
+ :docfile: test.adoc
281
+ :nodoc:
282
+ :no-isobib:
283
+ :doctype: pizza
284
+
285
+ text
286
+ INPUT
287
+ expect(File.read("test.err"))
288
+ .to include "pizza is not a recognised document type"
289
+ end
290
+
291
+ it "Warns of illegal script" do
292
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
293
+ = Document title
294
+ Author
295
+ :docfile: test.adoc
296
+ :nodoc:
297
+ :no-isobib:
298
+ :script: pizza
299
+
300
+ text
301
+ INPUT
302
+ expect(File.read("test.err")).to include "pizza is not a recognised script"
303
+ end
304
+
305
+ it "Warns of illegal stage" do
306
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
307
+ = Document title
308
+ Author
309
+ :docfile: test.adoc
310
+ :nodoc:
311
+ :no-isobib:
312
+ :status: pizza
313
+
314
+ text
315
+ INPUT
316
+ expect(File.read("test.err")).to include "pizza is not a recognised stage"
317
+ end
318
+
319
+ it "Warns of illegal substage" do
320
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
321
+ = Document title
322
+ Author
323
+ :docfile: test.adoc
324
+ :nodoc:
325
+ :no-isobib:
326
+ :status: 60
327
+ :docsubstage: pizza
328
+
329
+ text
330
+ INPUT
331
+ expect(File.read("test.err"))
332
+ .to include "pizza is not a recognised substage"
333
+ end
334
+
335
+ it "Warns of illegal iteration" do
336
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
337
+ = Document title
338
+ Author
339
+ :docfile: test.adoc
340
+ :nodoc:
341
+ :no-isobib:
342
+ :status: 60
343
+ :iteration: pizza
344
+
345
+ text
346
+ INPUT
347
+ expect(File.read("test.err"))
348
+ .to include "pizza is not a recognised iteration"
349
+ end
350
+
351
+ it "Warns of illegal script" do
352
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
353
+ = Document title
354
+ Author
355
+ :docfile: test.adoc
356
+ :nodoc:
357
+ :no-isobib:
358
+ :script: pizza
359
+
360
+ text
361
+ INPUT
362
+ expect(File.read("test.err")).to include "pizza is not a recognised script"
363
+ end
364
+
365
+ it "warns that technical report may contain requirement" do
366
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
367
+ = Document title
368
+ Author
369
+ :docfile: test.adoc
370
+ :nodoc:
371
+ :no-isobib:
372
+ :doctype: technical-report
373
+
374
+ == Random clause
375
+
376
+ The widget is required not to be larger than 15 cm.
377
+ INPUT
378
+ expect(File.read("test.err"))
379
+ .to include "Technical Report clause may contain requirement"
380
+ end
381
+
382
+ it "warns that introduction may contain requirement" do
383
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
384
+ #{VALIDATING_BLANK_HDR}
385
+ == Introduction
386
+
387
+ The widget is required not to be larger than 15 cm.
388
+ INPUT
389
+ expect(File.read("test.err"))
390
+ .to include "Introduction may contain requirement"
391
+ end
392
+
393
+ it "warns that foreword may contain recommendation" do
394
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
395
+ #{VALIDATING_BLANK_HDR}
396
+
397
+ It is not recommended that widgets should be larger than 15 cm.
398
+
399
+ == Clause
400
+ INPUT
401
+ expect(File.read("test.err"))
402
+ .to include "Foreword may contain recommendation"
403
+ end
404
+
405
+ it "warns that foreword may contain permission" do
406
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
407
+ #{VALIDATING_BLANK_HDR}
408
+
409
+ No widget is required to be larger than 15 cm.
410
+
411
+ == Clause
412
+ INPUT
413
+ expect(File.read("test.err")).to include "Foreword may contain permission"
414
+ end
415
+
416
+ it "warns that scope may contain recommendation" do
417
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
418
+ #{VALIDATING_BLANK_HDR}
419
+
420
+ == Scope
421
+ It is not recommended that widgets should be larger than 15 cm.
422
+ INPUT
423
+ expect(File.read("test.err")).to include "Scope may contain recommendation"
424
+ end
425
+
426
+ it "warns that definition may contain requirement" do
427
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
428
+ #{VALIDATING_BLANK_HDR}
429
+
430
+ == Terms and Definitions
431
+
432
+ === Term1
433
+
434
+ It is required that there is a definition.
435
+
436
+ INPUT
437
+ expect(File.read("test.err"))
438
+ .to include "Definition may contain requirement"
439
+ end
440
+
441
+ it "warns that term example may contain recommendation" do
442
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
443
+ #{VALIDATING_BLANK_HDR}
444
+
445
+ == Terms and Definitions
446
+
447
+ === Term
448
+
449
+ [example]
450
+ It is not recommended that widgets should be larger than 15 cm.
451
+ INPUT
452
+ expect(File.read("test.err"))
453
+ .to include "Example may contain recommendation"
454
+ end
455
+
456
+ it "warns that note may contain recommendation" do
457
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
458
+ #{VALIDATING_BLANK_HDR}
459
+
460
+ NOTE: It is not recommended that widgets should be larger than 15 cm.
461
+ INPUT
462
+ expect(File.read("test.err")).to include "Note may contain recommendation"
463
+ end
464
+
465
+ it "warns that footnote may contain recommendation" do
466
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
467
+ #{VALIDATING_BLANK_HDR}
468
+
469
+ footnote:[It is not recommended that widgets should be larger than 15 cm.]
470
+ INPUT
471
+ expect(File.read("test.err"))
472
+ .to include "Footnote may contain recommendation"
473
+ end
474
+
475
+ it "warns that term source is not in expected format" do
476
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
477
+ #{VALIDATING_BLANK_HDR}
478
+
479
+ [.source]
480
+ I am a generic paragraph
481
+ INPUT
482
+ expect(File.read("test.err"))
483
+ .to include "term reference not in expected format"
484
+ end
485
+
486
+ it "warns that figure does not have title" do
487
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
488
+ #{VALIDATING_BLANK_HDR}
489
+
490
+ image::spec/examples/rice_images/rice_image1.png[]
491
+ INPUT
492
+ expect(File.read("test.err")).to include "Figure should have title"
493
+ end
494
+
495
+ it "warns that callouts do not match annotations" do
496
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
497
+ #{VALIDATING_BLANK_HDR}
498
+ [source,ruby]
499
+ --
500
+ puts "Hello, world." <1>
501
+ %w{a b c}.each do |x|
502
+ puts x
503
+ end
504
+ --
505
+ <1> This is one callout
506
+ <2> This is another callout
507
+ INPUT
508
+ expect(File.read("test.err"))
509
+ .to include "mismatch of callouts and annotations"
510
+ end
511
+
512
+ it "warns that term source is not a real reference" do
513
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
514
+ #{VALIDATING_BLANK_HDR}
515
+
516
+ [.source]
517
+ <<iso123>>
518
+ INPUT
519
+ expect(File.read("test.err"))
520
+ .to include "iso123 does not have a corresponding anchor ID in the bibliography"
521
+ end
522
+
523
+ it "warns that undated reference has locality" do
524
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
525
+ #{VALIDATING_BLANK_HDR}
526
+
527
+ == Scope
528
+ <<iso123,clause=1>>
529
+
530
+ [bibliography]
531
+ == Normative References
532
+ * [[[iso123,ISO 123]]] _Standard_
533
+ INPUT
534
+ expect(File.read("test.err"))
535
+ .to include "undated reference ISO 123 should not contain specific elements"
536
+ end
537
+
538
+ it "do not warn that undated reference which is a bibliographic reference has locality" do
539
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
540
+ #{VALIDATING_BLANK_HDR}
541
+
542
+ == Scope
543
+ <<iso123,clause=1>>
544
+
545
+ [bibliography]
546
+ == Bibliography
547
+ * [[[iso123,1]]] _Standard_
548
+ INPUT
549
+ expect(File.read("test.err"))
550
+ .not_to include "undated reference [1] should not contain specific elements"
551
+ end
552
+
553
+ it "do not warn that undated IEV reference has locality" do
554
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
555
+ #{VALIDATING_BLANK_HDR}
556
+
557
+ == Scope
558
+ <<iev,clause=1>>
559
+
560
+ [bibliography]
561
+ == Normative References
562
+ * [[[iev,IEV]]] _Standard_
563
+ INPUT
564
+ expect(File.read("test.err"))
565
+ .not_to include "undated reference IEV should not contain specific elements"
566
+ end
567
+
568
+ it "do not warn that in print has locality" do
569
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
570
+ #{VALIDATING_BLANK_HDR}
571
+
572
+ == Scope
573
+ <<iev,clause=1>>
574
+
575
+ [bibliography]
576
+ == Normative References
577
+ * [[[iev,ISO 123:--]]] _Standard_
578
+ INPUT
579
+ expect(File.read("test.err")).not_to include "undated reference ISO 123 should not contain specific elements"
580
+ end
581
+
582
+ it "warns of Non-reference in bibliography" do
583
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
584
+ #{VALIDATING_BLANK_HDR}
585
+
586
+ == Normative References
587
+ * I am not a reference
588
+ INPUT
589
+ expect(File.read("test.err")).to include "no anchor on reference"
590
+ end
591
+
592
+ it "warns of Non-ISO reference in Normative References" do
593
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
594
+ #{VALIDATING_BLANK_HDR}
595
+
596
+ [bibliography]
597
+ == Normative References
598
+ * [[[XYZ,IESO 121]]] _Standard_
599
+ INPUT
600
+ expect(File.read("test.err"))
601
+ .to include "non-ISO/IEC reference not expected as normative"
602
+ end
603
+
604
+ it "warns that Scope contains subclauses" do
605
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
606
+ #{VALIDATING_BLANK_HDR}
607
+
608
+ == Scope
609
+
610
+ === Scope subclause
611
+ INPUT
612
+ expect(File.read("test.err"))
613
+ .to include "Scope contains subclauses: should be succinct"
614
+ end
615
+
616
+ it "warns that Table should have title" do
617
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
618
+ #{VALIDATING_BLANK_HDR}
619
+
620
+ |===
621
+ |a |b |c
622
+ |===
623
+ INPUT
624
+ expect(File.read("test.err")).to include "Table should have title"
625
+ end
626
+
627
+ it "gives Style warning if number not broken up in threes" do
628
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
629
+ #{VALIDATING_BLANK_HDR}
630
+
631
+ == Clause
632
+ 12121
633
+ INPUT
634
+ expect(File.read("test.err")).to include "number not broken up in threes"
635
+ end
636
+
637
+ it "gives No style warning if number not broken up in threes is ISO reference" do
638
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
639
+ #{VALIDATING_BLANK_HDR}
640
+
641
+ == Clause
642
+ ISO 12121
643
+ INPUT
644
+ expect(File.read("test.err")).not_to include "number not broken up in threes"
645
+ end
646
+
647
+ it "Style warning if decimal point" do
648
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
649
+ #{VALIDATING_BLANK_HDR}
650
+
651
+ == Clause
652
+ 8.1
653
+ INPUT
654
+ expect(File.read("test.err")).to include "possible decimal point"
655
+ end
656
+
657
+ it "Style warning if billion used" do
658
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
659
+ #{VALIDATING_BLANK_HDR}
660
+
661
+ == Clause
662
+ "Billions" are a term of art.
663
+ INPUT
664
+ expect(File.read("test.err")).to include "ambiguous number"
665
+ end
666
+
667
+ it "Style warning if no space before percent sign" do
668
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
669
+ #{VALIDATING_BLANK_HDR}
670
+
671
+ == Clause
672
+ 95%
673
+ INPUT
674
+ expect(File.read("test.err")).to include "no space before percent sign"
675
+ end
676
+
677
+ it "Style warning if unbracketed tolerance before percent sign" do
678
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
679
+ #{VALIDATING_BLANK_HDR}
680
+
681
+ == Clause
682
+ 95 ± 5 %
683
+ INPUT
684
+ expect(File.read("test.err")).to include "unbracketed tolerance before percent sign"
685
+ end
686
+
687
+ it "Style warning if dots in abbreviation" do
688
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
689
+ #{VALIDATING_BLANK_HDR}
690
+
691
+ == Clause
692
+ r.p.m.
693
+ INPUT
694
+ expect(File.read("test.err")).to include "no dots in abbreviation"
695
+ end
696
+
697
+ it "No Style warning if dots in abbreviation are e.g." do
698
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
699
+ #{VALIDATING_BLANK_HDR}
700
+
701
+ == Clause
702
+ e.g. 5
703
+ INPUT
704
+ expect(File.read("test.err")).not_to include "no dots in abbreviation"
705
+ end
706
+
707
+ it "Style warning if ppm used" do
708
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
709
+ #{VALIDATING_BLANK_HDR}
710
+
711
+ == Clause
712
+ 5 ppm
713
+ INPUT
714
+ expect(File.read("test.err")).to include "language-specific abbreviation"
715
+ end
716
+
717
+ it "Style warning if space between number and degree" do
718
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
719
+ #{VALIDATING_BLANK_HDR}
720
+
721
+ == Clause
722
+ 5 °
723
+ INPUT
724
+ expect(File.read("test.err")).to include "space between number and degrees/minutes/seconds"
725
+ end
726
+
727
+ it "Style warning if no space between number and SI unit" do
728
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
729
+ #{VALIDATING_BLANK_HDR}
730
+
731
+ == Clause
732
+ A measurement of 5Bq was taken.
733
+ INPUT
734
+ expect(File.read("test.err")).to include "no space between number and SI unit"
735
+ end
736
+
737
+ it "Style warning if mins used" do
738
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
739
+ #{VALIDATING_BLANK_HDR}
740
+
741
+ == Clause
742
+ 5 mins
743
+ INPUT
744
+ expect(File.read("test.err")).to include "non-standard unit"
745
+ end
746
+
747
+ # can't test: our asciidoc template won't allow this to be generated
748
+ # it "Style warning if foreword contains subclauses" do
749
+ # expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }
750
+ # .to output(%r{non-standard unit}).to_stderr
751
+ # #{VALIDATING_BLANK_HDR}
752
+ #
753
+ # INPUT
754
+ # end
755
+
756
+ # can't test: we strip out any such content from Normative references preemptively
757
+ # it "Style warning if Normative References contains subclauses" do
758
+ # expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }
759
+ # .to output(%r{normative references contains subclauses}).to_stderr
760
+ # #{VALIDATING_BLANK_HDR}
761
+ #
762
+ # [bibliography]
763
+ #== Normative References
764
+ #
765
+ #=== Subsection
766
+ # INPUT
767
+ # end
768
+
769
+ it "Style warning if two Symbols and Abbreviated Terms sections" do
770
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
771
+ #{VALIDATING_BLANK_HDR}
772
+
773
+ == Terms and Abbreviations
774
+
775
+ === Symbols and Abbreviated Terms
776
+
777
+ == Symbols and Abbreviated Terms
778
+ INPUT
779
+ expect(File.read("test.err"))
780
+ .to include "Only one Symbols and Abbreviated Terms section in the standard"
781
+ end
782
+
783
+ it "Style warning if Symbols and Abbreviated Terms contains extraneous matter" do
784
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
785
+ #{VALIDATING_BLANK_HDR}
786
+
787
+ == Symbols and Abbreviated Terms
788
+
789
+ Paragraph
790
+ INPUT
791
+ expect(File.read("test.err"))
792
+ .to include "Symbols and Abbreviated Terms can only contain a definition list"
793
+ end
794
+
795
+ it "Warning if missing foreword" do
796
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
797
+ #{VALIDATING_BLANK_HDR}
798
+
799
+ == Symbols and Abbreviated Terms
800
+
801
+ Paragraph
802
+ INPUT
803
+ expect(File.read("test.err"))
804
+ .to include "Initial section must be (content) Foreword"
805
+
806
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
807
+ = Document title
808
+ Author
809
+ :docfile: test.adoc
810
+ :nodoc:
811
+ :no-isobib:
812
+ :doctype: amendment
813
+
814
+ == Symbols and Abbreviated Terms
815
+
816
+ Paragraph
817
+ INPUT
818
+ expect(File.read("test.err"))
819
+ .not_to include "Initial section must be (content) Foreword"
820
+ end
821
+
822
+ it "Warning if do not start with scope or introduction" do
823
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
824
+ #{VALIDATING_BLANK_HDR}
825
+ Foreword
826
+
827
+ == Symbols and Abbreviated Terms
828
+
829
+ Paragraph
830
+ INPUT
831
+ expect(File.read("test.err"))
832
+ .to include "Prefatory material must be followed by (clause) Scope"
833
+
834
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
835
+ = Document title
836
+ Author
837
+ :docfile: test.adoc
838
+ :nodoc:
839
+ :no-isobib:
840
+ :doctype: amendment
841
+
842
+ Foreword
843
+
844
+ == Symbols and Abbreviated Terms
845
+
846
+ Paragraph
847
+ INPUT
848
+ expect(File.read("test.err"))
849
+ .not_to include "Prefatory material must be followed by (clause) Scope"
850
+ end
851
+
852
+ it "Warning if introduction not followed by scope" do
853
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
854
+ #{VALIDATING_BLANK_HDR}
855
+
856
+ .Foreword
857
+ Foreword
858
+
859
+ == Introduction
860
+
861
+ == Symbols and Abbreviated Terms
862
+
863
+ Paragraph
864
+ INPUT
865
+ expect(File.read("test.err"))
866
+ .to include "Prefatory material must be followed by (clause) Scope"
867
+
868
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
869
+ = Document title
870
+ Author
871
+ :docfile: test.adoc
872
+ :nodoc:
873
+ :no-isobib:
874
+ :doctype: amendment
875
+
876
+ .Foreword
877
+ Foreword
878
+
879
+ == Introduction
880
+
881
+ == Symbols and Abbreviated Terms
882
+
883
+ Paragraph
884
+ INPUT
885
+ expect(File.read("test.err"))
886
+ .not_to include "Prefatory material must be followed by (clause) Scope"
887
+ end
888
+
889
+ it "Warning if normative references not followed by terms and definitions" do
890
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
891
+ #{VALIDATING_BLANK_HDR}
892
+
893
+ .Foreword
894
+ Foreword
895
+
896
+ == Scope
897
+
898
+ [bibliography]
899
+ == Normative References
900
+
901
+ == Symbols and Abbreviated Terms
902
+
903
+ Paragraph
904
+ INPUT
905
+ expect(File.read("test.err")).to include "Normative References must be followed by Terms and Definitions"
906
+
907
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
908
+ = Document title
909
+ Author
910
+ :docfile: test.adoc
911
+ :nodoc:
912
+ :no-isobib:
913
+ :doctype: amendment
914
+
915
+ .Foreword
916
+ Foreword
917
+
918
+ == Scope
919
+
920
+ [bibliography]
921
+ == Normative References
922
+
923
+ == Symbols and Abbreviated Terms
924
+
925
+ Paragraph
926
+ INPUT
927
+ expect(File.read("test.err")).not_to include "Normative References must be followed by Terms and Definitions"
928
+ end
929
+
930
+ it "Warning if there are no clauses in the document" do
931
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
932
+ #{VALIDATING_BLANK_HDR}
933
+
934
+ .Foreword
935
+ Foreword
936
+
937
+ == Scope
938
+
939
+ [bibliography]
940
+ == Normative References
941
+
942
+ == Terms and Definitions
943
+
944
+ == Symbols and Abbreviated Terms
945
+
946
+ INPUT
947
+ expect(File.read("test.err")).to include "Document must contain at least one clause"
948
+
949
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
950
+ = Document title
951
+ Author
952
+ :docfile: test.adoc
953
+ :nodoc:
954
+ :no-isobib:
955
+ :doctype: amendment
956
+
957
+ .Foreword
958
+ Foreword
959
+
960
+ == Scope
961
+
962
+ [bibliography]
963
+ == Normative References
964
+
965
+ == Terms and Definitions
966
+
967
+ == Symbols and Abbreviated Terms
968
+
969
+ INPUT
970
+ expect(File.read("test.err")).not_to include "Document must contain at least one clause"
971
+ end
972
+
973
+ it "Warning if scope occurs after Terms and Definitions" do
974
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
975
+ #{VALIDATING_BLANK_HDR}
976
+
977
+ .Foreword
978
+ Foreword
979
+
980
+ == Scope
981
+
982
+ [bibliography]
983
+ == Normative References
984
+
985
+ == Terms and Definitions
986
+
987
+ == Clause
988
+
989
+ == Scope
990
+
991
+ INPUT
992
+ expect(File.read("test.err")).to include "Scope must occur before Terms and Definitions"
993
+
994
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
995
+ = Document title
996
+ Author
997
+ :docfile: test.adoc
998
+ :nodoc:
999
+ :no-isobib:
1000
+ :doctype: amendment
1001
+
1002
+ .Foreword
1003
+ Foreword
1004
+
1005
+ == Scope
1006
+
1007
+ [bibliography]
1008
+ == Normative References
1009
+
1010
+ == Terms and Definitions
1011
+
1012
+ == Clause
1013
+
1014
+ == Scope
1015
+
1016
+ INPUT
1017
+ expect(File.read("test.err")).not_to include "Scope must occur before Terms and Definitions"
1018
+ end
1019
+
1020
+ it "Warning if Symbols and Abbreviated Terms does not occur immediately after Terms and Definitions" do
1021
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1022
+ #{VALIDATING_BLANK_HDR}
1023
+
1024
+ .Foreword
1025
+ Foreword
1026
+
1027
+ == Scope
1028
+
1029
+ [bibliography]
1030
+ == Normative References
1031
+
1032
+ == Terms and Definitions
1033
+
1034
+ == Clause
1035
+
1036
+ == Symbols and Abbreviated Terms
1037
+
1038
+ INPUT
1039
+ expect(File.read("test.err")).to include "Only annexes and references can follow clauses"
1040
+
1041
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1042
+ = Document title
1043
+ Author
1044
+ :docfile: test.adoc
1045
+ :nodoc:
1046
+ :no-isobib:
1047
+ :doctype: amendment
1048
+
1049
+
1050
+ .Foreword
1051
+ Foreword
1052
+
1053
+ == Scope
1054
+
1055
+ [bibliography]
1056
+ == Normative References
1057
+
1058
+ == Terms and Definitions
1059
+
1060
+ == Clause
1061
+
1062
+ == Symbols and Abbreviated Terms
1063
+
1064
+ INPUT
1065
+ expect(File.read("test.err")).not_to include "Only annexes and references can follow clauses"
1066
+ end
1067
+
1068
+ it "Warning if no normative references" do
1069
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1070
+ #{VALIDATING_BLANK_HDR}
1071
+
1072
+ .Foreword
1073
+ Foreword
1074
+
1075
+ == Scope
1076
+
1077
+ == Terms and Definitions
1078
+
1079
+ == Clause
1080
+
1081
+ [appendix]
1082
+ == Appendix A
1083
+
1084
+ [appendix]
1085
+ == Appendix B
1086
+
1087
+ [appendix]
1088
+ == Appendix C
1089
+
1090
+ INPUT
1091
+ expect(File.read("test.err")).to include "Document must include (references) Normative References"
1092
+
1093
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1094
+ = Document title
1095
+ Author
1096
+ :docfile: test.adoc
1097
+ :nodoc:
1098
+ :no-isobib:
1099
+ :doctype: amendment
1100
+
1101
+ .Foreword
1102
+ Foreword
1103
+
1104
+ == Scope
1105
+
1106
+ == Terms and Definitions
1107
+
1108
+ == Clause
1109
+
1110
+ [appendix]
1111
+ == Appendix A
1112
+
1113
+ [appendix]
1114
+ == Appendix B
1115
+
1116
+ [appendix]
1117
+ == Appendix C
1118
+
1119
+ INPUT
1120
+ expect(File.read("test.err")).not_to include "Document must include (references) Normative References"
1121
+ end
1122
+
1123
+ it "Warning if final section is not named Bibliography" do
1124
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1125
+ #{VALIDATING_BLANK_HDR}
1126
+
1127
+ .Foreword
1128
+ Foreword
1129
+
1130
+ == Scope
1131
+
1132
+ [bibliography]
1133
+ == Normative References
1134
+
1135
+ == Terms and Definitions
1136
+
1137
+ == Clause
1138
+
1139
+ [appendix]
1140
+ == Appendix A
1141
+
1142
+ [appendix]
1143
+ == Appendix B
1144
+
1145
+ [bibliography]
1146
+ == Bibliography
1147
+
1148
+ [bibliography]
1149
+ == Appendix C
1150
+
1151
+ INPUT
1152
+ expect(File.read("test.err")).to include "There are sections after the final Bibliography"
1153
+
1154
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1155
+ = Document title
1156
+ Author
1157
+ :docfile: test.adoc
1158
+ :nodoc:
1159
+ :no-isobib:
1160
+ :doctype: amendment
1161
+
1162
+ .Foreword
1163
+ Foreword
1164
+
1165
+ == Scope
1166
+
1167
+ [bibliography]
1168
+ == Normative References
1169
+
1170
+ == Terms and Definitions
1171
+
1172
+ == Clause
1173
+
1174
+ [appendix]
1175
+ == Appendix A
1176
+
1177
+ [appendix]
1178
+ == Appendix B
1179
+
1180
+ [bibliography]
1181
+ == Bibliography
1182
+
1183
+ [bibliography]
1184
+ == Appendix C
1185
+
1186
+ INPUT
1187
+ expect(File.read("test.err")).not_to include "There are sections after the final Bibliography"
1188
+ end
1189
+
1190
+ it "Warning if final section is not styled Bibliography" do
1191
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1192
+ #{VALIDATING_BLANK_HDR}
1193
+
1194
+ .Foreword
1195
+ Foreword
1196
+
1197
+ == Scope
1198
+
1199
+ [bibliography]
1200
+ == Normative References
1201
+
1202
+ == Terms and Definitions
1203
+
1204
+ == Clause
1205
+
1206
+ [appendix]
1207
+ == Appendix A
1208
+
1209
+ [appendix]
1210
+ == Appendix B
1211
+
1212
+ == Bibliography
1213
+
1214
+ INPUT
1215
+ expect(File.read("test.err")).to include "Section not marked up as [bibliography]"
1216
+ end
1217
+
1218
+ it "Warning if final section is not styled Bibliography false" do
1219
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1220
+ = Document title
1221
+ Author
1222
+ :docfile: test.adoc
1223
+ :nodoc:
1224
+ :no-isobib:
1225
+ :doctype: amendment
1226
+
1227
+ .Foreword
1228
+ Foreword
1229
+
1230
+ == Scope
1231
+
1232
+ [bibliography]
1233
+ == Normative References
1234
+
1235
+ == Terms and Definitions
1236
+
1237
+ == Clause
1238
+
1239
+ [appendix]
1240
+ == Appendix A
1241
+
1242
+ [appendix]
1243
+ == Appendix B
1244
+
1245
+ == Bibliography
1246
+
1247
+ INPUT
1248
+ expect(File.read("test.err")).not_to include "Section not marked up as [bibliography]"
1249
+ end
1250
+
1251
+ it "Warning if English title intro and no French title intro" do
1252
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1253
+ = Document title
1254
+ Author
1255
+ :docfile: test.adoc
1256
+ :nodoc:
1257
+ :title-intro-en: Title
1258
+ :no-isobib:
1259
+
1260
+ INPUT
1261
+ expect(File.read("test.err")).to include "No French Title Intro"
1262
+ end
1263
+
1264
+ it "Warning if French title intro and no English title intro" do
1265
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1266
+ = Document title
1267
+ Author
1268
+ :docfile: test.adoc
1269
+ :nodoc:
1270
+ :title-intro-fr: Title
1271
+ :no-isobib:
1272
+
1273
+ INPUT
1274
+ expect(File.read("test.err")).to include "No English Title Intro"
1275
+ end
1276
+
1277
+ it "Warning if English title and no French title" do
1278
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1279
+ = Document title
1280
+ Author
1281
+ :docfile: test.adoc
1282
+ :nodoc:
1283
+ :title-main-en: Title
1284
+ :no-isobib:
1285
+
1286
+ INPUT
1287
+ expect(File.read("test.err")).to include "No French Title"
1288
+ expect(File.read("test.err")).not_to include "No French Intro"
1289
+ end
1290
+
1291
+ it "Warning if French title and no English title" do
1292
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1293
+ = Document title
1294
+ Author
1295
+ :docfile: test.adoc
1296
+ :nodoc:
1297
+ :title-main-fr: Title
1298
+ :no-isobib:
1299
+
1300
+ INPUT
1301
+ expect(File.read("test.err")).to include "No English Title"
1302
+ end
1303
+
1304
+ it "Warning if English title part and no French title part" do
1305
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1306
+ = Document title
1307
+ Author
1308
+ :docfile: test.adoc
1309
+ :nodoc:
1310
+ :title-part-en: Title
1311
+ :no-isobib:
1312
+
1313
+ INPUT
1314
+ expect(File.read("test.err")).to include "No French Title Part"
1315
+ end
1316
+
1317
+ it "Warning if French title part and no English title part" do
1318
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1319
+ = Document title
1320
+ Author
1321
+ :docfile: test.adoc
1322
+ :nodoc:
1323
+ :title-part-fr: Title
1324
+ :no-isobib:
1325
+
1326
+ INPUT
1327
+ expect(File.read("test.err")).to include "No English Title Part"
1328
+ end
1329
+
1330
+ it "No warning if French main title and English main title" do
1331
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1332
+ = Document title
1333
+ Author
1334
+ :docfile: test.adoc
1335
+ :nodoc:
1336
+ :title-part-fr: Title
1337
+ :title-part-en: Title
1338
+ :no-isobib:
1339
+
1340
+ INPUT
1341
+ expect(File.read("test.err")).not_to include "No French Title Intro"
1342
+ expect(File.read("test.err")).not_to include "No French Title Part"
1343
+ end
1344
+
1345
+ it "Warning if non-IEC document with subpart" do
1346
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1347
+ = Document title
1348
+ Author
1349
+ :docfile: test.adoc
1350
+ :nodoc:
1351
+ :docnumber: 10
1352
+ :partnumber: 1-1
1353
+ :publisher: ISO
1354
+ :no-isobib:
1355
+
1356
+ INPUT
1357
+ expect(File.read("test.err"))
1358
+ .to include "Subpart defined on non-IEC document"
1359
+ end
1360
+
1361
+ it "No warning if joint IEC/non-IEC document with subpart" do
1362
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1363
+ = Document title
1364
+ Author
1365
+ :docfile: test.adoc
1366
+ :nodoc:
1367
+ :docnumber: 10
1368
+ :partnumber: 1-1
1369
+ :publisher: ISO;IEC
1370
+ :no-isobib:
1371
+
1372
+ INPUT
1373
+ expect(File.read("test.err"))
1374
+ .not_to include "Subpart defined on non-IEC document"
1375
+ end
1376
+
1377
+ it "Warning if main title contains document type" do
1378
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1379
+ = Document title
1380
+ Author
1381
+ :docfile: test.adoc
1382
+ :nodoc:
1383
+ :title-main-en: A Technical Specification on Widgets
1384
+ :no-isobib:
1385
+
1386
+ INPUT
1387
+ expect(File.read("test.err")).to include "Main Title may name document type"
1388
+ end
1389
+
1390
+ it "Warning if intro title contains document type" do
1391
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1392
+ = Document title
1393
+ Author
1394
+ :docfile: test.adoc
1395
+ :nodoc:
1396
+ :title-intro-en: A Technical Specification on Widgets
1397
+ :no-isobib:
1398
+
1399
+ INPUT
1400
+ expect(File.read("test.err"))
1401
+ .to include "Title Intro may name document type"
1402
+ end
1403
+
1404
+ it "Each first-level subclause must have a title" do
1405
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1406
+ #{VALIDATING_BLANK_HDR}
1407
+ == Clause
1408
+
1409
+ === {blank}
1410
+ INPUT
1411
+ expect(File.read("test.err"))
1412
+ .to include "each first-level subclause must have a title"
1413
+ end
1414
+
1415
+ it "All subclauses must have a title, or none" do
1416
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1417
+ #{VALIDATING_BLANK_HDR}
1418
+ == Clause
1419
+
1420
+ === Subclause
1421
+
1422
+ ==== {blank}
1423
+
1424
+ ==== Subsubclause
1425
+ INPUT
1426
+ expect(File.read("test.err"))
1427
+ .to include "all subclauses must have a title, or none"
1428
+ end
1429
+
1430
+ it "Warning if subclause is only child of its parent, or none" do
1431
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1432
+ #{VALIDATING_BLANK_HDR}
1433
+ == Clause
1434
+
1435
+ === Subclause
1436
+
1437
+ INPUT
1438
+ expect(File.read("test.err")).to include "subclause is only child"
1439
+ end
1440
+
1441
+ it "Warning if invalid technical committee type" do
1442
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1443
+ = Document title
1444
+ Author
1445
+ :docfile: test.adoc
1446
+ :nodoc:
1447
+ :technical-committee-type: X
1448
+ :no-isobib:
1449
+
1450
+ INPUT
1451
+ expect(File.read("test.err")).to include "invalid technical committee type"
1452
+ end
1453
+
1454
+ it "Warning if invalid subcommittee type" do
1455
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1456
+ = Document title
1457
+ Author
1458
+ :docfile: test.adoc
1459
+ :nodoc:
1460
+ :subcommittee-type: X
1461
+ :no-isobib:
1462
+
1463
+ INPUT
1464
+ expect(File.read("test.err")).to include "invalid subcommittee type"
1465
+ end
1466
+
1467
+ it "Warning if invalid subcommittee type" do
1468
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1469
+ = Document title
1470
+ Author
1471
+ :docfile: test.adoc
1472
+ :nodoc:
1473
+ :subcommittee-type: X
1474
+ :no-isobib:
1475
+
1476
+ INPUT
1477
+ expect(File.read("test.err")).to include "invalid subcommittee type"
1478
+ end
1479
+
1480
+ it "Warning if 'see' crossreference points to normative section" do
1481
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1482
+ #{VALIDATING_BLANK_HDR}
1483
+ [[terms]]
1484
+ == Terms and Definitions
1485
+
1486
+ == Clause
1487
+ See <<terms>>
1488
+ INPUT
1489
+ expect(File.read("test.err"))
1490
+ .to include "'see terms' is pointing to a normative section"
1491
+ end
1492
+
1493
+ it "Warning if 'see' reference points to normative reference" do
1494
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1495
+ #{VALIDATING_BLANK_HDR}
1496
+ [bibliography]
1497
+ == Normative References
1498
+ * [[[terms,ISO 1]]] _References_
1499
+
1500
+ == Clause
1501
+ See <<terms>>
1502
+ INPUT
1503
+ expect(File.read("test.err"))
1504
+ .to include "is pointing to a normative reference"
1505
+ end
1506
+
1507
+ it "Warning if term definition starts with article" do
1508
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1509
+ #{VALIDATING_BLANK_HDR}
1510
+ == Terms and Definitions
1511
+
1512
+ === Term
1513
+
1514
+ The definition of a term is a part of the specialized vocabulary of a particular field
1515
+ INPUT
1516
+ expect(File.read("test.err"))
1517
+ .to include "term definition starts with article"
1518
+ end
1519
+
1520
+ it "Warning if term definition ends with period" do
1521
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1522
+ #{VALIDATING_BLANK_HDR}
1523
+ == Terms and Definitions
1524
+
1525
+ === Term
1526
+
1527
+ Part of the specialized vocabulary of a particular field.
1528
+ INPUT
1529
+ expect(File.read("test.err")).to include "term definition ends with period"
1530
+ end
1531
+
1532
+ it "validates document against ISO XML schema" do
1533
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1534
+ #{VALIDATING_BLANK_HDR}
1535
+
1536
+ [align=mid-air]
1537
+ Para
1538
+ INPUT
1539
+ expect(File.read("test.err")).to include 'value of attribute "align" is invalid; must be equal to'
1540
+ end
1541
+
1542
+ it "Warn if more than 7 levels of subclause" do
1543
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1544
+ = Document title
1545
+ Author
1546
+ :docfile: test.adoc
1547
+ :nodoc:
1548
+ :no-isobib:
1549
+ :language: fr
1550
+
1551
+ == Clause
1552
+
1553
+ === Clause
1554
+
1555
+ ==== Clause
1556
+
1557
+ ===== Clause
1558
+
1559
+ ====== Clause
1560
+
1561
+ [level=6]
1562
+ ====== Clause
1563
+
1564
+ [level=7]
1565
+ ====== Clause
1566
+
1567
+ [level=8]
1568
+ ====== Clause
1569
+
1570
+ INPUT
1571
+ expect(File.read("test.err")).to include "Exceeds the maximum clause depth of 7"
1572
+ end
1573
+
1574
+ it "Do not warn if not more than 7 levels of subclause" do
1575
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1576
+ = Document title
1577
+ Author
1578
+ :docfile: test.adoc
1579
+ :nodoc:
1580
+ :no-isobib:
1581
+ :language: fr
1582
+
1583
+ == Clause
1584
+
1585
+ === Clause
1586
+
1587
+ ==== Clause
1588
+
1589
+ ===== Clause
1590
+
1591
+ ====== Clause
1592
+
1593
+ [level=6]
1594
+ ====== Clause
1595
+
1596
+ [level=7]
1597
+ ====== Clause
1598
+
1599
+ INPUT
1600
+ expect(File.read("test.err")).not_to include "exceeds the maximum clause depth of 7"
1601
+ end
1602
+
1603
+ it "Warn if term citation in Terms & Definitions not preceded with italicised term" do
1604
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1605
+ #{VALIDATING_BLANK_HDR}
1606
+ == Terms and Definitions
1607
+
1608
+ [[term]]
1609
+ === Term
1610
+
1611
+ The definition of a term (<<term>>) is a part of the specialized vocabulary of a particular field
1612
+ INPUT
1613
+ expect(File.read("test.err")).to include "term citation not preceded with italicised term"
1614
+ end
1615
+
1616
+ it "Warn if an undated reference has no associated footnote" do
1617
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1618
+ #{VALIDATING_BLANK_HDR}
1619
+
1620
+ [bibliography]
1621
+ == Bibliography
1622
+ * [[[ISO8,ISO 8:--]]], _Title_
1623
+ INPUT
1624
+ expect(File.read("test.err")).to include \
1625
+ "Reference ISO8 does not have an associated footnote indicating unpublished status"
1626
+ end
1627
+ end