metanorma-iso 1.6.0 → 1.7.3

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