metanorma-iso 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/iso/base.rb +13 -11
- data/lib/asciidoctor/iso/cleanup.rb +27 -23
- data/lib/asciidoctor/iso/front.rb +25 -15
- data/lib/asciidoctor/iso/validate.rb +22 -110
- data/lib/asciidoctor/iso/validate_image.rb +97 -0
- data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
- data/lib/asciidoctor/iso/validate_section.rb +39 -20
- data/lib/asciidoctor/iso/validate_style.rb +36 -24
- data/lib/asciidoctor/iso/validate_title.rb +2 -4
- data/lib/isodoc/iso/base_convert.rb +8 -2
- data/lib/isodoc/iso/iso.amendment.xsl +326 -61
- data/lib/isodoc/iso/iso.international-standard.xsl +326 -61
- data/lib/isodoc/iso/presentation_xml_convert.rb +15 -14
- data/lib/isodoc/iso/xref.rb +2 -2
- data/lib/metanorma/iso/processor.rb +1 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/asciidoctor/base_spec.rb +36 -7
- data/spec/asciidoctor/validate_spec.rb +120 -65
- metadata +3 -2
@@ -26,23 +26,23 @@ module IsoDoc
|
|
26
26
|
@xrefs = Xref.new(lang, script, klass, labels, options)
|
27
27
|
end
|
28
28
|
|
29
|
-
def figure1(
|
30
|
-
return if labelled_ancestor(
|
29
|
+
def figure1(node)
|
30
|
+
return if labelled_ancestor(node) && node.ancestors("figure").empty?
|
31
31
|
|
32
|
-
lbl = @xrefs.anchor(
|
33
|
-
figname =
|
34
|
-
connective =
|
35
|
-
prefix_name(
|
32
|
+
lbl = @xrefs.anchor(node["id"], :label, false) or return
|
33
|
+
figname = node.parent.name == "figure" ? "" : "#{@i18n.figure} "
|
34
|
+
connective = node.parent.name == "figure" ? " " : " — "
|
35
|
+
prefix_name(node, connective, l10n("#{figname}#{lbl}"), "name")
|
36
36
|
end
|
37
37
|
|
38
|
-
def example1(
|
39
|
-
n = @xrefs.get[
|
38
|
+
def example1(node)
|
39
|
+
n = @xrefs.get[node["id"]]
|
40
40
|
lbl = if n.nil? || n[:label].nil? || n[:label].empty?
|
41
41
|
@i18n.example
|
42
42
|
else
|
43
43
|
l10n("#{@i18n.example} #{n[:label]}")
|
44
44
|
end
|
45
|
-
prefix_name(
|
45
|
+
prefix_name(node, " — ", lbl, "name")
|
46
46
|
end
|
47
47
|
|
48
48
|
def eref_localities1_zh(target, type, from, to, n, delim)
|
@@ -56,7 +56,8 @@ module IsoDoc
|
|
56
56
|
ret += "–#{to.text}" if to
|
57
57
|
loc = (@i18n.locality[type] || type.sub(/^locality:/, "").capitalize)
|
58
58
|
ret += " #{loc}" unless subsection && type == "clause" ||
|
59
|
-
type == "list" || target.match(/^IEV$|^IEC 60050-/) ||
|
59
|
+
type == "list" || target.match(/^IEV$|^IEC 60050-/) ||
|
60
|
+
n["droploc"] == "true"
|
60
61
|
ret += ")" if type == "list"
|
61
62
|
ret
|
62
63
|
end
|
@@ -95,10 +96,10 @@ module IsoDoc
|
|
95
96
|
end
|
96
97
|
end
|
97
98
|
|
98
|
-
def clause1(
|
99
|
-
if !
|
100
|
-
!%w(sections preface bibliography).include?(
|
101
|
-
|
99
|
+
def clause1(node)
|
100
|
+
if !node.at(ns("./title")) &&
|
101
|
+
!%w(sections preface bibliography).include?(node.parent.name)
|
102
|
+
node["inline-header"] = "true"
|
102
103
|
end
|
103
104
|
super
|
104
105
|
end
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -56,8 +56,8 @@ module IsoDoc
|
|
56
56
|
# subclauses are not prefixed with "Clause"
|
57
57
|
i = Counter.new
|
58
58
|
clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
|
59
|
-
"./references"))
|
60
|
-
|
59
|
+
"./references"))
|
60
|
+
.each do |c|
|
61
61
|
i.increment(c)
|
62
62
|
section_names1(c, "#{num}.#{i.print}", level + 1)
|
63
63
|
end
|
@@ -238,12 +238,26 @@ RSpec.describe Asciidoctor::ISO do
|
|
238
238
|
<organization>
|
239
239
|
<name>International Electrotechnical Commission</name>
|
240
240
|
<abbreviation>IEC</abbreviation>
|
241
|
+
<address>
|
242
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
243
|
+
</address>
|
244
|
+
<phone>3333333</phone>
|
245
|
+
<phone type='fax'>4444444</phone>
|
246
|
+
<email>x@example.com</email>
|
247
|
+
<uri>http://www.example.com</uri>
|
241
248
|
</organization>
|
242
249
|
</contributor>
|
243
250
|
<contributor>
|
244
251
|
<role type="publisher"/>
|
245
252
|
<organization>
|
246
253
|
<name>IETF</name>
|
254
|
+
<address>
|
255
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
256
|
+
</address>
|
257
|
+
<phone>3333333</phone>
|
258
|
+
<phone type='fax'>4444444</phone>
|
259
|
+
<email>x@example.com</email>
|
260
|
+
<uri>http://www.example.com</uri>
|
247
261
|
</organization>
|
248
262
|
</contributor>
|
249
263
|
<contributor>
|
@@ -251,6 +265,13 @@ RSpec.describe Asciidoctor::ISO do
|
|
251
265
|
<organization>
|
252
266
|
<name>International Organization for Standardization</name>
|
253
267
|
<abbreviation>ISO</abbreviation>
|
268
|
+
<address>
|
269
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
270
|
+
</address>
|
271
|
+
<phone>3333333</phone>
|
272
|
+
<phone type='fax'>4444444</phone>
|
273
|
+
<email>x@example.com</email>
|
274
|
+
<uri>http://www.example.com</uri>
|
254
275
|
</organization>
|
255
276
|
</contributor>
|
256
277
|
<language>el</language>
|
@@ -265,6 +286,14 @@ RSpec.describe Asciidoctor::ISO do
|
|
265
286
|
<organization>
|
266
287
|
<name>International Organization for Standardization</name>
|
267
288
|
<abbreviation>ISO</abbreviation>
|
289
|
+
<address>
|
290
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
291
|
+
</address>
|
292
|
+
<phone>3333333</phone>
|
293
|
+
<phone type='fax'>4444444</phone>
|
294
|
+
<email>x@example.com</email>
|
295
|
+
<uri>http://www.example.com</uri>
|
296
|
+
|
268
297
|
</organization>
|
269
298
|
</owner>
|
270
299
|
</copyright>
|
@@ -273,6 +302,13 @@ RSpec.describe Asciidoctor::ISO do
|
|
273
302
|
<owner>
|
274
303
|
<organization>
|
275
304
|
<name>IETF</name>
|
305
|
+
<address>
|
306
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
307
|
+
</address>
|
308
|
+
<phone>3333333</phone>
|
309
|
+
<phone type='fax'>4444444</phone>
|
310
|
+
<email>x@example.com</email>
|
311
|
+
<uri>http://www.example.com</uri>
|
276
312
|
</organization>
|
277
313
|
</owner>
|
278
314
|
</copyright>
|
@@ -336,13 +372,6 @@ RSpec.describe Asciidoctor::ISO do
|
|
336
372
|
<name>International Organization for Standardization</name>
|
337
373
|
<subdivision>Subdivision</subdivision>
|
338
374
|
<abbreviation>SD</abbreviation>
|
339
|
-
<address>
|
340
|
-
<formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
|
341
|
-
</address>
|
342
|
-
<phone>3333333</phone>
|
343
|
-
<phone type='fax'>4444444</phone>
|
344
|
-
<email>x@example.com</email>
|
345
|
-
<uri>http://www.example.com</uri>
|
346
375
|
</organization>
|
347
376
|
</contributor>
|
348
377
|
<contributor>
|
@@ -71,47 +71,67 @@ RSpec.describe Asciidoctor::ISO do
|
|
71
71
|
|
72
72
|
INPUT
|
73
73
|
expect(File.read("test.err")).to include \
|
74
|
-
"image name spec/examples/rice_images/rice_image1.png does not match
|
74
|
+
"image name spec/examples/rice_images/rice_image1.png does not match "\
|
75
|
+
"DRG requirements: expect 1000-1_ed2amd3fig"
|
75
76
|
expect(File.read("test.err")).to include \
|
76
|
-
"image name spec/examples/rice_images/1001_ed2amd3fig1.png does not
|
77
|
-
|
77
|
+
"image name spec/examples/rice_images/1001_ed2amd3fig1.png does not "\
|
78
|
+
"match DRG requirements: " \
|
79
|
+
"expect 1000-1_ed2amd3fig"
|
78
80
|
expect(File.read("test.err")).not_to include \
|
79
|
-
"image name spec/examples/rice_images/SL1000-1_ed2amd3fig1.png does not
|
80
|
-
|
81
|
+
"image name spec/examples/rice_images/SL1000-1_ed2amd3fig1.png does not "\
|
82
|
+
"match DRG requirements: " \
|
83
|
+
"expect 1000-1_ed2amd3fig"
|
81
84
|
expect(File.read("test.err")).not_to include \
|
82
|
-
"image name spec/examples/rice_images/ISO_1213_1.png does not match DRG
|
85
|
+
"image name spec/examples/rice_images/ISO_1213_1.png does not match DRG "\
|
86
|
+
"requirements: expect 1000-1_ed2amd3fig"
|
83
87
|
expect(File.read("test.err")).to include \
|
84
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3figA.png does not
|
88
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3figA.png does not "\
|
89
|
+
"match DRG requirements"
|
85
90
|
expect(File.read("test.err")).not_to include \
|
86
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3figTab1.png does
|
91
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3figTab1.png does "\
|
92
|
+
"not match DRG requirements"
|
87
93
|
expect(File.read("test.err")).not_to include \
|
88
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3figTab1.png is
|
94
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3figTab1.png is "\
|
95
|
+
"under a table but is not so labelled"
|
89
96
|
expect(File.read("test.err")).to include \
|
90
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig2.png is under
|
97
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig2.png is under "\
|
98
|
+
"a table but is not so labelled"
|
91
99
|
expect(File.read("test.err")).to include \
|
92
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3figTab2.png is
|
100
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3figTab2.png is "\
|
101
|
+
"labelled as under a table but is not"
|
93
102
|
expect(File.read("test.err")).not_to include \
|
94
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png is
|
103
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png is "\
|
104
|
+
"labelled as under a table but is not"
|
95
105
|
expect(File.read("test.err")).not_to include \
|
96
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3figA2.png is
|
106
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3figA2.png is "\
|
107
|
+
"under an annex but is not so labelled"
|
97
108
|
expect(File.read("test.err")).to include \
|
98
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig3.png is
|
109
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig3.png is "\
|
110
|
+
"under an annex but is not so labelled"
|
99
111
|
expect(File.read("test.err")).to include \
|
100
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3figA1.png is
|
112
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3figA1.png is "\
|
113
|
+
"labelled as under an annex but is not"
|
101
114
|
expect(File.read("test.err")).not_to include \
|
102
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png is
|
115
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png is "\
|
116
|
+
"labelled as under an annex but is not"
|
103
117
|
expect(File.read("test.err")).not_to include \
|
104
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig1b.png has a
|
118
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig1b.png has a "\
|
119
|
+
"subfigure letter but is not a subfigure"
|
105
120
|
expect(File.read("test.err")).to include \
|
106
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig4.png does not
|
121
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig4.png does not "\
|
122
|
+
"have a subfigure letter but is a subfigure"
|
107
123
|
expect(File.read("test.err")).to include \
|
108
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig1a.png has a
|
124
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig1a.png has a "\
|
125
|
+
"subfigure letter but is not a subfigure"
|
109
126
|
expect(File.read("test.err")).not_to include \
|
110
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png has a
|
127
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png has a "\
|
128
|
+
"subfigure letter but is not a subfigure"
|
111
129
|
expect(File.read("test.err")).to include \
|
112
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig5_f.png expected
|
130
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig5_f.png expected "\
|
131
|
+
"to have suffix _e"
|
113
132
|
expect(File.read("test.err")).not_to include \
|
114
|
-
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png expected
|
133
|
+
"image name spec/examples/rice_images/1000-1_ed2amd3fig1.png expected "\
|
134
|
+
"to have suffix _e"
|
115
135
|
end
|
116
136
|
|
117
137
|
context "Warns of missing scope" do
|
@@ -188,7 +208,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
188
208
|
[bibliography]
|
189
209
|
== Normative references
|
190
210
|
INPUT
|
191
|
-
expect(File.read("test.err"))
|
211
|
+
expect(File.read("test.err"))
|
212
|
+
.not_to include "Normative references missing"
|
192
213
|
end
|
193
214
|
|
194
215
|
it "Normative references not missing 2" do
|
@@ -202,7 +223,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
202
223
|
|
203
224
|
text
|
204
225
|
INPUT
|
205
|
-
expect(File.read("test.err"))
|
226
|
+
expect(File.read("test.err"))
|
227
|
+
.not_to include "Normative references missing"
|
206
228
|
end
|
207
229
|
end
|
208
230
|
|
@@ -262,7 +284,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
262
284
|
|
263
285
|
text
|
264
286
|
INPUT
|
265
|
-
expect(File.read("test.err"))
|
287
|
+
expect(File.read("test.err"))
|
288
|
+
.to include "pizza is not a recognised document type"
|
266
289
|
end
|
267
290
|
|
268
291
|
it "Warns of illegal script" do
|
@@ -305,7 +328,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
305
328
|
|
306
329
|
text
|
307
330
|
INPUT
|
308
|
-
expect(File.read("test.err"))
|
331
|
+
expect(File.read("test.err"))
|
332
|
+
.to include "pizza is not a recognised substage"
|
309
333
|
end
|
310
334
|
|
311
335
|
it "Warns of illegal iteration" do
|
@@ -320,7 +344,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
320
344
|
|
321
345
|
text
|
322
346
|
INPUT
|
323
|
-
expect(File.read("test.err"))
|
347
|
+
expect(File.read("test.err"))
|
348
|
+
.to include "pizza is not a recognised iteration"
|
324
349
|
end
|
325
350
|
|
326
351
|
it "Warns of illegal script" do
|
@@ -350,7 +375,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
350
375
|
|
351
376
|
The widget is required not to be larger than 15 cm.
|
352
377
|
INPUT
|
353
|
-
expect(File.read("test.err"))
|
378
|
+
expect(File.read("test.err"))
|
379
|
+
.to include "Technical Report clause may contain requirement"
|
354
380
|
end
|
355
381
|
|
356
382
|
it "warns that introduction may contain requirement" do
|
@@ -360,7 +386,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
360
386
|
|
361
387
|
The widget is required not to be larger than 15 cm.
|
362
388
|
INPUT
|
363
|
-
expect(File.read("test.err"))
|
389
|
+
expect(File.read("test.err"))
|
390
|
+
.to include "Introduction may contain requirement"
|
364
391
|
end
|
365
392
|
|
366
393
|
it "warns that foreword may contain recommendation" do
|
@@ -371,7 +398,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
371
398
|
|
372
399
|
== Clause
|
373
400
|
INPUT
|
374
|
-
expect(File.read("test.err"))
|
401
|
+
expect(File.read("test.err"))
|
402
|
+
.to include "Foreword may contain recommendation"
|
375
403
|
end
|
376
404
|
|
377
405
|
it "warns that foreword may contain permission" do
|
@@ -406,7 +434,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
406
434
|
It is required that there is a definition.
|
407
435
|
|
408
436
|
INPUT
|
409
|
-
expect(File.read("test.err"))
|
437
|
+
expect(File.read("test.err"))
|
438
|
+
.to include "Definition may contain requirement"
|
410
439
|
end
|
411
440
|
|
412
441
|
it "warns that term example may contain recommendation" do
|
@@ -420,7 +449,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
420
449
|
[example]
|
421
450
|
It is not recommended that widgets should be larger than 15 cm.
|
422
451
|
INPUT
|
423
|
-
expect(File.read("test.err"))
|
452
|
+
expect(File.read("test.err"))
|
453
|
+
.to include "Example may contain recommendation"
|
424
454
|
end
|
425
455
|
|
426
456
|
it "warns that note may contain recommendation" do
|
@@ -438,7 +468,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
438
468
|
|
439
469
|
footnote:[It is not recommended that widgets should be larger than 15 cm.]
|
440
470
|
INPUT
|
441
|
-
expect(File.read("test.err"))
|
471
|
+
expect(File.read("test.err"))
|
472
|
+
.to include "Footnote may contain recommendation"
|
442
473
|
end
|
443
474
|
|
444
475
|
it "warns that term source is not in expected format" do
|
@@ -448,7 +479,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
448
479
|
[.source]
|
449
480
|
I am a generic paragraph
|
450
481
|
INPUT
|
451
|
-
expect(File.read("test.err"))
|
482
|
+
expect(File.read("test.err"))
|
483
|
+
.to include "term reference not in expected format"
|
452
484
|
end
|
453
485
|
|
454
486
|
it "warns that figure does not have title" do
|
@@ -473,7 +505,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
473
505
|
<1> This is one callout
|
474
506
|
<2> This is another callout
|
475
507
|
INPUT
|
476
|
-
expect(File.read("test.err"))
|
508
|
+
expect(File.read("test.err"))
|
509
|
+
.to include "mismatch of callouts and annotations"
|
477
510
|
end
|
478
511
|
|
479
512
|
it "warns that term source is not a real reference" do
|
@@ -483,7 +516,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
483
516
|
[.source]
|
484
517
|
<<iso123>>
|
485
518
|
INPUT
|
486
|
-
expect(File.read("test.err"))
|
519
|
+
expect(File.read("test.err"))
|
520
|
+
.to include "iso123 does not have a corresponding anchor ID in the bibliography"
|
487
521
|
end
|
488
522
|
|
489
523
|
it "warns that undated reference has locality" do
|
@@ -496,8 +530,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
496
530
|
[bibliography]
|
497
531
|
== Normative References
|
498
532
|
* [[[iso123,ISO 123]]] _Standard_
|
499
|
-
|
500
|
-
|
533
|
+
INPUT
|
534
|
+
expect(File.read("test.err"))
|
535
|
+
.to include "undated reference ISO 123 should not contain specific elements"
|
501
536
|
end
|
502
537
|
|
503
538
|
it "do not warn that undated reference which is a bibliographic reference has locality" do
|
@@ -510,8 +545,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
510
545
|
[bibliography]
|
511
546
|
== Bibliography
|
512
547
|
* [[[iso123,1]]] _Standard_
|
513
|
-
|
514
|
-
|
548
|
+
INPUT
|
549
|
+
expect(File.read("test.err"))
|
550
|
+
.not_to include "undated reference [1] should not contain specific elements"
|
515
551
|
end
|
516
552
|
|
517
553
|
it "do not warn that undated IEV reference has locality" do
|
@@ -524,8 +560,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
524
560
|
[bibliography]
|
525
561
|
== Normative References
|
526
562
|
* [[[iev,IEV]]] _Standard_
|
527
|
-
|
528
|
-
|
563
|
+
INPUT
|
564
|
+
expect(File.read("test.err"))
|
565
|
+
.not_to include "undated reference IEV should not contain specific elements"
|
529
566
|
end
|
530
567
|
|
531
568
|
it "do not warn that in print has locality" do
|
@@ -538,8 +575,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
538
575
|
[bibliography]
|
539
576
|
== Normative References
|
540
577
|
* [[[iev,ISO 123:--]]] _Standard_
|
541
|
-
|
542
|
-
|
578
|
+
INPUT
|
579
|
+
expect(File.read("test.err")).not_to include "undated reference ISO 123 should not contain specific elements"
|
543
580
|
end
|
544
581
|
|
545
582
|
it "warns of Non-reference in bibliography" do
|
@@ -560,7 +597,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
560
597
|
== Normative References
|
561
598
|
* [[[XYZ,IESO 121]]] _Standard_
|
562
599
|
INPUT
|
563
|
-
expect(File.read("test.err"))
|
600
|
+
expect(File.read("test.err"))
|
601
|
+
.to include "non-ISO/IEC reference not expected as normative"
|
564
602
|
end
|
565
603
|
|
566
604
|
it "warns that Scope contains subclauses" do
|
@@ -571,7 +609,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
571
609
|
|
572
610
|
=== Scope subclause
|
573
611
|
INPUT
|
574
|
-
expect(File.read("test.err"))
|
612
|
+
expect(File.read("test.err"))
|
613
|
+
.to include "Scope contains subclauses: should be succinct"
|
575
614
|
end
|
576
615
|
|
577
616
|
it "warns that Table should have title" do
|
@@ -737,7 +776,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
737
776
|
|
738
777
|
== Symbols and Abbreviated Terms
|
739
778
|
INPUT
|
740
|
-
expect(File.read("test.err"))
|
779
|
+
expect(File.read("test.err"))
|
780
|
+
.to include "Only one Symbols and Abbreviated Terms section in the standard"
|
741
781
|
end
|
742
782
|
|
743
783
|
it "Style warning if Symbols and Abbreviated Terms contains extraneous matter" do
|
@@ -748,7 +788,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
748
788
|
|
749
789
|
Paragraph
|
750
790
|
INPUT
|
751
|
-
expect(File.read("test.err"))
|
791
|
+
expect(File.read("test.err"))
|
792
|
+
.to include "Symbols and Abbreviated Terms can only contain a definition list"
|
752
793
|
end
|
753
794
|
|
754
795
|
it "Warning if missing foreword" do
|
@@ -759,7 +800,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
759
800
|
|
760
801
|
Paragraph
|
761
802
|
INPUT
|
762
|
-
expect(File.read("test.err"))
|
803
|
+
expect(File.read("test.err"))
|
804
|
+
.to include "Initial section must be (content) Foreword"
|
763
805
|
|
764
806
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
765
807
|
= Document title
|
@@ -773,7 +815,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
773
815
|
|
774
816
|
Paragraph
|
775
817
|
INPUT
|
776
|
-
expect(File.read("test.err"))
|
818
|
+
expect(File.read("test.err"))
|
819
|
+
.not_to include "Initial section must be (content) Foreword"
|
777
820
|
end
|
778
821
|
|
779
822
|
it "Warning if do not start with scope or introduction" do
|
@@ -785,7 +828,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
785
828
|
|
786
829
|
Paragraph
|
787
830
|
INPUT
|
788
|
-
expect(File.read("test.err"))
|
831
|
+
expect(File.read("test.err"))
|
832
|
+
.to include "Prefatory material must be followed by (clause) Scope"
|
789
833
|
|
790
834
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
791
835
|
= Document title
|
@@ -801,7 +845,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
801
845
|
|
802
846
|
Paragraph
|
803
847
|
INPUT
|
804
|
-
expect(File.read("test.err"))
|
848
|
+
expect(File.read("test.err"))
|
849
|
+
.not_to include "Prefatory material must be followed by (clause) Scope"
|
805
850
|
end
|
806
851
|
|
807
852
|
it "Warning if introduction not followed by scope" do
|
@@ -817,7 +862,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
817
862
|
|
818
863
|
Paragraph
|
819
864
|
INPUT
|
820
|
-
expect(File.read("test.err"))
|
865
|
+
expect(File.read("test.err"))
|
866
|
+
.to include "Prefatory material must be followed by (clause) Scope"
|
821
867
|
|
822
868
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
823
869
|
= Document title
|
@@ -836,7 +882,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
836
882
|
|
837
883
|
Paragraph
|
838
884
|
INPUT
|
839
|
-
expect(File.read("test.err"))
|
885
|
+
expect(File.read("test.err"))
|
886
|
+
.not_to include "Prefatory material must be followed by (clause) Scope"
|
840
887
|
end
|
841
888
|
|
842
889
|
it "Warning if normative references not followed by terms and definitions" do
|
@@ -1280,7 +1327,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
1280
1327
|
expect(File.read("test.err")).to include "No English Title Part"
|
1281
1328
|
end
|
1282
1329
|
|
1283
|
-
|
1330
|
+
it "No warning if French main title and English main title" do
|
1284
1331
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
1285
1332
|
= Document title
|
1286
1333
|
Author
|
@@ -1307,7 +1354,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1307
1354
|
:no-isobib:
|
1308
1355
|
|
1309
1356
|
INPUT
|
1310
|
-
expect(File.read("test.err"))
|
1357
|
+
expect(File.read("test.err"))
|
1358
|
+
.to include "Subpart defined on non-IEC document"
|
1311
1359
|
end
|
1312
1360
|
|
1313
1361
|
it "No warning if joint IEC/non-IEC document with subpart" do
|
@@ -1322,7 +1370,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1322
1370
|
:no-isobib:
|
1323
1371
|
|
1324
1372
|
INPUT
|
1325
|
-
expect(File.read("test.err"))
|
1373
|
+
expect(File.read("test.err"))
|
1374
|
+
.not_to include "Subpart defined on non-IEC document"
|
1326
1375
|
end
|
1327
1376
|
|
1328
1377
|
it "Warning if main title contains document type" do
|
@@ -1348,7 +1397,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1348
1397
|
:no-isobib:
|
1349
1398
|
|
1350
1399
|
INPUT
|
1351
|
-
expect(File.read("test.err"))
|
1400
|
+
expect(File.read("test.err"))
|
1401
|
+
.to include "Title Intro may name document type"
|
1352
1402
|
end
|
1353
1403
|
|
1354
1404
|
it "Each first-level subclause must have a title" do
|
@@ -1358,7 +1408,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1358
1408
|
|
1359
1409
|
=== {blank}
|
1360
1410
|
INPUT
|
1361
|
-
expect(File.read("test.err"))
|
1411
|
+
expect(File.read("test.err"))
|
1412
|
+
.to include "each first-level subclause must have a title"
|
1362
1413
|
end
|
1363
1414
|
|
1364
1415
|
it "All subclauses must have a title, or none" do
|
@@ -1372,7 +1423,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1372
1423
|
|
1373
1424
|
==== Subsubclause
|
1374
1425
|
INPUT
|
1375
|
-
expect(File.read("test.err"))
|
1426
|
+
expect(File.read("test.err"))
|
1427
|
+
.to include "all subclauses must have a title, or none"
|
1376
1428
|
end
|
1377
1429
|
|
1378
1430
|
it "Warning if subclause is only child of its parent, or none" do
|
@@ -1434,7 +1486,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1434
1486
|
== Clause
|
1435
1487
|
See <<terms>>
|
1436
1488
|
INPUT
|
1437
|
-
expect(File.read("test.err"))
|
1489
|
+
expect(File.read("test.err"))
|
1490
|
+
.to include "'see terms' is pointing to a normative section"
|
1438
1491
|
end
|
1439
1492
|
|
1440
1493
|
it "Warning if 'see' reference points to normative reference" do
|
@@ -1447,7 +1500,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1447
1500
|
== Clause
|
1448
1501
|
See <<terms>>
|
1449
1502
|
INPUT
|
1450
|
-
expect(File.read("test.err"))
|
1503
|
+
expect(File.read("test.err"))
|
1504
|
+
.to include "is pointing to a normative reference"
|
1451
1505
|
end
|
1452
1506
|
|
1453
1507
|
it "Warning if term definition starts with article" do
|
@@ -1459,7 +1513,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1459
1513
|
|
1460
1514
|
The definition of a term is a part of the specialized vocabulary of a particular field
|
1461
1515
|
INPUT
|
1462
|
-
expect(File.read("test.err"))
|
1516
|
+
expect(File.read("test.err"))
|
1517
|
+
.to include "term definition starts with article"
|
1463
1518
|
end
|
1464
1519
|
|
1465
1520
|
it "Warning if term definition ends with period" do
|
@@ -1554,8 +1609,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
1554
1609
|
=== Term
|
1555
1610
|
|
1556
1611
|
The definition of a term (<<term>>) is a part of the specialized vocabulary of a particular field
|
1557
|
-
|
1558
|
-
|
1612
|
+
INPUT
|
1613
|
+
expect(File.read("test.err")).to include "term citation not preceded with italicised term"
|
1559
1614
|
end
|
1560
1615
|
|
1561
1616
|
it "Warn if an undated reference has no associated footnote" do
|