metanorma-iso 1.7.0 → 1.8.0

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