metanorma-standoc 1.9.3 → 1.9.4
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.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -13
- data/.hound.yml +3 -1
- data/.rubocop.yml +3 -5
- data/lib/asciidoctor/standoc/base.rb +3 -0
- data/lib/asciidoctor/standoc/cleanup_section.rb +13 -80
- data/lib/asciidoctor/standoc/cleanup_section_names.rb +75 -0
- data/lib/asciidoctor/standoc/front_contributor.rb +66 -41
- data/lib/asciidoctor/standoc/inline.rb +29 -21
- data/lib/asciidoctor/standoc/isodoc.rng +16 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- data/spec/asciidoctor/base_spec.rb +693 -553
- data/spec/asciidoctor/cleanup_spec.rb +856 -676
- data/spec/asciidoctor/inline_spec.rb +62 -14
- data/spec/asciidoctor/isobib_cache_spec.rb +4 -4
- data/spec/asciidoctor/refs_spec.rb +1527 -1532
- data/spec/asciidoctor/validate_spec.rb +296 -304
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +50 -50
- data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
- data/spec/vcr_cassettes/isobib_get_123_1.yml +27 -27
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +35 -35
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
- data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +61 -51
- metadata +3 -2
@@ -4,38 +4,38 @@ require "fileutils"
|
|
4
4
|
|
5
5
|
RSpec.describe Asciidoctor::Standoc do
|
6
6
|
it "generates error file" do
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
FileUtils.rm_f "spec/assets/xref_error.err"
|
8
|
+
Asciidoctor.convert_file "spec/assets/xref_error.adoc", { attributes: { "backend" => "standoc" }, safe: 0, header_footer: true, requires: ["metanorma-standoc"], failure_level: 4, mkdirs: true, to_file: nil }
|
9
|
+
expect(File.exist?("spec/assets/xref_error.err")).to be true
|
10
10
|
end
|
11
11
|
|
12
12
|
it "provides context for log" do
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
13
|
+
FileUtils.rm_f "test.xml"
|
14
|
+
FileUtils.rm_f "test.err"
|
15
|
+
begin
|
16
|
+
expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }.to raise_error(SystemExit)
|
17
|
+
= Document title
|
18
|
+
Author
|
19
|
+
:docfile: test.adoc
|
20
|
+
:nodoc:
|
21
|
+
|
22
|
+
[[abc]]
|
23
|
+
== Clause 1
|
24
|
+
|
25
|
+
[[abc]]
|
26
|
+
== Clause 2
|
27
|
+
INPUT
|
28
|
+
rescue SystemExit
|
29
|
+
end
|
30
|
+
expect(File.read("test.err")).to include "Anchor abc has already been used at line"
|
31
|
+
expect(File.read("test.err")).to include %(\t<clause id="abc" inline-header="false" obligation="normative">)
|
29
32
|
end
|
30
|
-
expect(File.read("test.err")).to include "Anchor abc has already been used at line"
|
31
|
-
expect(File.read("test.err")).to include %(\t<clause id="abc" inline-header="false" obligation="normative">)
|
32
|
-
end
|
33
33
|
|
34
34
|
it "warns about missing fields in asciibib" do
|
35
|
-
|
36
|
-
|
35
|
+
FileUtils.rm_f "test.err"
|
36
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
37
37
|
#{VALIDATING_BLANK_HDR}
|
38
|
-
|
38
|
+
|
39
39
|
[bibliography]
|
40
40
|
== Normative References
|
41
41
|
|
@@ -43,7 +43,7 @@ end
|
|
43
43
|
=== Standard
|
44
44
|
id:: iso123
|
45
45
|
type:: standard
|
46
|
-
contributor::
|
46
|
+
contributor::
|
47
47
|
role::: publisher
|
48
48
|
organization:::
|
49
49
|
name:::: ISO
|
@@ -62,17 +62,16 @@ end
|
|
62
62
|
person:::
|
63
63
|
name::::
|
64
64
|
completename::::: Jack
|
65
|
-
|
66
65
|
INPUT
|
67
|
-
|
68
|
-
|
66
|
+
errf = File.read("test.err")
|
67
|
+
expect(errf).to include "Reference iso123 is missing a document identifier (docid)"
|
69
68
|
end
|
70
69
|
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
it "warns about missing fields in asciibib" do
|
71
|
+
FileUtils.rm_f "test.err"
|
72
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
74
73
|
#{VALIDATING_BLANK_HDR}
|
75
|
-
|
74
|
+
|
76
75
|
[bibliography]
|
77
76
|
== Normative References
|
78
77
|
|
@@ -83,10 +82,10 @@ end
|
|
83
82
|
role::: publisher
|
84
83
|
organization:::
|
85
84
|
name:::: ISO
|
86
|
-
INPUT
|
87
|
-
|
88
|
-
|
89
|
-
|
85
|
+
INPUT
|
86
|
+
errf = File.read("test.err")
|
87
|
+
expect(errf).to include "The following reference is missing an anchor"
|
88
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
90
89
|
#{VALIDATING_BLANK_HDR}
|
91
90
|
|
92
91
|
[bibliography]
|
@@ -100,89 +99,85 @@ INPUT
|
|
100
99
|
role::: publisher
|
101
100
|
organization:::
|
102
101
|
name:::: ISO
|
103
|
-
INPUT
|
104
|
-
|
105
|
-
|
106
|
-
end
|
107
|
-
|
108
|
-
=begin
|
109
|
-
it "warns about malformed LaTeX" do
|
110
|
-
FileUtils.rm_f "test.err"
|
111
|
-
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
112
|
-
#{VALIDATING_BLANK_HDR}
|
113
|
-
|
114
|
-
== Clause 1
|
115
|
-
|
116
|
-
latexmath:[\\[ \\text{Odd integer = 51, \\quad \\text{Even integers } = 50 \\]]
|
117
|
-
|
118
|
-
=== Clause 1.1
|
119
|
-
|
120
|
-
Subclause
|
121
|
-
INPUT
|
122
|
-
expect(File.read("test.err")).to include "latexmlmath failed to process equation"
|
102
|
+
INPUT
|
103
|
+
errf = File.read("test.err")
|
104
|
+
expect(errf).not_to include "The following reference is missing an anchor"
|
123
105
|
end
|
124
|
-
=end
|
125
|
-
|
126
|
-
=begin
|
127
|
-
it "warns about reparsing LaTeX" do
|
128
|
-
FileUtils.rm_f "test.err"
|
129
|
-
expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }.to output(/Retrying/).to_stderr
|
130
|
-
#{VALIDATING_BLANK_HDR}
|
131
|
-
|
132
|
-
== Clause 1
|
133
106
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
107
|
+
# it "warns about malformed LaTeX" do
|
108
|
+
# FileUtils.rm_f "test.err"
|
109
|
+
# Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
110
|
+
# #{VALIDATING_BLANK_HDR}
|
111
|
+
#
|
112
|
+
# == Clause 1
|
113
|
+
#
|
114
|
+
# latexmath:[\\[ \\text{Odd integer = 51, \\quad \\text{Even integers } = 50 \\]]
|
115
|
+
#
|
116
|
+
# === Clause 1.1
|
117
|
+
#
|
118
|
+
# Subclause
|
119
|
+
# INPUT
|
120
|
+
# expect(File.read("test.err")).to include "latexmlmath failed to process equation"
|
121
|
+
# end
|
122
|
+
|
123
|
+
# it "warns about reparsing LaTeX" do
|
124
|
+
# FileUtils.rm_f "test.err"
|
125
|
+
# expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }.to output(/Retrying/).to_stderr
|
126
|
+
# #{VALIDATING_BLANK_HDR}
|
127
|
+
#
|
128
|
+
# == Clause 1
|
129
|
+
#
|
130
|
+
# [latexmath]
|
131
|
+
# ++++
|
132
|
+
# \\pmatrix{ \\hat{e}_{\\xi} \\cr \\hat{e}_{\\eta}
|
133
|
+
# \\cr \\hat{e}_{\\zeta} } = {\\bf T} \\pmatrix{ \\hat{e}_x \\cr \\hat{e}_y \\cr \\hat{e}_z },
|
134
|
+
# ++++
|
135
|
+
#
|
136
|
+
# === Clause 1.1
|
137
|
+
#
|
138
|
+
# Subclause
|
139
|
+
# INPUT
|
140
|
+
# end
|
146
141
|
|
147
142
|
it "warns about hanging paragraphs" do
|
148
|
-
|
149
|
-
|
150
|
-
|
143
|
+
FileUtils.rm_f "test.err"
|
144
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
145
|
+
#{VALIDATING_BLANK_HDR}
|
151
146
|
|
152
|
-
|
147
|
+
== Clause 1
|
153
148
|
|
154
|
-
|
149
|
+
Paragraph
|
155
150
|
|
156
|
-
|
151
|
+
=== Clause 1.1
|
157
152
|
|
158
|
-
|
159
|
-
|
160
|
-
|
153
|
+
Subclause
|
154
|
+
INPUT
|
155
|
+
expect(File.read("test.err")).to include "Hanging paragraph in clause"
|
161
156
|
end
|
162
157
|
|
163
158
|
it "warns that video is a skipped node" do
|
164
|
-
|
165
|
-
|
166
|
-
|
159
|
+
FileUtils.rm_f "test.err"
|
160
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
161
|
+
#{VALIDATING_BLANK_HDR}
|
167
162
|
|
168
|
-
|
169
|
-
|
170
|
-
|
163
|
+
video::video_file.mp4[]
|
164
|
+
INPUT
|
165
|
+
expect(File.read("test.err")).to include "converter missing for video node"
|
171
166
|
end
|
172
167
|
|
173
|
-
it "warns that figure does not have title" do
|
174
|
-
|
175
|
-
|
176
|
-
|
168
|
+
it "warns that figure does not have title" do
|
169
|
+
FileUtils.rm_f "test.err"
|
170
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
171
|
+
#{VALIDATING_BLANK_HDR}
|
177
172
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
end
|
173
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
174
|
+
INPUT
|
175
|
+
expect(File.read("test.err")).to include "Figure should have title"
|
176
|
+
end
|
182
177
|
|
183
|
-
it "warns that callouts do not match annotations" do
|
184
|
-
|
185
|
-
|
178
|
+
it "warns that callouts do not match annotations" do
|
179
|
+
FileUtils.rm_f "test.err"
|
180
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
186
181
|
#{VALIDATING_BLANK_HDR}
|
187
182
|
[source,ruby]
|
188
183
|
--
|
@@ -193,226 +188,223 @@ it "warns that callouts do not match annotations" do
|
|
193
188
|
--
|
194
189
|
<1> This is one callout
|
195
190
|
<2> This is another callout
|
196
|
-
|
197
|
-
|
198
|
-
end
|
191
|
+
INPUT
|
192
|
+
expect(File.read("test.err")).to include "mismatch of callouts and annotations"
|
193
|
+
end
|
199
194
|
|
200
|
-
it "warns that term source is not a real reference" do
|
201
|
-
|
202
|
-
|
203
|
-
|
195
|
+
it "warns that term source is not a real reference" do
|
196
|
+
FileUtils.rm_f "test.err"
|
197
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
198
|
+
#{VALIDATING_BLANK_HDR}
|
204
199
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
end
|
200
|
+
[.source]
|
201
|
+
<<iso123>>
|
202
|
+
INPUT
|
203
|
+
expect(File.read("test.err")).to include "iso123 does not have a corresponding anchor ID in the bibliography"
|
204
|
+
end
|
210
205
|
|
211
|
-
it "warns of Non-reference in bibliography" do
|
212
|
-
|
213
|
-
|
214
|
-
|
206
|
+
it "warns of Non-reference in bibliography" do
|
207
|
+
FileUtils.rm_f "test.err"
|
208
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
209
|
+
#{VALIDATING_BLANK_HDR}
|
215
210
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
end
|
211
|
+
== Normative References
|
212
|
+
* I am not a reference
|
213
|
+
INPUT
|
214
|
+
expect(File.read("test.err")).to include "no anchor on reference"
|
215
|
+
end
|
221
216
|
|
222
|
-
it "warns that Table should have title" do
|
223
|
-
|
224
|
-
|
225
|
-
|
217
|
+
it "warns that Table should have title" do
|
218
|
+
FileUtils.rm_f "test.err"
|
219
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
220
|
+
#{VALIDATING_BLANK_HDR}
|
226
221
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
end
|
222
|
+
|===
|
223
|
+
|a |b |c
|
224
|
+
|===
|
225
|
+
INPUT
|
226
|
+
expect(File.read("test.err")).to include "Table should have title"
|
227
|
+
end
|
233
228
|
|
234
|
-
it "validates document against ISO XML schema" do
|
235
|
-
|
236
|
-
|
237
|
-
|
229
|
+
it "validates document against ISO XML schema" do
|
230
|
+
FileUtils.rm_f "test.err"
|
231
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
232
|
+
#{VALIDATING_BLANK_HDR}
|
238
233
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
end
|
234
|
+
[align=mid-air]
|
235
|
+
Para
|
236
|
+
INPUT
|
237
|
+
expect(File.read("test.err")).to include 'value of attribute "align" is invalid; must be equal to'
|
238
|
+
end
|
244
239
|
|
245
|
-
it "Warning if terms mismatches IEV" do
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
[bibliography]
|
256
|
-
== Normative References
|
257
|
-
* [[[iev,IEV]]], _iev_
|
258
|
-
|
259
|
-
== Terms and definitions
|
260
|
-
=== Automation
|
261
|
-
|
262
|
-
[.source]
|
263
|
-
<<iev,clause="103-01-02">>
|
264
|
-
INPUT
|
265
|
-
expect(File.read("test.err")).to include 'Term "automation" does not match IEV 103-01-02 "functional"'
|
266
|
-
FileUtils.mv File.expand_path("~/.iev.pstore1"), File.expand_path("~/.iev/cache"), force: true
|
267
|
-
end
|
240
|
+
it "Warning if terms mismatches IEV" do
|
241
|
+
FileUtils.rm_f "test.err"
|
242
|
+
FileUtils.mv File.expand_path("~/.iev/cache"), File.expand_path("~/.iev.pstore1"), force: true
|
243
|
+
FileUtils.rm_f "test_iev/pstore"
|
244
|
+
mock_open_uri("103-01-02")
|
245
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
246
|
+
= Document title
|
247
|
+
Author
|
248
|
+
:docfile: test.adoc
|
268
249
|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
FileUtils.rm_f "test_iev/cache"
|
273
|
-
mock_open_uri('103-01-02')
|
274
|
-
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
275
|
-
= Document title
|
276
|
-
Author
|
277
|
-
:docfile: test.adoc
|
278
|
-
|
279
|
-
[bibliography]
|
280
|
-
== Normative References
|
281
|
-
* [[[iev,IEV]]], _iev_
|
282
|
-
|
283
|
-
== Terms and definitions
|
284
|
-
=== Functional
|
285
|
-
|
286
|
-
[.source]
|
287
|
-
<<iev,clause="103-01-02">>
|
288
|
-
INPUT
|
289
|
-
expect(File.read("test.err")).not_to include "does not match IEV 103-01-02"
|
290
|
-
FileUtils.mv File.expand_path("~/.iev.pstore1"), File.expand_path("~/.iev/cache"), force: true
|
291
|
-
end
|
250
|
+
[bibliography]
|
251
|
+
== Normative References
|
252
|
+
* [[[iev,IEV]]], _iev_
|
292
253
|
|
293
|
-
|
294
|
-
|
295
|
-
FileUtils.mv File.expand_path("~/.iev/cache"), File.expand_path("~/.iev.pstore1"), force: true
|
296
|
-
FileUtils.rm_f "test_iev/cache"
|
297
|
-
mock_open_uri('103-01-02')
|
298
|
-
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
299
|
-
= Document title
|
300
|
-
Author
|
301
|
-
:docfile: test.adoc
|
302
|
-
:nodoc:
|
303
|
-
:language: fr
|
304
|
-
|
305
|
-
[bibliography]
|
306
|
-
== Normative References
|
307
|
-
* [[[iev,IEV]]], _iev_
|
308
|
-
|
309
|
-
== Terms and definitions
|
310
|
-
=== Fonctionnelle, f
|
311
|
-
|
312
|
-
[.source]
|
313
|
-
<<iev,clause="103-01-02">>
|
314
|
-
INPUT
|
315
|
-
expect(File.read("test.err")).not_to include "does not match IEV 103-01-02"
|
316
|
-
FileUtils.mv File.expand_path("~/.iev.pstore1"), File.expand_path("~/.iev/cache"), force: true
|
317
|
-
end
|
254
|
+
== Terms and definitions
|
255
|
+
=== Automation
|
318
256
|
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
</standard-document>
|
325
|
-
INPUT
|
326
|
-
end
|
327
|
-
=end
|
328
|
-
|
329
|
-
it "warns and aborts if id used twice" do
|
330
|
-
FileUtils.rm_f "test.xml"
|
331
|
-
FileUtils.rm_f "test.err"
|
332
|
-
begin
|
333
|
-
expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }.to raise_error(SystemExit)
|
334
|
-
= Document title
|
335
|
-
Author
|
336
|
-
:docfile: test.adoc
|
337
|
-
:nodoc:
|
338
|
-
|
339
|
-
[[abc]]
|
340
|
-
== Clause 1
|
341
|
-
|
342
|
-
[[abc]]
|
343
|
-
== Clause 2
|
344
|
-
INPUT
|
345
|
-
rescue SystemExit
|
257
|
+
[.source]
|
258
|
+
<<iev,clause="103-01-02">>
|
259
|
+
INPUT
|
260
|
+
expect(File.read("test.err")).to include 'Term "automation" does not match IEV 103-01-02 "functional"'
|
261
|
+
FileUtils.mv File.expand_path("~/.iev.pstore1"), File.expand_path("~/.iev/cache"), force: true
|
346
262
|
end
|
347
|
-
expect(File.read("test.err")).to include "Anchor abc has already been used at line"
|
348
|
-
expect(File.exist?("test.xml")).to be false
|
349
|
-
end
|
350
263
|
|
351
|
-
it "
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
264
|
+
it "No warning if English term matches IEV" do
|
265
|
+
FileUtils.rm_f "test.err"
|
266
|
+
FileUtils.mv File.expand_path("~/.iev/cache"), File.expand_path("~/.iev.pstore1"), force: true
|
267
|
+
FileUtils.rm_f "test_iev/cache"
|
268
|
+
mock_open_uri("103-01-02")
|
269
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
270
|
+
= Document title
|
271
|
+
Author
|
272
|
+
:docfile: test.adoc
|
273
|
+
|
274
|
+
[bibliography]
|
275
|
+
== Normative References
|
276
|
+
* [[[iev,IEV]]], _iev_
|
277
|
+
|
278
|
+
== Terms and definitions
|
279
|
+
=== Functional
|
280
|
+
|
281
|
+
[.source]
|
282
|
+
<<iev,clause="103-01-02">>
|
283
|
+
INPUT
|
284
|
+
expect(File.read("test.err")).not_to include "does not match IEV 103-01-02"
|
285
|
+
FileUtils.mv File.expand_path("~/.iev.pstore1"), File.expand_path("~/.iev/cache"), force: true
|
366
286
|
end
|
367
|
-
expect(File.read("test.err")).to include "Numeric reference in normative references"
|
368
|
-
expect(File.exist?("test.xml")).to be false
|
369
|
-
end
|
370
287
|
|
371
|
-
it "
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
288
|
+
it "No warning if French term matches IEV" do
|
289
|
+
FileUtils.rm_f "test.err"
|
290
|
+
FileUtils.mv File.expand_path("~/.iev/cache"), File.expand_path("~/.iev.pstore1"), force: true
|
291
|
+
FileUtils.rm_f "test_iev/cache"
|
292
|
+
mock_open_uri("103-01-02")
|
293
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
294
|
+
= Document title
|
295
|
+
Author
|
296
|
+
:docfile: test.adoc
|
297
|
+
:nodoc:
|
298
|
+
:language: fr
|
299
|
+
|
300
|
+
[bibliography]
|
301
|
+
== Normative References
|
302
|
+
* [[[iev,IEV]]], _iev_
|
303
|
+
|
304
|
+
== Terms and definitions
|
305
|
+
=== Fonctionnelle, f
|
381
306
|
|
382
|
-
|
307
|
+
[.source]
|
308
|
+
<<iev,clause="103-01-02">>
|
309
|
+
INPUT
|
310
|
+
expect(File.read("test.err")).not_to include "does not match IEV 103-01-02"
|
311
|
+
FileUtils.mv File.expand_path("~/.iev.pstore1"), File.expand_path("~/.iev/cache"), force: true
|
312
|
+
end
|
383
313
|
|
384
|
-
|
314
|
+
# it "No warning if attributes on formatted strong or stem extraneous to Metanomra XML" do
|
315
|
+
# expect { Asciidoctor::Standoc::Converter.new(nil,nil).validate(Nokogiri::XML(<<~INPUT)) }.not_to output('found attribute "close", but no attributes allowed here').to_stderr
|
316
|
+
# <standard-document>
|
317
|
+
# <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfenced open="(" close=")"><mi>r</mi></mfenced></stem>
|
318
|
+
# </standard-document>
|
319
|
+
# INPUT
|
320
|
+
# end
|
385
321
|
|
386
|
-
|
387
|
-
|
322
|
+
it "warns and aborts if id used twice" do
|
323
|
+
FileUtils.rm_f "test.xml"
|
324
|
+
FileUtils.rm_f "test.err"
|
325
|
+
begin
|
326
|
+
expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }.to raise_error(SystemExit)
|
327
|
+
= Document title
|
328
|
+
Author
|
329
|
+
:docfile: test.adoc
|
330
|
+
:nodoc:
|
331
|
+
|
332
|
+
[[abc]]
|
333
|
+
== Clause 1
|
334
|
+
|
335
|
+
[[abc]]
|
336
|
+
== Clause 2
|
337
|
+
INPUT
|
338
|
+
rescue SystemExit
|
339
|
+
end
|
340
|
+
expect(File.read("test.err")).to include "Anchor abc has already been used at line"
|
341
|
+
expect(File.exist?("test.xml")).to be false
|
342
|
+
end
|
388
343
|
|
389
|
-
|
390
|
-
|
344
|
+
it "warns and aborts if numeric normative reference" do
|
345
|
+
FileUtils.rm_f "test.xml"
|
346
|
+
FileUtils.rm_f "test.err"
|
347
|
+
begin
|
348
|
+
expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }.to raise_error(SystemExit)
|
349
|
+
= Document title
|
350
|
+
Author
|
351
|
+
:docfile: test.adoc
|
352
|
+
:nodoc:
|
353
|
+
|
354
|
+
[bibliography]
|
355
|
+
== Normative references
|
356
|
+
* [[[A,1]]]
|
357
|
+
INPUT
|
358
|
+
rescue SystemExit
|
359
|
+
end
|
360
|
+
expect(File.read("test.err")).to include "Numeric reference in normative references"
|
361
|
+
expect(File.exist?("test.xml")).to be false
|
362
|
+
end
|
391
363
|
|
392
|
-
it "
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|c |d
|
408
|
-
|===
|
409
|
-
|
410
|
-
* A
|
411
|
-
* B
|
412
|
-
* C
|
413
|
-
--
|
414
|
-
INPUT
|
415
|
-
expect(File.read("test.err")).to include 'Could not resolve footnoteblock:[id1]'
|
416
|
-
end
|
364
|
+
it "err file succesfully created for docfile path" do
|
365
|
+
FileUtils.rm_rf "test"
|
366
|
+
FileUtils.mkdir_p "test"
|
367
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
368
|
+
= Document title
|
369
|
+
Author
|
370
|
+
:docfile: test#{File::ALT_SEPARATOR || File::SEPARATOR}test.adoc
|
371
|
+
:nodoc:
|
372
|
+
|
373
|
+
== Clause 1
|
374
|
+
|
375
|
+
Paragraph
|
376
|
+
|
377
|
+
=== Clause 1.1
|
417
378
|
|
379
|
+
Subclause
|
380
|
+
INPUT
|
381
|
+
|
382
|
+
expect(File.read("test/test.err")).to include "Hanging paragraph in clause"
|
383
|
+
end
|
384
|
+
|
385
|
+
it "Warning if no block for footnoteblock" do
|
386
|
+
FileUtils.rm_f "test.err"
|
387
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
388
|
+
= Document title
|
389
|
+
Author
|
390
|
+
:docfile: test.adoc
|
391
|
+
|
392
|
+
footnoteblock:[id1]
|
393
|
+
|
394
|
+
[[id2]]
|
395
|
+
[NOTE]
|
396
|
+
--
|
397
|
+
|===
|
398
|
+
|a |b
|
399
|
+
|
400
|
+
|c |d
|
401
|
+
|===
|
402
|
+
|
403
|
+
* A
|
404
|
+
* B
|
405
|
+
* C
|
406
|
+
--
|
407
|
+
INPUT
|
408
|
+
expect(File.read("test.err")).to include "Could not resolve footnoteblock:[id1]"
|
409
|
+
end
|
418
410
|
end
|