asciidoctor-iso 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +2 -0
- data/.travis.yml +5 -0
- data/Gemfile.lock +12 -10
- data/README.adoc +113 -16
- data/bin/rspec +18 -0
- data/lib/asciidoctor/iso/base.rb +30 -28
- data/lib/asciidoctor/iso/blocks.rb +33 -33
- data/lib/asciidoctor/iso/cleanup.rb +79 -33
- data/lib/asciidoctor/iso/cleanup_block.rb +71 -18
- data/lib/asciidoctor/iso/cleanup_ref.rb +35 -30
- data/lib/asciidoctor/iso/converter.rb +0 -3
- data/lib/asciidoctor/iso/front.rb +29 -16
- data/lib/asciidoctor/iso/html/isodoc.css +34 -0
- data/lib/asciidoctor/iso/html/wordstyle.css +138 -6
- data/lib/asciidoctor/iso/inline.rb +10 -22
- data/lib/asciidoctor/iso/isodoc.rng +66 -16
- data/lib/asciidoctor/iso/isostandard.rng +129 -15
- data/lib/asciidoctor/iso/lists.rb +49 -42
- data/lib/asciidoctor/iso/macros.rb +12 -8
- data/lib/asciidoctor/iso/section.rb +53 -37
- data/lib/asciidoctor/iso/table.rb +9 -1
- data/lib/asciidoctor/iso/utils.rb +18 -13
- data/lib/asciidoctor/iso/validate.rb +100 -24
- data/lib/asciidoctor/iso/validate_requirements.rb +106 -0
- data/lib/asciidoctor/iso/validate_section.rb +85 -65
- data/lib/asciidoctor/iso/validate_style.rb +68 -115
- data/lib/asciidoctor/iso/version.rb +1 -1
- data/spec/asciidoctor-iso/base_spec.rb +193 -0
- data/spec/asciidoctor-iso/blocks_spec.rb +426 -0
- data/spec/asciidoctor-iso/cleanup_spec.rb +687 -0
- data/spec/asciidoctor-iso/inline_spec.rb +159 -0
- data/spec/asciidoctor-iso/lists_spec.rb +189 -0
- data/spec/asciidoctor-iso/macros_spec.rb +20 -0
- data/spec/asciidoctor-iso/refs_spec.rb +194 -0
- data/spec/asciidoctor-iso/section_spec.rb +301 -0
- data/spec/asciidoctor-iso/table_spec.rb +307 -0
- data/spec/asciidoctor-iso/validate_spec.rb +749 -0
- data/spec/examples/english.yaml +69 -0
- data/spec/examples/rice.adoc +30 -28
- data/spec/examples/rice.doc +3035 -2865
- data/spec/examples/rice.html +281 -234
- data/spec/examples/rice.preview.html +30 -20
- data/spec/examples/rice.xml +250 -282
- data/spec/spec_helper.rb +87 -0
- metadata +17 -2
@@ -0,0 +1,749 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "warns when missing a title" do
|
4
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Table should have title/).to_stderr }
|
5
|
+
#{VALIDATING_BLANK_HDR}
|
6
|
+
|===
|
7
|
+
|A |B |C
|
8
|
+
|
9
|
+
h|1 |2 |3
|
10
|
+
|===
|
11
|
+
INPUT
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
RSpec.describe "warn that introduction may contain requirement" do
|
16
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Introduction may contain requirement/).to_stderr }
|
17
|
+
#{VALIDATING_BLANK_HDR}
|
18
|
+
== Introduction
|
19
|
+
|
20
|
+
The widget is required not to be larger than 15 cm.
|
21
|
+
INPUT
|
22
|
+
end
|
23
|
+
|
24
|
+
RSpec.describe "warn that foreword may contain recommendation" do
|
25
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Foreword may contain recommendation/).to_stderr }
|
26
|
+
#{VALIDATING_BLANK_HDR}
|
27
|
+
|
28
|
+
It is not recommended that widgets should be larger than 15 cm.
|
29
|
+
|
30
|
+
== Clause
|
31
|
+
INPUT
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec.describe "warn that foreword may contain permission" do
|
35
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Foreword may contain permission/).to_stderr }
|
36
|
+
#{VALIDATING_BLANK_HDR}
|
37
|
+
|
38
|
+
No widget is required to be larger than 15 cm.
|
39
|
+
|
40
|
+
== Clause
|
41
|
+
INPUT
|
42
|
+
end
|
43
|
+
|
44
|
+
RSpec.describe "warn that scope may contain recommendation" do
|
45
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Scope may contain recommendation/).to_stderr }
|
46
|
+
#{VALIDATING_BLANK_HDR}
|
47
|
+
|
48
|
+
== Scope
|
49
|
+
It is not recommended that widgets should be larger than 15 cm.
|
50
|
+
INPUT
|
51
|
+
end
|
52
|
+
|
53
|
+
RSpec.describe "warn that term example may contain recommendation" do
|
54
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Term Example may contain recommendation/).to_stderr }
|
55
|
+
#{VALIDATING_BLANK_HDR}
|
56
|
+
|
57
|
+
== Terms and Definitions
|
58
|
+
|
59
|
+
=== Term
|
60
|
+
|
61
|
+
[example]
|
62
|
+
It is not recommended that widgets should be larger than 15 cm.
|
63
|
+
INPUT
|
64
|
+
end
|
65
|
+
|
66
|
+
RSpec.describe "warn that note may contain recommendation" do
|
67
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Note may contain recommendation/).to_stderr }
|
68
|
+
#{VALIDATING_BLANK_HDR}
|
69
|
+
|
70
|
+
NOTE: It is not recommended that widgets should be larger than 15 cm.
|
71
|
+
INPUT
|
72
|
+
end
|
73
|
+
|
74
|
+
RSpec.describe "warn that footnote may contain recommendation" do
|
75
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Footnote may contain recommendation/).to_stderr }
|
76
|
+
#{VALIDATING_BLANK_HDR}
|
77
|
+
|
78
|
+
footnote:[It is not recommended that widgets should be larger than 15 cm.]
|
79
|
+
INPUT
|
80
|
+
end
|
81
|
+
|
82
|
+
RSpec.describe "warn that term source is not in expected format" do
|
83
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/term reference not in expected format/).to_stderr }
|
84
|
+
#{VALIDATING_BLANK_HDR}
|
85
|
+
|
86
|
+
[.source]
|
87
|
+
I am a generic paragraph
|
88
|
+
INPUT
|
89
|
+
end
|
90
|
+
|
91
|
+
RSpec.describe "warn that figure does not have title" do
|
92
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Figure should have title/).to_stderr }
|
93
|
+
#{VALIDATING_BLANK_HDR}
|
94
|
+
|
95
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
96
|
+
INPUT
|
97
|
+
end
|
98
|
+
|
99
|
+
RSpec.describe "warn that callouts do not match annotations" do
|
100
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/mismatch of callouts and annotations/).to_stderr }
|
101
|
+
#{VALIDATING_BLANK_HDR}
|
102
|
+
[source,ruby]
|
103
|
+
--
|
104
|
+
puts "Hello, world." <1>
|
105
|
+
%w{a b c}.each do |x|
|
106
|
+
puts x
|
107
|
+
end
|
108
|
+
--
|
109
|
+
<1> This is one callout
|
110
|
+
<2> This is another callout
|
111
|
+
INPUT
|
112
|
+
end
|
113
|
+
|
114
|
+
RSpec.describe "term source is not a real reference" do
|
115
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/iso123 is not a real reference/).to_stderr }
|
116
|
+
#{VALIDATING_BLANK_HDR}
|
117
|
+
|
118
|
+
[.source]
|
119
|
+
<<iso123>>
|
120
|
+
INPUT
|
121
|
+
end
|
122
|
+
|
123
|
+
RSpec.describe "Non-reference in bibliography" do
|
124
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/no anchor on reference/).to_stderr }
|
125
|
+
#{VALIDATING_BLANK_HDR}
|
126
|
+
|
127
|
+
== Normative References
|
128
|
+
* I am not a reference
|
129
|
+
INPUT
|
130
|
+
end
|
131
|
+
|
132
|
+
RSpec.describe "Non-ISO reference in Normative References" do
|
133
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{non-ISO/IEC reference not expected as normative}).to_stderr }
|
134
|
+
#{VALIDATING_BLANK_HDR}
|
135
|
+
|
136
|
+
== Normative References
|
137
|
+
* [[[XYZ,IESO 121]]] _Standard_
|
138
|
+
INPUT
|
139
|
+
end
|
140
|
+
|
141
|
+
RSpec.describe "Scope contains subsections" do
|
142
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Scope contains subsections: should be succint}).to_stderr }
|
143
|
+
#{VALIDATING_BLANK_HDR}
|
144
|
+
|
145
|
+
== Scope
|
146
|
+
|
147
|
+
=== Scope subsection
|
148
|
+
INPUT
|
149
|
+
end
|
150
|
+
|
151
|
+
|
152
|
+
RSpec.describe "Table should have title" do
|
153
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Table should have title}).to_stderr }
|
154
|
+
#{VALIDATING_BLANK_HDR}
|
155
|
+
|
156
|
+
|===
|
157
|
+
|a |b |c
|
158
|
+
|===
|
159
|
+
INPUT
|
160
|
+
end
|
161
|
+
|
162
|
+
RSpec.describe "Style warning if number not broken up in threes" do
|
163
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{number not broken up in threes}).to_stderr }
|
164
|
+
#{VALIDATING_BLANK_HDR}
|
165
|
+
|
166
|
+
== Clause
|
167
|
+
12121
|
168
|
+
INPUT
|
169
|
+
end
|
170
|
+
|
171
|
+
RSpec.describe "No style warning if number not broken up in threes is ISO reference" do
|
172
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to_not output(%r{number not broken up in threes}).to_stderr }
|
173
|
+
#{VALIDATING_BLANK_HDR}
|
174
|
+
|
175
|
+
== Clause
|
176
|
+
ISO 12121
|
177
|
+
INPUT
|
178
|
+
end
|
179
|
+
|
180
|
+
RSpec.describe "Style warning if decimal point" do
|
181
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{possible decimal point}).to_stderr }
|
182
|
+
#{VALIDATING_BLANK_HDR}
|
183
|
+
|
184
|
+
== Clause
|
185
|
+
8.1
|
186
|
+
INPUT
|
187
|
+
end
|
188
|
+
|
189
|
+
RSpec.describe "Style warning if billion used" do
|
190
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{ambiguous number}).to_stderr }
|
191
|
+
#{VALIDATING_BLANK_HDR}
|
192
|
+
|
193
|
+
== Clause
|
194
|
+
"Billions" are a term of art.
|
195
|
+
INPUT
|
196
|
+
end
|
197
|
+
|
198
|
+
RSpec.describe "Style warning if no space before percent sign" do
|
199
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{no space before percent sign}).to_stderr }
|
200
|
+
#{VALIDATING_BLANK_HDR}
|
201
|
+
|
202
|
+
== Clause
|
203
|
+
95%
|
204
|
+
INPUT
|
205
|
+
end
|
206
|
+
|
207
|
+
RSpec.describe "Style warning if unbracketed tolerance before percent sign" do
|
208
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{unbracketed tolerance before percent sign}).to_stderr }
|
209
|
+
#{VALIDATING_BLANK_HDR}
|
210
|
+
|
211
|
+
== Clause
|
212
|
+
95 ± 5 %
|
213
|
+
INPUT
|
214
|
+
end
|
215
|
+
|
216
|
+
RSpec.describe "Style warning if dots in abbreviation" do
|
217
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{no dots in abbreviation}).to_stderr }
|
218
|
+
#{VALIDATING_BLANK_HDR}
|
219
|
+
|
220
|
+
== Clause
|
221
|
+
r.p.m.
|
222
|
+
INPUT
|
223
|
+
end
|
224
|
+
|
225
|
+
RSpec.describe "No Style warning if dots in abbreviation are e.g." do
|
226
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to_not output(%r{no dots in abbreviation}).to_stderr }
|
227
|
+
#{VALIDATING_BLANK_HDR}
|
228
|
+
|
229
|
+
== Clause
|
230
|
+
e.g. 5
|
231
|
+
INPUT
|
232
|
+
end
|
233
|
+
|
234
|
+
RSpec.describe "Style warning if ppm used" do
|
235
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{language-specific abbreviation}).to_stderr }
|
236
|
+
#{VALIDATING_BLANK_HDR}
|
237
|
+
|
238
|
+
== Clause
|
239
|
+
5 ppm
|
240
|
+
INPUT
|
241
|
+
end
|
242
|
+
|
243
|
+
RSpec.describe "Style warning if space between number and degree" do
|
244
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{space between number and degrees/minutes/seconds}).to_stderr }
|
245
|
+
#{VALIDATING_BLANK_HDR}
|
246
|
+
|
247
|
+
== Clause
|
248
|
+
5 °
|
249
|
+
INPUT
|
250
|
+
end
|
251
|
+
|
252
|
+
RSpec.describe "Style warning if no space between number and SI unit" do
|
253
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{no space between number and SI unit}).to_stderr }
|
254
|
+
#{VALIDATING_BLANK_HDR}
|
255
|
+
|
256
|
+
== Clause
|
257
|
+
A measurement of 5Bq was taken.
|
258
|
+
INPUT
|
259
|
+
end
|
260
|
+
|
261
|
+
RSpec.describe "Style warning if mins used" do
|
262
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{non-standard unit}).to_stderr }
|
263
|
+
#{VALIDATING_BLANK_HDR}
|
264
|
+
|
265
|
+
== Clause
|
266
|
+
5 mins
|
267
|
+
INPUT
|
268
|
+
end
|
269
|
+
|
270
|
+
# can't test: our asciidoc template won't allow this to be generated
|
271
|
+
# RSpec.describe "Style warning if foreword contains subsections" do
|
272
|
+
# specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{non-standard unit}).to_stderr }
|
273
|
+
# #{VALIDATING_BLANK_HDR}
|
274
|
+
#
|
275
|
+
# INPUT
|
276
|
+
# end
|
277
|
+
|
278
|
+
# can't test: we strip out any such content from Normative references preemptively
|
279
|
+
#RSpec.describe "Style warning if Normative References contains subsections" do
|
280
|
+
#specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{normative references contains subsections}).to_stderr }
|
281
|
+
##{VALIDATING_BLANK_HDR}
|
282
|
+
#
|
283
|
+
#[bibliography]
|
284
|
+
#== Normative References
|
285
|
+
#
|
286
|
+
#=== Subsection
|
287
|
+
#INPUT
|
288
|
+
#end
|
289
|
+
|
290
|
+
RSpec.describe "Style warning if two Symbols and Abbreviated Terms sections" do
|
291
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{only one Symbols and Abbreviated Terms section in the standard}).to_stderr }
|
292
|
+
#{VALIDATING_BLANK_HDR}
|
293
|
+
|
294
|
+
== Terms and Abbreviations
|
295
|
+
|
296
|
+
=== Symbols and Abbreviated Terms
|
297
|
+
|
298
|
+
== Symbols and Abbreviated Terms
|
299
|
+
INPUT
|
300
|
+
end
|
301
|
+
|
302
|
+
RSpec.describe "Style warning if Symbols and Abbreviated Terms contains extraneous matter" do
|
303
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Symbols and Abbreviated Terms can only contain a definition list}).to_stderr }
|
304
|
+
#{VALIDATING_BLANK_HDR}
|
305
|
+
|
306
|
+
== Symbols and Abbreviated Terms
|
307
|
+
|
308
|
+
Paragraph
|
309
|
+
INPUT
|
310
|
+
end
|
311
|
+
|
312
|
+
RSpec.describe "Warning if do not start with scope or introduction" do
|
313
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Prefatory material must be followed by \(clause\) Scope}).to_stderr }
|
314
|
+
#{VALIDATING_BLANK_HDR}
|
315
|
+
|
316
|
+
== Symbols and Abbreviated Terms
|
317
|
+
|
318
|
+
Paragraph
|
319
|
+
INPUT
|
320
|
+
end
|
321
|
+
|
322
|
+
RSpec.describe "Warning if introduction not followed by scope" do
|
323
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Prefatory material must be followed by \(clause\) Scope}).to_stderr }
|
324
|
+
#{VALIDATING_BLANK_HDR}
|
325
|
+
|
326
|
+
.Foreword
|
327
|
+
Foreword
|
328
|
+
|
329
|
+
== Introduction
|
330
|
+
|
331
|
+
== Symbols and Abbreviated Terms
|
332
|
+
|
333
|
+
Paragraph
|
334
|
+
INPUT
|
335
|
+
end
|
336
|
+
|
337
|
+
RSpec.describe "Warning if normative references not followed by terms and definitions" do
|
338
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Normative References must be followed by Terms and Definitions}).to_stderr }
|
339
|
+
#{VALIDATING_BLANK_HDR}
|
340
|
+
|
341
|
+
.Foreword
|
342
|
+
Foreword
|
343
|
+
|
344
|
+
== Scope
|
345
|
+
|
346
|
+
[bibliography]
|
347
|
+
== Normative References
|
348
|
+
|
349
|
+
== Symbols and Abbreviated Terms
|
350
|
+
|
351
|
+
Paragraph
|
352
|
+
INPUT
|
353
|
+
end
|
354
|
+
|
355
|
+
RSpec.describe "Warning if there are no clauses in the document" do
|
356
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Document must contain clause after Terms and Definitions}).to_stderr }
|
357
|
+
#{VALIDATING_BLANK_HDR}
|
358
|
+
|
359
|
+
.Foreword
|
360
|
+
Foreword
|
361
|
+
|
362
|
+
== Scope
|
363
|
+
|
364
|
+
[bibliography]
|
365
|
+
== Normative References
|
366
|
+
|
367
|
+
== Terms and Definitions
|
368
|
+
|
369
|
+
== Symbols and Abbreviated Terms
|
370
|
+
|
371
|
+
INPUT
|
372
|
+
end
|
373
|
+
|
374
|
+
RSpec.describe "Warning if scope occurs after Terms and Definitions" do
|
375
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Scope must occur before Terms and Definitions}).to_stderr }
|
376
|
+
#{VALIDATING_BLANK_HDR}
|
377
|
+
|
378
|
+
.Foreword
|
379
|
+
Foreword
|
380
|
+
|
381
|
+
== Scope
|
382
|
+
|
383
|
+
[bibliography]
|
384
|
+
== Normative References
|
385
|
+
|
386
|
+
== Terms and Definitions
|
387
|
+
|
388
|
+
== Scope
|
389
|
+
|
390
|
+
INPUT
|
391
|
+
end
|
392
|
+
|
393
|
+
RSpec.describe "Warning if scope occurs after Terms and Definitions" do
|
394
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Scope must occur before Terms and Definitions}).to_stderr }
|
395
|
+
#{VALIDATING_BLANK_HDR}
|
396
|
+
|
397
|
+
.Foreword
|
398
|
+
Foreword
|
399
|
+
|
400
|
+
== Scope
|
401
|
+
|
402
|
+
[bibliography]
|
403
|
+
== Normative References
|
404
|
+
|
405
|
+
== Terms and Definitions
|
406
|
+
|
407
|
+
== Clause
|
408
|
+
|
409
|
+
== Scope
|
410
|
+
|
411
|
+
INPUT
|
412
|
+
end
|
413
|
+
|
414
|
+
RSpec.describe "Warning if Symbols and Abbreviated Terms does not occur immediately after Terms and Definitions" do
|
415
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Only annexes and references can follow clauses}).to_stderr }
|
416
|
+
#{VALIDATING_BLANK_HDR}
|
417
|
+
|
418
|
+
.Foreword
|
419
|
+
Foreword
|
420
|
+
|
421
|
+
== Scope
|
422
|
+
|
423
|
+
[bibliography]
|
424
|
+
== Normative References
|
425
|
+
|
426
|
+
== Terms and Definitions
|
427
|
+
|
428
|
+
== Clause
|
429
|
+
|
430
|
+
== Symbols and Abbreviated Terms
|
431
|
+
|
432
|
+
INPUT
|
433
|
+
end
|
434
|
+
|
435
|
+
RSpec.describe "Warning if no normative references" do
|
436
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Document must include \(references\) Normative References}).to_stderr }
|
437
|
+
#{VALIDATING_BLANK_HDR}
|
438
|
+
|
439
|
+
.Foreword
|
440
|
+
Foreword
|
441
|
+
|
442
|
+
== Scope
|
443
|
+
|
444
|
+
== Terms and Definitions
|
445
|
+
|
446
|
+
== Clause
|
447
|
+
|
448
|
+
[appendix]
|
449
|
+
== Appendix A
|
450
|
+
|
451
|
+
[appendix]
|
452
|
+
== Appendix B
|
453
|
+
|
454
|
+
== Appendix C
|
455
|
+
|
456
|
+
INPUT
|
457
|
+
end
|
458
|
+
|
459
|
+
RSpec.describe "Warning if final section is not Bibliography" do
|
460
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Final section must be \(references\) Bibliography}).to_stderr }
|
461
|
+
#{VALIDATING_BLANK_HDR}
|
462
|
+
|
463
|
+
.Foreword
|
464
|
+
Foreword
|
465
|
+
|
466
|
+
== Scope
|
467
|
+
|
468
|
+
[bibliography]
|
469
|
+
== Normative References
|
470
|
+
|
471
|
+
== Terms and Definitions
|
472
|
+
|
473
|
+
== Clause
|
474
|
+
|
475
|
+
[appendix]
|
476
|
+
== Appendix A
|
477
|
+
|
478
|
+
[appendix]
|
479
|
+
== Appendix B
|
480
|
+
|
481
|
+
[bibliography]
|
482
|
+
== Appendix C
|
483
|
+
|
484
|
+
INPUT
|
485
|
+
end
|
486
|
+
|
487
|
+
RSpec.describe "Warning if final section is not Bibliography" do
|
488
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{There are sections after the final Bibliography}).to_stderr }
|
489
|
+
#{VALIDATING_BLANK_HDR}
|
490
|
+
|
491
|
+
.Foreword
|
492
|
+
Foreword
|
493
|
+
|
494
|
+
== Scope
|
495
|
+
|
496
|
+
[bibliography]
|
497
|
+
== Normative References
|
498
|
+
|
499
|
+
== Terms and Definitions
|
500
|
+
|
501
|
+
== Clause
|
502
|
+
|
503
|
+
[appendix]
|
504
|
+
== Appendix A
|
505
|
+
|
506
|
+
[appendix]
|
507
|
+
== Appendix B
|
508
|
+
|
509
|
+
[bibliography]
|
510
|
+
== Bibliography
|
511
|
+
|
512
|
+
[bibliography]
|
513
|
+
== Appendix C
|
514
|
+
|
515
|
+
INPUT
|
516
|
+
end
|
517
|
+
|
518
|
+
RSpec.describe "Warning if English title intro and no French title intro" do
|
519
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No French Title Intro!}).to_stderr }
|
520
|
+
= Document title
|
521
|
+
Author
|
522
|
+
:docfile: test.adoc
|
523
|
+
:nodoc:
|
524
|
+
:title-intro-en: Title
|
525
|
+
|
526
|
+
INPUT
|
527
|
+
end
|
528
|
+
|
529
|
+
RSpec.describe "Warning if French title intro and no English title intro" do
|
530
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No English Title Intro!}).to_stderr }
|
531
|
+
= Document title
|
532
|
+
Author
|
533
|
+
:docfile: test.adoc
|
534
|
+
:nodoc:
|
535
|
+
:title-intro-fr: Title
|
536
|
+
|
537
|
+
INPUT
|
538
|
+
end
|
539
|
+
|
540
|
+
|
541
|
+
RSpec.describe "Warning if English title and no French intro" do
|
542
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No French Title!}).to_stderr }
|
543
|
+
= Document title
|
544
|
+
Author
|
545
|
+
:docfile: test.adoc
|
546
|
+
:nodoc:
|
547
|
+
:title-main-en: Title
|
548
|
+
|
549
|
+
INPUT
|
550
|
+
end
|
551
|
+
|
552
|
+
RSpec.describe "Warning if French title and no English title" do
|
553
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No English Title!}).to_stderr }
|
554
|
+
= Document title
|
555
|
+
Author
|
556
|
+
:docfile: test.adoc
|
557
|
+
:nodoc:
|
558
|
+
:title-main-fr: Title
|
559
|
+
|
560
|
+
INPUT
|
561
|
+
end
|
562
|
+
|
563
|
+
RSpec.describe "Warning if English title part and no French title part" do
|
564
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No French Title Part!}).to_stderr }
|
565
|
+
= Document title
|
566
|
+
Author
|
567
|
+
:docfile: test.adoc
|
568
|
+
:nodoc:
|
569
|
+
:title-part-en: Title
|
570
|
+
|
571
|
+
INPUT
|
572
|
+
end
|
573
|
+
|
574
|
+
RSpec.describe "Warning if French title part and no English title part" do
|
575
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No English Title Part!}).to_stderr }
|
576
|
+
= Document title
|
577
|
+
Author
|
578
|
+
:docfile: test.adoc
|
579
|
+
:nodoc:
|
580
|
+
:title-part-fr: Title
|
581
|
+
|
582
|
+
INPUT
|
583
|
+
end
|
584
|
+
|
585
|
+
RSpec.describe "Warning if non-IEC document with subpart" do
|
586
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Subpart defined on non-IEC document!}).to_stderr }
|
587
|
+
= Document title
|
588
|
+
Author
|
589
|
+
:docfile: test.adoc
|
590
|
+
:nodoc:
|
591
|
+
:partnumber: 1-1
|
592
|
+
:publisher: ISO
|
593
|
+
|
594
|
+
INPUT
|
595
|
+
end
|
596
|
+
|
597
|
+
RSpec.describe "No warning if joint IEC/non-IEC document with subpart" do
|
598
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.not_to output(%r{Subpart defined on non-IEC document!}).to_stderr }
|
599
|
+
= Document title
|
600
|
+
Author
|
601
|
+
:docfile: test.adoc
|
602
|
+
:nodoc:
|
603
|
+
:partnumber: 1-1
|
604
|
+
:publisher: ISO,IEC
|
605
|
+
|
606
|
+
INPUT
|
607
|
+
end
|
608
|
+
|
609
|
+
RSpec.describe "Warning if main title contains document type" do
|
610
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Main Title may name document type}).to_stderr }
|
611
|
+
= Document title
|
612
|
+
Author
|
613
|
+
:docfile: test.adoc
|
614
|
+
:nodoc:
|
615
|
+
:title-main-en: A Technical Specification on Widgets
|
616
|
+
|
617
|
+
INPUT
|
618
|
+
end
|
619
|
+
|
620
|
+
RSpec.describe "Warning if intro title contains document type" do
|
621
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Title Intro may name document type}).to_stderr }
|
622
|
+
= Document title
|
623
|
+
Author
|
624
|
+
:docfile: test.adoc
|
625
|
+
:nodoc:
|
626
|
+
:title-intro-en: A Technical Specification on Widgets
|
627
|
+
|
628
|
+
INPUT
|
629
|
+
end
|
630
|
+
|
631
|
+
RSpec.describe "Each first-level subclause must have a title" do
|
632
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{each first-level subclause must have a title}).to_stderr }
|
633
|
+
#{VALIDATING_BLANK_HDR}
|
634
|
+
== Clause
|
635
|
+
|
636
|
+
=== {blank}
|
637
|
+
INPUT
|
638
|
+
end
|
639
|
+
|
640
|
+
RSpec.describe "All subclauses must have a title, or none" do
|
641
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{all subclauses must have a title, or none}).to_stderr }
|
642
|
+
#{VALIDATING_BLANK_HDR}
|
643
|
+
== Clause
|
644
|
+
|
645
|
+
=== Subclause
|
646
|
+
|
647
|
+
==== {blank}
|
648
|
+
|
649
|
+
==== Subsubclause
|
650
|
+
INPUT
|
651
|
+
end
|
652
|
+
|
653
|
+
RSpec.describe "Warning if subsection is only child of its parent, or none" do
|
654
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{subsection is only child}).to_stderr }
|
655
|
+
#{VALIDATING_BLANK_HDR}
|
656
|
+
== Clause
|
657
|
+
|
658
|
+
=== Subclause
|
659
|
+
|
660
|
+
INPUT
|
661
|
+
end
|
662
|
+
|
663
|
+
RSpec.describe "Warning if invalid technical committee type" do
|
664
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{invalid technical committee type}).to_stderr }
|
665
|
+
= Document title
|
666
|
+
Author
|
667
|
+
:docfile: test.adoc
|
668
|
+
:nodoc:
|
669
|
+
:technical-committee-type: X
|
670
|
+
|
671
|
+
INPUT
|
672
|
+
end
|
673
|
+
|
674
|
+
RSpec.describe "Warning if invalid subcommittee type" do
|
675
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{invalid subcommittee type}).to_stderr }
|
676
|
+
= Document title
|
677
|
+
Author
|
678
|
+
:docfile: test.adoc
|
679
|
+
:nodoc:
|
680
|
+
:subcommittee-type: X
|
681
|
+
|
682
|
+
INPUT
|
683
|
+
end
|
684
|
+
|
685
|
+
RSpec.describe "Warning if invalid subcommittee type" do
|
686
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{invalid subcommittee type}).to_stderr }
|
687
|
+
= Document title
|
688
|
+
Author
|
689
|
+
:docfile: test.adoc
|
690
|
+
:nodoc:
|
691
|
+
:subcommittee-type: X
|
692
|
+
|
693
|
+
INPUT
|
694
|
+
end
|
695
|
+
|
696
|
+
RSpec.describe "Warning if 'see' crossreference points to normative section" do
|
697
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{'see terms' is pointing to a normative section}).to_stderr }
|
698
|
+
#{VALIDATING_BLANK_HDR}
|
699
|
+
[[terms]]
|
700
|
+
== Terms and Definitions
|
701
|
+
|
702
|
+
== Clause
|
703
|
+
See <<terms>>
|
704
|
+
INPUT
|
705
|
+
end
|
706
|
+
|
707
|
+
RSpec.describe "Warning if 'see' reference points to normative reference" do
|
708
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{is pointing to a normative reference}).to_stderr }
|
709
|
+
#{VALIDATING_BLANK_HDR}
|
710
|
+
[bibliography]
|
711
|
+
== Normative References
|
712
|
+
* [[[terms,ISO 1]]] _References_
|
713
|
+
|
714
|
+
== Clause
|
715
|
+
See <<terms>>
|
716
|
+
INPUT
|
717
|
+
end
|
718
|
+
|
719
|
+
RSpec.describe "Warning if term definition starts with article" do
|
720
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{term definition starts with article}).to_stderr }
|
721
|
+
#{VALIDATING_BLANK_HDR}
|
722
|
+
== Terms and Definitions
|
723
|
+
|
724
|
+
=== Term
|
725
|
+
|
726
|
+
The definition of a term is a part of the specialized vocabulary of a particular field
|
727
|
+
INPUT
|
728
|
+
end
|
729
|
+
|
730
|
+
RSpec.describe "Warning if term definition ends with period" do
|
731
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{term definition ends with period}).to_stderr }
|
732
|
+
#{VALIDATING_BLANK_HDR}
|
733
|
+
== Terms and Definitions
|
734
|
+
|
735
|
+
=== Term
|
736
|
+
|
737
|
+
Part of the specialized vocabulary of a particular field.
|
738
|
+
INPUT
|
739
|
+
end
|
740
|
+
|
741
|
+
RSpec.describe "validates document against ISO XML schema" do
|
742
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{value of attribute "align" is invalid; must be equal to}).to_stderr }
|
743
|
+
#{VALIDATING_BLANK_HDR}
|
744
|
+
|
745
|
+
[align=mid-air]
|
746
|
+
Para
|
747
|
+
INPUT
|
748
|
+
end
|
749
|
+
|