metanorma-iso 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +4 -0
  3. data/.gitignore +11 -0
  4. data/.hound.yml +3 -0
  5. data/.oss-guides.rubocop.yml +1077 -0
  6. data/.rubocop.ribose.yml +66 -0
  7. data/.rubocop.tb.yml +650 -0
  8. data/.rubocop.yml +15 -0
  9. data/.travis.yml +21 -0
  10. data/CODE_OF_CONDUCT.md +46 -0
  11. data/Gemfile +7 -0
  12. data/LICENSE +25 -0
  13. data/Makefile +39 -0
  14. data/README.adoc +882 -0
  15. data/Rakefile +6 -0
  16. data/asciidoctor-iso.gemspec.old +50 -0
  17. data/bin/rspec +18 -0
  18. data/docs/customisation.adoc +186 -0
  19. data/docs/guidance.adoc +436 -0
  20. data/docs/htmloutput.adoc +115 -0
  21. data/docs/quickstart.adoc +375 -0
  22. data/lib/asciidoctor-iso.rb +11 -0
  23. data/lib/asciidoctor/iso/base.rb +48 -0
  24. data/lib/asciidoctor/iso/biblio.rng +836 -0
  25. data/lib/asciidoctor/iso/cleanup.rb +39 -0
  26. data/lib/asciidoctor/iso/converter.rb +19 -0
  27. data/lib/asciidoctor/iso/front.rb +131 -0
  28. data/lib/asciidoctor/iso/isodoc.rng +1059 -0
  29. data/lib/asciidoctor/iso/isostandard.rnc +176 -0
  30. data/lib/asciidoctor/iso/isostandard.rng +1001 -0
  31. data/lib/asciidoctor/iso/section.rb +72 -0
  32. data/lib/asciidoctor/iso/validate.rb +190 -0
  33. data/lib/asciidoctor/iso/validate_requirements.rb +105 -0
  34. data/lib/asciidoctor/iso/validate_section.rb +214 -0
  35. data/lib/asciidoctor/iso/validate_style.rb +134 -0
  36. data/lib/asciidoctor/iso/version.rb +5 -0
  37. data/lib/isodoc/iso/html/header.html +206 -0
  38. data/lib/isodoc/iso/html/html_iso_intro.html +34 -0
  39. data/lib/isodoc/iso/html/html_iso_titlepage.html +34 -0
  40. data/lib/isodoc/iso/html/htmlstyle.scss +46 -0
  41. data/lib/isodoc/iso/html/isodoc.scss +696 -0
  42. data/lib/isodoc/iso/html/scripts.html +174 -0
  43. data/lib/isodoc/iso/html/style-human.scss +1277 -0
  44. data/lib/isodoc/iso/html/style-iso.scss +1257 -0
  45. data/lib/isodoc/iso/html/word_iso_intro.html +72 -0
  46. data/lib/isodoc/iso/html/word_iso_titlepage.html +62 -0
  47. data/lib/isodoc/iso/html/wordstyle.scss +1175 -0
  48. data/lib/isodoc/iso/html_convert.rb +118 -0
  49. data/lib/isodoc/iso/metadata.rb +107 -0
  50. data/lib/isodoc/iso/word_convert.rb +141 -0
  51. data/lib/metanorma/iso.rb +7 -0
  52. data/lib/metanorma/iso/processor.rb +44 -0
  53. data/spec/asciidoctor-iso/base_spec.rb +350 -0
  54. data/spec/asciidoctor-iso/blocks_spec.rb +469 -0
  55. data/spec/asciidoctor-iso/cleanup_spec.rb +765 -0
  56. data/spec/asciidoctor-iso/inline_spec.rb +162 -0
  57. data/spec/asciidoctor-iso/isobib_cache_spec.rb +332 -0
  58. data/spec/asciidoctor-iso/lists_spec.rb +190 -0
  59. data/spec/asciidoctor-iso/macros_spec.rb +111 -0
  60. data/spec/asciidoctor-iso/refs_spec.rb +643 -0
  61. data/spec/asciidoctor-iso/section_spec.rb +334 -0
  62. data/spec/asciidoctor-iso/table_spec.rb +307 -0
  63. data/spec/asciidoctor-iso/validate_spec.rb +907 -0
  64. data/spec/assets/header.html +7 -0
  65. data/spec/assets/html.css +2 -0
  66. data/spec/assets/htmlcover.html +4 -0
  67. data/spec/assets/htmlintro.html +5 -0
  68. data/spec/assets/i18n.yaml +2 -0
  69. data/spec/assets/iso.doc +1093 -0
  70. data/spec/assets/iso.headless.html +33 -0
  71. data/spec/assets/iso.html +278 -0
  72. data/spec/assets/iso.xml +8 -0
  73. data/spec/assets/rice_image1.png +0 -0
  74. data/spec/assets/scripts.html +3 -0
  75. data/spec/assets/std.css +2 -0
  76. data/spec/assets/word.css +2 -0
  77. data/spec/assets/wordcover.html +3 -0
  78. data/spec/assets/wordintro.html +4 -0
  79. data/spec/examples/103_01_02.html +247 -0
  80. data/spec/examples/english.yaml +69 -0
  81. data/spec/examples/iso_123_.xml +45 -0
  82. data/spec/examples/iso_123_all_parts.xml +45 -0
  83. data/spec/examples/iso_123_no_year_note.xml +46 -0
  84. data/spec/examples/iso_124_.xml +41 -0
  85. data/spec/examples/iso_216_.xml +47 -0
  86. data/spec/examples/iso_iec_12382_.xml +48 -0
  87. data/spec/examples/rice.adoc +715 -0
  88. data/spec/examples/rice.preview.html +1877 -0
  89. data/spec/examples/rice.sh +4 -0
  90. data/spec/examples/rice_images/rice_image1.png +0 -0
  91. data/spec/examples/rice_images/rice_image2.png +0 -0
  92. data/spec/examples/rice_images/rice_image3_1.png +0 -0
  93. data/spec/examples/rice_images/rice_image3_2.png +0 -0
  94. data/spec/examples/rice_images/rice_image3_3.png +0 -0
  95. data/spec/isodoc/i18n_spec.rb +642 -0
  96. data/spec/isodoc/iso_spec.rb +168 -0
  97. data/spec/isodoc/metadata_spec.rb +152 -0
  98. data/spec/isodoc/postproc_spec.rb +405 -0
  99. data/spec/isodoc/section_spec.rb +522 -0
  100. data/spec/isodoc/xref_spec.rb +1337 -0
  101. data/spec/metanorma/processor_spec.rb +70 -0
  102. data/spec/spec_helper.rb +227 -0
  103. metadata +402 -0
@@ -0,0 +1,907 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Asciidoctor::ISO do
4
+
5
+ it "warns that introduction may contain requirement" do
6
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Introduction may contain requirement/).to_stderr
7
+ #{VALIDATING_BLANK_HDR}
8
+ == Introduction
9
+
10
+ The widget is required not to be larger than 15 cm.
11
+ INPUT
12
+ end
13
+
14
+ it "warns that foreword may contain recommendation" do
15
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Foreword may contain recommendation/).to_stderr
16
+ #{VALIDATING_BLANK_HDR}
17
+
18
+ It is not recommended that widgets should be larger than 15 cm.
19
+
20
+ == Clause
21
+ INPUT
22
+ end
23
+
24
+ it "warns that foreword may contain permission" do
25
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Foreword may contain permission/).to_stderr
26
+ #{VALIDATING_BLANK_HDR}
27
+
28
+ No widget is required to be larger than 15 cm.
29
+
30
+ == Clause
31
+ INPUT
32
+ end
33
+
34
+ it "warns that scope may contain recommendation" do
35
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Scope may contain recommendation/).to_stderr
36
+ #{VALIDATING_BLANK_HDR}
37
+
38
+ == Scope
39
+ It is not recommended that widgets should be larger than 15 cm.
40
+ INPUT
41
+ end
42
+
43
+ it "warns that definition may contain requirement" do
44
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Definition may contain requirement/).to_stderr
45
+ #{VALIDATING_BLANK_HDR}
46
+
47
+ == Terms and Definitions
48
+
49
+ === Term1
50
+
51
+ It is required that there is a definition.
52
+
53
+ INPUT
54
+ end
55
+
56
+ it "warns that term example may contain recommendation" do
57
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Term Example may contain recommendation/).to_stderr
58
+ #{VALIDATING_BLANK_HDR}
59
+
60
+ == Terms and Definitions
61
+
62
+ === Term
63
+
64
+ [example]
65
+ It is not recommended that widgets should be larger than 15 cm.
66
+ INPUT
67
+ end
68
+
69
+ it "warns that note may contain recommendation" do
70
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Note may contain recommendation/).to_stderr
71
+ #{VALIDATING_BLANK_HDR}
72
+
73
+ NOTE: It is not recommended that widgets should be larger than 15 cm.
74
+ INPUT
75
+ end
76
+
77
+ it "warns that footnote may contain recommendation" do
78
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Footnote may contain recommendation/).to_stderr
79
+ #{VALIDATING_BLANK_HDR}
80
+
81
+ footnote:[It is not recommended that widgets should be larger than 15 cm.]
82
+ INPUT
83
+ end
84
+
85
+ it "warns that term source is not in expected format" do
86
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/term reference not in expected format/).to_stderr
87
+ #{VALIDATING_BLANK_HDR}
88
+
89
+ [.source]
90
+ I am a generic paragraph
91
+ INPUT
92
+ end
93
+
94
+ it "warns that figure does not have title" do
95
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Figure should have title/).to_stderr
96
+ #{VALIDATING_BLANK_HDR}
97
+
98
+ image::spec/examples/rice_images/rice_image1.png[]
99
+ INPUT
100
+ end
101
+
102
+ it "warns that callouts do not match annotations" do
103
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/mismatch of callouts and annotations/).to_stderr
104
+ #{VALIDATING_BLANK_HDR}
105
+ [source,ruby]
106
+ --
107
+ puts "Hello, world." <1>
108
+ %w{a b c}.each do |x|
109
+ puts x
110
+ end
111
+ --
112
+ <1> This is one callout
113
+ <2> This is another callout
114
+ INPUT
115
+ end
116
+
117
+ it "warns that term source is not a real reference" do
118
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/iso123 is not a real reference/).to_stderr
119
+ #{VALIDATING_BLANK_HDR}
120
+
121
+ [.source]
122
+ <<iso123>>
123
+ INPUT
124
+ end
125
+
126
+ it "warns that undated reference has locality" do
127
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/undated reference ISO 123 should not contain specific elements/).to_stderr
128
+ #{VALIDATING_BLANK_HDR}
129
+
130
+ == Scope
131
+ <<iso123,clause=1>>
132
+
133
+ [bibliography]
134
+ == Normative References
135
+ * [[[iso123,ISO 123]]] _Standard_
136
+ INPUT
137
+ end
138
+
139
+ it "warns of Non-reference in bibliography" do
140
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/no anchor on reference/).to_stderr
141
+ #{VALIDATING_BLANK_HDR}
142
+
143
+ == Normative References
144
+ * I am not a reference
145
+ INPUT
146
+ end
147
+
148
+ it "warns of Non-ISO reference in Normative References" do
149
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{non-ISO/IEC reference not expected as normative}).to_stderr
150
+ #{VALIDATING_BLANK_HDR}
151
+
152
+ [bibliography]
153
+ == Normative References
154
+ * [[[XYZ,IESO 121]]] _Standard_
155
+ INPUT
156
+ end
157
+
158
+ it "warns that Scope contains subclauses" do
159
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Scope contains subclauses: should be succint}).to_stderr
160
+ #{VALIDATING_BLANK_HDR}
161
+
162
+ == Scope
163
+
164
+ === Scope subclause
165
+ INPUT
166
+ end
167
+
168
+
169
+ it "warns that Table should have title" do
170
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Table should have title}).to_stderr
171
+ #{VALIDATING_BLANK_HDR}
172
+
173
+ |===
174
+ |a |b |c
175
+ |===
176
+ INPUT
177
+ end
178
+
179
+ it "gives Style warning if number not broken up in threes" do
180
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{number not broken up in threes}).to_stderr
181
+ #{VALIDATING_BLANK_HDR}
182
+
183
+ == Clause
184
+ 12121
185
+ INPUT
186
+ end
187
+
188
+ it "gives No style warning if number not broken up in threes is ISO reference" do
189
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to_not output(%r{number not broken up in threes}).to_stderr
190
+ #{VALIDATING_BLANK_HDR}
191
+
192
+ == Clause
193
+ ISO 12121
194
+ INPUT
195
+ end
196
+
197
+ it "Style warning if decimal point" do
198
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{possible decimal point}).to_stderr
199
+ #{VALIDATING_BLANK_HDR}
200
+
201
+ == Clause
202
+ 8.1
203
+ INPUT
204
+ end
205
+
206
+ it "Style warning if billion used" do
207
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{ambiguous number}).to_stderr
208
+ #{VALIDATING_BLANK_HDR}
209
+
210
+ == Clause
211
+ "Billions" are a term of art.
212
+ INPUT
213
+ end
214
+
215
+ it "Style warning if no space before percent sign" do
216
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{no space before percent sign}).to_stderr
217
+ #{VALIDATING_BLANK_HDR}
218
+
219
+ == Clause
220
+ 95%
221
+ INPUT
222
+ end
223
+
224
+ it "Style warning if unbracketed tolerance before percent sign" do
225
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{unbracketed tolerance before percent sign}).to_stderr
226
+ #{VALIDATING_BLANK_HDR}
227
+
228
+ == Clause
229
+ 95 ± 5 %
230
+ INPUT
231
+ end
232
+
233
+ it "Style warning if dots in abbreviation" do
234
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{no dots in abbreviation}).to_stderr
235
+ #{VALIDATING_BLANK_HDR}
236
+
237
+ == Clause
238
+ r.p.m.
239
+ INPUT
240
+ end
241
+
242
+ it "No Style warning if dots in abbreviation are e.g." do
243
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to_not output(%r{no dots in abbreviation}).to_stderr
244
+ #{VALIDATING_BLANK_HDR}
245
+
246
+ == Clause
247
+ e.g. 5
248
+ INPUT
249
+ end
250
+
251
+ it "Style warning if ppm used" do
252
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{language-specific abbreviation}).to_stderr
253
+ #{VALIDATING_BLANK_HDR}
254
+
255
+ == Clause
256
+ 5 ppm
257
+ INPUT
258
+ end
259
+
260
+ it "Style warning if space between number and degree" do
261
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{space between number and degrees/minutes/seconds}).to_stderr
262
+ #{VALIDATING_BLANK_HDR}
263
+
264
+ == Clause
265
+ 5 °
266
+ INPUT
267
+ end
268
+
269
+ it "Style warning if no space between number and SI unit" do
270
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{no space between number and SI unit}).to_stderr
271
+ #{VALIDATING_BLANK_HDR}
272
+
273
+ == Clause
274
+ A measurement of 5Bq was taken.
275
+ INPUT
276
+ end
277
+
278
+ it "Style warning if mins used" do
279
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{non-standard unit}).to_stderr
280
+ #{VALIDATING_BLANK_HDR}
281
+
282
+ == Clause
283
+ 5 mins
284
+ INPUT
285
+ end
286
+
287
+ # can't test: our asciidoc template won't allow this to be generated
288
+ # it "Style warning if foreword contains subclauses" do
289
+ # expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{non-standard unit}).to_stderr
290
+ # #{VALIDATING_BLANK_HDR}
291
+ #
292
+ # INPUT
293
+ # end
294
+
295
+ # can't test: we strip out any such content from Normative references preemptively
296
+ #it "Style warning if Normative References contains subclauses" do
297
+ #expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{normative references contains subclauses}).to_stderr
298
+ ##{VALIDATING_BLANK_HDR}
299
+ #
300
+ #[bibliography]
301
+ #== Normative References
302
+ #
303
+ #=== Subsection
304
+ #INPUT
305
+ #end
306
+
307
+ it "Style warning if two Symbols and Abbreviated Terms sections" do
308
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{only one Symbols and Abbreviated Terms section in the standard}).to_stderr
309
+ #{VALIDATING_BLANK_HDR}
310
+
311
+ == Terms and Abbreviations
312
+
313
+ === Symbols and Abbreviated Terms
314
+
315
+ == Symbols and Abbreviated Terms
316
+ INPUT
317
+ end
318
+
319
+ it "Style warning if Symbols and Abbreviated Terms contains extraneous matter" do
320
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Symbols and Abbreviated Terms can only contain a definition list}).to_stderr
321
+ #{VALIDATING_BLANK_HDR}
322
+
323
+ == Symbols and Abbreviated Terms
324
+
325
+ Paragraph
326
+ INPUT
327
+ end
328
+
329
+ it "Warning if do not start with scope or introduction" do
330
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Prefatory material must be followed by \(clause\) Scope}).to_stderr
331
+ #{VALIDATING_BLANK_HDR}
332
+
333
+ == Symbols and Abbreviated Terms
334
+
335
+ Paragraph
336
+ INPUT
337
+ end
338
+
339
+ it "Warning if introduction not followed by scope" do
340
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Prefatory material must be followed by \(clause\) Scope}).to_stderr
341
+ #{VALIDATING_BLANK_HDR}
342
+
343
+ .Foreword
344
+ Foreword
345
+
346
+ == Introduction
347
+
348
+ == Symbols and Abbreviated Terms
349
+
350
+ Paragraph
351
+ INPUT
352
+ end
353
+
354
+ it "Warning if normative references not followed by terms and definitions" do
355
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Normative References must be followed by Terms and Definitions}).to_stderr
356
+ #{VALIDATING_BLANK_HDR}
357
+
358
+ .Foreword
359
+ Foreword
360
+
361
+ == Scope
362
+
363
+ [bibliography]
364
+ == Normative References
365
+
366
+ == Symbols and Abbreviated Terms
367
+
368
+ Paragraph
369
+ INPUT
370
+ end
371
+
372
+ it "Warning if there are no clauses in the document" do
373
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Document must contain clause after Terms and Definitions}).to_stderr
374
+ #{VALIDATING_BLANK_HDR}
375
+
376
+ .Foreword
377
+ Foreword
378
+
379
+ == Scope
380
+
381
+ [bibliography]
382
+ == Normative References
383
+
384
+ == Terms and Definitions
385
+
386
+ == Symbols and Abbreviated Terms
387
+
388
+ INPUT
389
+ end
390
+
391
+ it "Warning if scope occurs after Terms and Definitions" do
392
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Scope must occur before Terms and Definitions}).to_stderr
393
+ #{VALIDATING_BLANK_HDR}
394
+
395
+ .Foreword
396
+ Foreword
397
+
398
+ == Scope
399
+
400
+ [bibliography]
401
+ == Normative References
402
+
403
+ == Terms and Definitions
404
+
405
+ == Scope
406
+
407
+ INPUT
408
+ end
409
+
410
+ it "Warning if scope occurs after Terms and Definitions" do
411
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Scope must occur before Terms and Definitions}).to_stderr
412
+ #{VALIDATING_BLANK_HDR}
413
+
414
+ .Foreword
415
+ Foreword
416
+
417
+ == Scope
418
+
419
+ [bibliography]
420
+ == Normative References
421
+
422
+ == Terms and Definitions
423
+
424
+ == Clause
425
+
426
+ == Scope
427
+
428
+ INPUT
429
+ end
430
+
431
+ it "Warning if Symbols and Abbreviated Terms does not occur immediately after Terms and Definitions" do
432
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Only annexes and references can follow clauses}).to_stderr
433
+ #{VALIDATING_BLANK_HDR}
434
+
435
+ .Foreword
436
+ Foreword
437
+
438
+ == Scope
439
+
440
+ [bibliography]
441
+ == Normative References
442
+
443
+ == Terms and Definitions
444
+
445
+ == Clause
446
+
447
+ == Symbols and Abbreviated Terms
448
+
449
+ INPUT
450
+ end
451
+
452
+ it "Warning if no normative references" do
453
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Document must include \(references\) Normative References}).to_stderr
454
+ #{VALIDATING_BLANK_HDR}
455
+
456
+ .Foreword
457
+ Foreword
458
+
459
+ == Scope
460
+
461
+ == Terms and Definitions
462
+
463
+ == Clause
464
+
465
+ [appendix]
466
+ == Appendix A
467
+
468
+ [appendix]
469
+ == Appendix B
470
+
471
+ [appendix]
472
+ == Appendix C
473
+
474
+ INPUT
475
+ end
476
+
477
+ it "Warning if final section is not named Bibliography" do
478
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{There are sections after the final Bibliography}).to_stderr
479
+ #{VALIDATING_BLANK_HDR}
480
+
481
+ .Foreword
482
+ Foreword
483
+
484
+ == Scope
485
+
486
+ [bibliography]
487
+ == Normative References
488
+
489
+ == Terms and Definitions
490
+
491
+ == Clause
492
+
493
+ [appendix]
494
+ == Appendix A
495
+
496
+ [appendix]
497
+ == Appendix B
498
+
499
+ [bibliography]
500
+ == Bibliography
501
+
502
+ [bibliography]
503
+ == Appendix C
504
+
505
+ INPUT
506
+ end
507
+
508
+ it "Warning if final section is not styled Bibliography" do
509
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Section not marked up as \[bibliography\]!}).to_stderr
510
+ #{VALIDATING_BLANK_HDR}
511
+
512
+ .Foreword
513
+ Foreword
514
+
515
+ == Scope
516
+
517
+ [bibliography]
518
+ == Normative References
519
+
520
+ == Terms and Definitions
521
+
522
+ == Clause
523
+
524
+ [appendix]
525
+ == Appendix A
526
+
527
+ [appendix]
528
+ == Appendix B
529
+
530
+ == Bibliography
531
+
532
+ INPUT
533
+ end
534
+
535
+ it "Warning if English title intro and no French title intro" do
536
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No French Title Intro!}).to_stderr
537
+ = Document title
538
+ Author
539
+ :docfile: test.adoc
540
+ :nodoc:
541
+ :title-intro-en: Title
542
+ :no-isobib:
543
+
544
+ INPUT
545
+ end
546
+
547
+ it "Warning if French title intro and no English title intro" do
548
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No English Title Intro!}).to_stderr
549
+ = Document title
550
+ Author
551
+ :docfile: test.adoc
552
+ :nodoc:
553
+ :title-intro-fr: Title
554
+ :no-isobib:
555
+
556
+ INPUT
557
+ end
558
+
559
+
560
+ it "Warning if English title and no French intro" do
561
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No French Title!}).to_stderr
562
+ = Document title
563
+ Author
564
+ :docfile: test.adoc
565
+ :nodoc:
566
+ :title-main-en: Title
567
+ :no-isobib:
568
+
569
+ INPUT
570
+ end
571
+
572
+ it "Warning if French title and no English title" do
573
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No English Title!}).to_stderr
574
+ = Document title
575
+ Author
576
+ :docfile: test.adoc
577
+ :nodoc:
578
+ :title-main-fr: Title
579
+ :no-isobib:
580
+
581
+ INPUT
582
+ end
583
+
584
+ it "Warning if English title part and no French title part" do
585
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No French Title Part!}).to_stderr
586
+ = Document title
587
+ Author
588
+ :docfile: test.adoc
589
+ :nodoc:
590
+ :title-part-en: Title
591
+ :no-isobib:
592
+
593
+ INPUT
594
+ end
595
+
596
+ it "Warning if French title part and no English title part" do
597
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No English Title Part!}).to_stderr
598
+ = Document title
599
+ Author
600
+ :docfile: test.adoc
601
+ :nodoc:
602
+ :title-part-fr: Title
603
+ :no-isobib:
604
+
605
+ INPUT
606
+ end
607
+
608
+ it "Warning if non-IEC document with subpart" do
609
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Subpart defined on non-IEC document!}).to_stderr
610
+ = Document title
611
+ Author
612
+ :docfile: test.adoc
613
+ :nodoc:
614
+ :partnumber: 1-1
615
+ :publisher: ISO
616
+ :no-isobib:
617
+
618
+ INPUT
619
+ end
620
+
621
+ it "No warning if joint IEC/non-IEC document with subpart" do
622
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.not_to output(%r{Subpart defined on non-IEC document!}).to_stderr
623
+ = Document title
624
+ Author
625
+ :docfile: test.adoc
626
+ :nodoc:
627
+ :partnumber: 1-1
628
+ :publisher: ISO,IEC
629
+ :no-isobib:
630
+
631
+ INPUT
632
+ end
633
+
634
+ it "Warning if main title contains document type" do
635
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Main Title may name document type}).to_stderr
636
+ = Document title
637
+ Author
638
+ :docfile: test.adoc
639
+ :nodoc:
640
+ :title-main-en: A Technical Specification on Widgets
641
+ :no-isobib:
642
+
643
+ INPUT
644
+ end
645
+
646
+ it "Warning if intro title contains document type" do
647
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Title Intro may name document type}).to_stderr
648
+ = Document title
649
+ Author
650
+ :docfile: test.adoc
651
+ :nodoc:
652
+ :title-intro-en: A Technical Specification on Widgets
653
+ :no-isobib:
654
+
655
+ INPUT
656
+ end
657
+
658
+ it "Each first-level subclause must have a title" do
659
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{each first-level subclause must have a title}).to_stderr
660
+ #{VALIDATING_BLANK_HDR}
661
+ == Clause
662
+
663
+ === {blank}
664
+ INPUT
665
+ end
666
+
667
+ it "All subclauses must have a title, or none" do
668
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{all subclauses must have a title, or none}).to_stderr
669
+ #{VALIDATING_BLANK_HDR}
670
+ == Clause
671
+
672
+ === Subclause
673
+
674
+ ==== {blank}
675
+
676
+ ==== Subsubclause
677
+ INPUT
678
+ end
679
+
680
+ it "Warning if subclause is only child of its parent, or none" do
681
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{subclause is only child}).to_stderr
682
+ #{VALIDATING_BLANK_HDR}
683
+ == Clause
684
+
685
+ === Subclause
686
+
687
+ INPUT
688
+ end
689
+
690
+ it "Warning if invalid technical committee type" do
691
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{invalid technical committee type}).to_stderr
692
+ = Document title
693
+ Author
694
+ :docfile: test.adoc
695
+ :nodoc:
696
+ :technical-committee-type: X
697
+ :no-isobib:
698
+
699
+ INPUT
700
+ end
701
+
702
+ it "Warning if invalid subcommittee type" do
703
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{invalid subcommittee type}).to_stderr
704
+ = Document title
705
+ Author
706
+ :docfile: test.adoc
707
+ :nodoc:
708
+ :subcommittee-type: X
709
+ :no-isobib:
710
+
711
+ INPUT
712
+ end
713
+
714
+ it "Warning if invalid subcommittee type" do
715
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{invalid subcommittee type}).to_stderr
716
+ = Document title
717
+ Author
718
+ :docfile: test.adoc
719
+ :nodoc:
720
+ :subcommittee-type: X
721
+ :no-isobib:
722
+
723
+ INPUT
724
+ end
725
+
726
+ it "Warning if 'see' crossreference points to normative section" do
727
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{'see terms' is pointing to a normative section}).to_stderr
728
+ #{VALIDATING_BLANK_HDR}
729
+ [[terms]]
730
+ == Terms and Definitions
731
+
732
+ == Clause
733
+ See <<terms>>
734
+ INPUT
735
+ end
736
+
737
+ it "Warning if 'see' reference points to normative reference" do
738
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{is pointing to a normative reference}).to_stderr
739
+ #{VALIDATING_BLANK_HDR}
740
+ [bibliography]
741
+ == Normative References
742
+ * [[[terms,ISO 1]]] _References_
743
+
744
+ == Clause
745
+ See <<terms>>
746
+ INPUT
747
+ end
748
+
749
+ it "Warning if term definition starts with article" do
750
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{term definition starts with article}).to_stderr
751
+ #{VALIDATING_BLANK_HDR}
752
+ == Terms and Definitions
753
+
754
+ === Term
755
+
756
+ The definition of a term is a part of the specialized vocabulary of a particular field
757
+ INPUT
758
+ end
759
+
760
+ it "Warning if term definition ends with period" do
761
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{term definition ends with period}).to_stderr
762
+ #{VALIDATING_BLANK_HDR}
763
+ == Terms and Definitions
764
+
765
+ === Term
766
+
767
+ Part of the specialized vocabulary of a particular field.
768
+ INPUT
769
+ end
770
+
771
+ it "validates document against ISO XML schema" do
772
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{value of attribute "align" is invalid; must be equal to}).to_stderr
773
+ #{VALIDATING_BLANK_HDR}
774
+
775
+ [align=mid-air]
776
+ Para
777
+ INPUT
778
+ end
779
+
780
+
781
+ it "Warning if terms mismatches IEV" do
782
+ system "mv ~/.iev.pstore ~/.iev.pstore1"
783
+ system "rm test.iev.pstore"
784
+ mock_open_uri('103-01-02')
785
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Term "automation" does not match IEV 103-01-02 "functional"}).to_stderr
786
+ = Document title
787
+ Author
788
+ :docfile: test.adoc
789
+
790
+ [bibliography]
791
+ == Normative References
792
+ * [[[iev,IEV]]], _iev_
793
+
794
+ == Terms and definitions
795
+ === Automation
796
+
797
+ [.source]
798
+ <<iev,clause="103-01-02">>
799
+ INPUT
800
+ system "mv ~/.iev.pstore1 ~/.iev.pstore"
801
+ end
802
+
803
+ it "No warning if English term matches IEV" do
804
+ system "mv ~/.iev.pstore ~/.iev.pstore1"
805
+ system "rm test.iev.pstore"
806
+ mock_open_uri('103-01-02')
807
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.not_to output(%r{does not match IEV 103-01-02}).to_stderr
808
+ = Document title
809
+ Author
810
+ :docfile: test.adoc
811
+
812
+ [bibliography]
813
+ == Normative References
814
+ * [[[iev,IEV]]], _iev_
815
+
816
+ == Terms and definitions
817
+ === Functional
818
+
819
+ [.source]
820
+ <<iev,clause="103-01-02">>
821
+ INPUT
822
+ system "mv ~/.iev.pstore1 ~/.iev.pstore"
823
+ end
824
+
825
+ it "No warning if French term matches IEV" do
826
+ system "mv ~/.iev.pstore ~/.iev.pstore1"
827
+ system "rm test.iev.pstore"
828
+ mock_open_uri('103-01-02')
829
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.not_to output(%r{does not match IEV 103-01-02}).to_stderr
830
+ = Document title
831
+ Author
832
+ :docfile: test.adoc
833
+ :nodoc:
834
+ :language: fr
835
+
836
+ [bibliography]
837
+ == Normative References
838
+ * [[[iev,IEV]]], _iev_
839
+
840
+ == Terms and definitions
841
+ === Fonctionnelle, f
842
+
843
+ [.source]
844
+ <<iev,clause="103-01-02">>
845
+ INPUT
846
+ system "mv ~/.iev.pstore1 ~/.iev.pstore"
847
+ end
848
+
849
+ it "Warn if more than 7 levels of subclause" do
850
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Exceeds the maximum clause depth of 7}).to_stderr
851
+ = Document title
852
+ Author
853
+ :docfile: test.adoc
854
+ :nodoc:
855
+ :no-isobib:
856
+ :language: fr
857
+
858
+ == Clause
859
+
860
+ === Clause
861
+
862
+ ==== Clause
863
+
864
+ ===== Clause
865
+
866
+ ====== Clause
867
+
868
+ [level=6]
869
+ ====== Clause
870
+
871
+ [level=7]
872
+ ====== Clause
873
+
874
+ [level=8]
875
+ ====== Clause
876
+
877
+ INPUT
878
+ end
879
+
880
+ it "Do not warn if not more than 7 levels of subclause" do
881
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.not_to output(%r{exceeds the maximum clause depth of 7}).to_stderr
882
+ = Document title
883
+ Author
884
+ :docfile: test.adoc
885
+ :nodoc:
886
+ :no-isobib:
887
+ :language: fr
888
+
889
+ == Clause
890
+
891
+ === Clause
892
+
893
+ ==== Clause
894
+
895
+ ===== Clause
896
+
897
+ ====== Clause
898
+
899
+ [level=6]
900
+ ====== Clause
901
+
902
+ [level=7]
903
+ ====== Clause
904
+
905
+ INPUT
906
+ end
907
+ end