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.
@@ -4,38 +4,38 @@ require "fileutils"
4
4
 
5
5
  RSpec.describe Asciidoctor::Standoc do
6
6
  it "generates error file" do
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
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
- 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
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
- FileUtils.rm_f "test.err"
36
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
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
- errf = File.read("test.err")
68
- expect(errf).to include "Reference iso123 is missing a document identifier (docid)"
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
- it "warns about missing fields in asciibib" do
72
- FileUtils.rm_f "test.err"
73
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
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
- errf = File.read("test.err")
88
- expect(errf).to include "The following reference is missing an anchor"
89
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
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
- errf = File.read("test.err")
105
- expect(errf).not_to include "The following reference is missing an anchor"
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
- [latexmath]
135
- ++++
136
- \\pmatrix{ \\hat{e}_{\\xi} \\cr \\hat{e}_{\\eta}
137
- \\cr \\hat{e}_{\\zeta} } = {\\bf T} \\pmatrix{ \\hat{e}_x \\cr \\hat{e}_y \\cr \\hat{e}_z },
138
- ++++
139
-
140
- === Clause 1.1
141
-
142
- Subclause
143
- INPUT
144
- end
145
- =end
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
- FileUtils.rm_f "test.err"
149
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
150
- #{VALIDATING_BLANK_HDR}
143
+ FileUtils.rm_f "test.err"
144
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
145
+ #{VALIDATING_BLANK_HDR}
151
146
 
152
- == Clause 1
147
+ == Clause 1
153
148
 
154
- Paragraph
149
+ Paragraph
155
150
 
156
- === Clause 1.1
151
+ === Clause 1.1
157
152
 
158
- Subclause
159
- INPUT
160
- expect(File.read("test.err")).to include "Hanging paragraph in clause"
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
- FileUtils.rm_f "test.err"
165
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
166
- #{VALIDATING_BLANK_HDR}
159
+ FileUtils.rm_f "test.err"
160
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
161
+ #{VALIDATING_BLANK_HDR}
167
162
 
168
- video::video_file.mp4[]
169
- INPUT
170
- expect(File.read("test.err")).to include "converter missing for video node"
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
- FileUtils.rm_f "test.err"
175
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
176
- #{VALIDATING_BLANK_HDR}
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
- image::spec/examples/rice_images/rice_image1.png[]
179
- INPUT
180
- expect(File.read("test.err")).to include "Figure should have title"
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
- FileUtils.rm_f "test.err"
185
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
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
- INPUT
197
- expect(File.read("test.err")).to include "mismatch of callouts and annotations"
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
- FileUtils.rm_f "test.err"
202
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
203
- #{VALIDATING_BLANK_HDR}
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
- [.source]
206
- <<iso123>>
207
- INPUT
208
- expect(File.read("test.err")).to include "iso123 does not have a corresponding anchor ID in the bibliography"
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
- FileUtils.rm_f "test.err"
213
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
214
- #{VALIDATING_BLANK_HDR}
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
- == Normative References
217
- * I am not a reference
218
- INPUT
219
- expect(File.read("test.err")).to include "no anchor on reference"
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
- FileUtils.rm_f "test.err"
224
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
225
- #{VALIDATING_BLANK_HDR}
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
- |a |b |c
229
- |===
230
- INPUT
231
- expect(File.read("test.err")).to include "Table should have title"
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
- FileUtils.rm_f "test.err"
236
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
237
- #{VALIDATING_BLANK_HDR}
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
- [align=mid-air]
240
- Para
241
- INPUT
242
- expect(File.read("test.err")).to include 'value of attribute "align" is invalid; must be equal to'
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
- FileUtils.rm_f "test.err"
247
- FileUtils.mv File.expand_path("~/.iev/cache"), File.expand_path("~/.iev.pstore1"), force: true
248
- FileUtils.rm_f "test_iev/pstore"
249
- mock_open_uri('103-01-02')
250
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
251
- = Document title
252
- Author
253
- :docfile: test.adoc
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
- it "No warning if English term matches IEV" do
270
- FileUtils.rm_f "test.err"
271
- FileUtils.mv File.expand_path("~/.iev/cache"), File.expand_path("~/.iev.pstore1"), force: true
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
- it "No warning if French term matches IEV" do
294
- FileUtils.rm_f "test.err"
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
- =begin
320
- it "No warning if attributes on formatted strong or stem extraneous to Metanomra XML" do
321
- expect { Asciidoctor::Standoc::Converter.new(nil,nil).validate(Nokogiri::XML(<<~INPUT)) }.not_to output('found attribute "close", but no attributes allowed here').to_stderr
322
- <standard-document>
323
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfenced open="(" close=")"><mi>r</mi></mfenced></stem>
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 "warns and aborts if numeric normative reference" do
352
- FileUtils.rm_f "test.xml"
353
- FileUtils.rm_f "test.err"
354
- begin
355
- expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }.to raise_error(SystemExit)
356
- = Document title
357
- Author
358
- :docfile: test.adoc
359
- :nodoc:
360
-
361
- [bibliography]
362
- == Normative references
363
- * [[[A,1]]]
364
- INPUT
365
- rescue SystemExit
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 "err file succesfully created for docfile path" do
372
- FileUtils.rm_rf "test"
373
- FileUtils.mkdir_p "test"
374
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
375
- = Document title
376
- Author
377
- :docfile: test#{File::ALT_SEPARATOR || File::SEPARATOR}test.adoc
378
- :nodoc:
379
-
380
- == Clause 1
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
- Paragraph
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
- === Clause 1.1
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
- Subclause
387
- INPUT
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
- expect(File.read("test/test.err")).to include "Hanging paragraph in clause"
390
- end
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 "Warning if no block for footnoteblock" do
393
- FileUtils.rm_f "test.err"
394
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
395
- = Document title
396
- Author
397
- :docfile: test.adoc
398
-
399
- footnoteblock:[id1]
400
-
401
- [[id2]]
402
- [NOTE]
403
- --
404
- |===
405
- |a |b
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