metanorma-iso 1.6.1 → 1.7.4

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