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