metanorma-iso 1.7.0 → 1.8.0

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