metanorma-iso 1.6.0 → 1.7.3

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