metanorma-iso 1.7.1 → 1.8.1

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