asciidoctor-iso 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +2 -0
- data/.travis.yml +5 -0
- data/Gemfile.lock +12 -10
- data/README.adoc +113 -16
- data/bin/rspec +18 -0
- data/lib/asciidoctor/iso/base.rb +30 -28
- data/lib/asciidoctor/iso/blocks.rb +33 -33
- data/lib/asciidoctor/iso/cleanup.rb +79 -33
- data/lib/asciidoctor/iso/cleanup_block.rb +71 -18
- data/lib/asciidoctor/iso/cleanup_ref.rb +35 -30
- data/lib/asciidoctor/iso/converter.rb +0 -3
- data/lib/asciidoctor/iso/front.rb +29 -16
- data/lib/asciidoctor/iso/html/isodoc.css +34 -0
- data/lib/asciidoctor/iso/html/wordstyle.css +138 -6
- data/lib/asciidoctor/iso/inline.rb +10 -22
- data/lib/asciidoctor/iso/isodoc.rng +66 -16
- data/lib/asciidoctor/iso/isostandard.rng +129 -15
- data/lib/asciidoctor/iso/lists.rb +49 -42
- data/lib/asciidoctor/iso/macros.rb +12 -8
- data/lib/asciidoctor/iso/section.rb +53 -37
- data/lib/asciidoctor/iso/table.rb +9 -1
- data/lib/asciidoctor/iso/utils.rb +18 -13
- data/lib/asciidoctor/iso/validate.rb +100 -24
- data/lib/asciidoctor/iso/validate_requirements.rb +106 -0
- data/lib/asciidoctor/iso/validate_section.rb +85 -65
- data/lib/asciidoctor/iso/validate_style.rb +68 -115
- data/lib/asciidoctor/iso/version.rb +1 -1
- data/spec/asciidoctor-iso/base_spec.rb +193 -0
- data/spec/asciidoctor-iso/blocks_spec.rb +426 -0
- data/spec/asciidoctor-iso/cleanup_spec.rb +687 -0
- data/spec/asciidoctor-iso/inline_spec.rb +159 -0
- data/spec/asciidoctor-iso/lists_spec.rb +189 -0
- data/spec/asciidoctor-iso/macros_spec.rb +20 -0
- data/spec/asciidoctor-iso/refs_spec.rb +194 -0
- data/spec/asciidoctor-iso/section_spec.rb +301 -0
- data/spec/asciidoctor-iso/table_spec.rb +307 -0
- data/spec/asciidoctor-iso/validate_spec.rb +749 -0
- data/spec/examples/english.yaml +69 -0
- data/spec/examples/rice.adoc +30 -28
- data/spec/examples/rice.doc +3035 -2865
- data/spec/examples/rice.html +281 -234
- data/spec/examples/rice.preview.html +30 -20
- data/spec/examples/rice.xml +250 -282
- data/spec/spec_helper.rb +87 -0
- metadata +17 -2
@@ -0,0 +1,687 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Asciidoctor::ISO do
|
4
|
+
it "removes empty text elements" do
|
5
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
6
|
+
#{ASCIIDOC_BLANK_HDR}
|
7
|
+
== {blank}
|
8
|
+
INPUT
|
9
|
+
#{BLANK_HDR}
|
10
|
+
<sections>
|
11
|
+
<clause id="_" inline-header="false" obligation="normative">
|
12
|
+
|
13
|
+
</clause>
|
14
|
+
</sections>
|
15
|
+
</iso-standard>
|
16
|
+
OUTPUT
|
17
|
+
end
|
18
|
+
|
19
|
+
it "processes stem-only terms as admitted" do
|
20
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
21
|
+
#{ASCIIDOC_BLANK_HDR}
|
22
|
+
== Terms and Definitions
|
23
|
+
|
24
|
+
=== stem:[t_90]
|
25
|
+
|
26
|
+
stem:[t_91]
|
27
|
+
|
28
|
+
Time
|
29
|
+
INPUT
|
30
|
+
#{BLANK_HDR}
|
31
|
+
<sections>
|
32
|
+
<terms id="_" obligation="normative">
|
33
|
+
<title>Terms and Definitions</title>
|
34
|
+
<term id="_"><preferred><stem type="AsciiMath">t_90</stem></preferred><admitted><stem type="AsciiMath">t_91</stem></admitted>
|
35
|
+
<definition><p id="_">Time</p></definition></term>
|
36
|
+
</terms>
|
37
|
+
</sections>
|
38
|
+
</iso-standard>
|
39
|
+
OUTPUT
|
40
|
+
end
|
41
|
+
|
42
|
+
it "moves term domains out of the term definition paragraph" do
|
43
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
44
|
+
#{ASCIIDOC_BLANK_HDR}
|
45
|
+
== Terms and Definitions
|
46
|
+
|
47
|
+
=== Tempus
|
48
|
+
|
49
|
+
domain:[relativity] Time
|
50
|
+
INPUT
|
51
|
+
#{BLANK_HDR}
|
52
|
+
<sections>
|
53
|
+
<terms id="_" obligation="normative">
|
54
|
+
<title>Terms and Definitions</title>
|
55
|
+
<term id="_">
|
56
|
+
<preferred>Tempus</preferred>
|
57
|
+
<domain>relativity</domain><definition><p id="_"> Time</p></definition>
|
58
|
+
</term>
|
59
|
+
</terms>
|
60
|
+
</sections>
|
61
|
+
</iso-standard>
|
62
|
+
OUTPUT
|
63
|
+
end
|
64
|
+
|
65
|
+
it "permits multiple blocks in term definition paragraph" do
|
66
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
67
|
+
= Document title
|
68
|
+
Author
|
69
|
+
:docfile: test.adoc
|
70
|
+
:nodoc:
|
71
|
+
:novalid:
|
72
|
+
:stem:
|
73
|
+
|
74
|
+
== Terms and Definitions
|
75
|
+
|
76
|
+
=== stem:[t_90]
|
77
|
+
|
78
|
+
[stem]
|
79
|
+
++++
|
80
|
+
t_A
|
81
|
+
++++
|
82
|
+
|
83
|
+
This paragraph is extraneous
|
84
|
+
INPUT
|
85
|
+
#{BLANK_HDR}
|
86
|
+
<sections>
|
87
|
+
<terms id="_" obligation="normative">
|
88
|
+
<title>Terms and Definitions</title>
|
89
|
+
<term id="_"><preferred><stem type="AsciiMath">t_90</stem></preferred><definition><formula id="_">
|
90
|
+
<stem type="AsciiMath">t_A</stem>
|
91
|
+
</formula><p id="_">This paragraph is extraneous</p></definition>
|
92
|
+
</term>
|
93
|
+
</terms>
|
94
|
+
</sections>
|
95
|
+
</iso-standard>
|
96
|
+
OUTPUT
|
97
|
+
end
|
98
|
+
|
99
|
+
it "strips any initial boilerplate from terms and definitions" do
|
100
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
101
|
+
#{ASCIIDOC_BLANK_HDR}
|
102
|
+
== Terms and Definitions
|
103
|
+
|
104
|
+
I am boilerplate
|
105
|
+
|
106
|
+
* So am I
|
107
|
+
|
108
|
+
=== Time
|
109
|
+
|
110
|
+
This paragraph is extraneous
|
111
|
+
INPUT
|
112
|
+
#{BLANK_HDR}
|
113
|
+
<sections>
|
114
|
+
<terms id="_" obligation="normative"><title>Terms and Definitions</title>
|
115
|
+
|
116
|
+
<term id="_">
|
117
|
+
<preferred>Time</preferred>
|
118
|
+
<definition><p id="_">This paragraph is extraneous</p></definition>
|
119
|
+
</term></terms>
|
120
|
+
</sections>
|
121
|
+
</iso-standard>
|
122
|
+
OUTPUT
|
123
|
+
end
|
124
|
+
|
125
|
+
it "moves notes inside preceding blocks, if they are not at clause end" do
|
126
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
127
|
+
#{ASCIIDOC_BLANK_HDR}
|
128
|
+
[source,ruby]
|
129
|
+
[1...x].each do |y|
|
130
|
+
puts y
|
131
|
+
end
|
132
|
+
|
133
|
+
NOTE: That loop does not do much
|
134
|
+
|
135
|
+
Indeed.
|
136
|
+
INPUT
|
137
|
+
#{BLANK_HDR}
|
138
|
+
<sections><sourcecode id="_">[1...x].each do |y|
|
139
|
+
puts y
|
140
|
+
end<note id="_">
|
141
|
+
<p id="_">That loop does not do much</p>
|
142
|
+
</note></sourcecode>
|
143
|
+
|
144
|
+
<p id="_">Indeed.</p></sections>
|
145
|
+
</iso-standard>
|
146
|
+
OUTPUT
|
147
|
+
end
|
148
|
+
|
149
|
+
it "does not move notes inside preceding blocks, if they are at clause end" do
|
150
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
151
|
+
#{ASCIIDOC_BLANK_HDR}
|
152
|
+
[source,ruby]
|
153
|
+
[1...x].each do |y|
|
154
|
+
puts y
|
155
|
+
end
|
156
|
+
|
157
|
+
NOTE: That loop does not do much
|
158
|
+
INPUT
|
159
|
+
#{BLANK_HDR}
|
160
|
+
<sections><sourcecode id="_">[1...x].each do |y|
|
161
|
+
puts y
|
162
|
+
end</sourcecode>
|
163
|
+
<note id="_">
|
164
|
+
<p id="_">That loop does not do much</p>
|
165
|
+
</note></sections>
|
166
|
+
</iso-standard>
|
167
|
+
OUTPUT
|
168
|
+
end
|
169
|
+
|
170
|
+
it "converts xrefs to references into erefs" do
|
171
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
172
|
+
#{ASCIIDOC_BLANK_HDR}
|
173
|
+
<<iso216>>
|
174
|
+
|
175
|
+
[bibliography]
|
176
|
+
== Normative References
|
177
|
+
* [[[iso216,ISO 216:2001]]], _Reference_
|
178
|
+
INPUT
|
179
|
+
#{BLANK_HDR}
|
180
|
+
<foreword obligation="informative">
|
181
|
+
<title>Foreword</title>
|
182
|
+
<p id="_">
|
183
|
+
<eref type="inline" bibitemid="iso216" citeas="ISO 216: 2001"/>
|
184
|
+
</p>
|
185
|
+
</foreword><sections>
|
186
|
+
</sections><references id="_" obligation="informative">
|
187
|
+
<title>Normative References</title>
|
188
|
+
<bibitem id="iso216" type="standard">
|
189
|
+
<title format="text/plain">Reference</title>
|
190
|
+
<docidentifier>ISO 216</docidentifier>
|
191
|
+
<date type="published">2001</date>
|
192
|
+
<contributor>
|
193
|
+
<role type="publisher"/>
|
194
|
+
<organization>
|
195
|
+
<name>ISO</name>
|
196
|
+
</organization>
|
197
|
+
</contributor>
|
198
|
+
</bibitem>
|
199
|
+
</references>
|
200
|
+
</iso-standard>
|
201
|
+
OUTPUT
|
202
|
+
end
|
203
|
+
|
204
|
+
it "extracts localities from erefs" do
|
205
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
206
|
+
#{ASCIIDOC_BLANK_HDR}
|
207
|
+
<<iso216,whole,clause 3,example 9-11:the reference>>
|
208
|
+
|
209
|
+
[bibliography]
|
210
|
+
== Normative References
|
211
|
+
* [[[iso216,ISO 216]]], _Reference_
|
212
|
+
INPUT
|
213
|
+
#{BLANK_HDR}
|
214
|
+
<foreword obligation="informative">
|
215
|
+
<title>Foreword</title>
|
216
|
+
<p id="_">
|
217
|
+
<eref type="inline" bibitemid="iso216" citeas="ISO 216"><locality type="whole"/><locality type="clause"><referenceFrom>3</referenceFrom></locality><locality type="example"><referenceFrom>9</referenceFrom><referenceTo>11</referenceTo></locality>the reference</eref>
|
218
|
+
</p>
|
219
|
+
</foreword><sections>
|
220
|
+
</sections><references id="_" obligation="informative">
|
221
|
+
<title>Normative References</title>
|
222
|
+
<bibitem id="iso216" type="standard">
|
223
|
+
<title format="text/plain">Reference</title>
|
224
|
+
<docidentifier>ISO 216</docidentifier>
|
225
|
+
<contributor>
|
226
|
+
<role type="publisher"/>
|
227
|
+
<organization>
|
228
|
+
<name>ISO</name>
|
229
|
+
</organization>
|
230
|
+
</contributor>
|
231
|
+
</bibitem>
|
232
|
+
</references>
|
233
|
+
</iso-standard>
|
234
|
+
OUTPUT
|
235
|
+
end
|
236
|
+
|
237
|
+
|
238
|
+
it "strips type from xrefs" do
|
239
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
240
|
+
#{ASCIIDOC_BLANK_HDR}
|
241
|
+
<<iso216>>
|
242
|
+
|
243
|
+
[bibliography]
|
244
|
+
== Clause
|
245
|
+
* [[[iso216,ISO 216]]], _Reference_
|
246
|
+
INPUT
|
247
|
+
#{BLANK_HDR}
|
248
|
+
<foreword obligation="informative">
|
249
|
+
<title>Foreword</title>
|
250
|
+
<p id="_">
|
251
|
+
<eref type="inline" bibitemid="iso216" citeas=""/>
|
252
|
+
</p>
|
253
|
+
</foreword><sections>
|
254
|
+
<clause id="_" inline-header="false" obligation="normative">
|
255
|
+
<title>Clause</title>
|
256
|
+
<ul id="_">
|
257
|
+
<li>
|
258
|
+
<ref id="iso216">[ISO 216]</ref><p id="_">, <em>Reference</em></p>
|
259
|
+
</li>
|
260
|
+
</ul>
|
261
|
+
</clause></sections>
|
262
|
+
</iso-standard>
|
263
|
+
OUTPUT
|
264
|
+
end
|
265
|
+
|
266
|
+
it "processes localities in term sources" do
|
267
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
268
|
+
#{ASCIIDOC_BLANK_HDR}
|
269
|
+
== Terms and Definitions
|
270
|
+
|
271
|
+
=== Term1
|
272
|
+
|
273
|
+
[.source]
|
274
|
+
<<ISO2191,section 1>>
|
275
|
+
INPUT
|
276
|
+
#{BLANK_HDR}
|
277
|
+
<sections>
|
278
|
+
<terms id="_" obligation="normative">
|
279
|
+
<title>Terms and Definitions</title>
|
280
|
+
<term id="_">
|
281
|
+
<preferred>Term1</preferred>
|
282
|
+
<termsource status="identical">
|
283
|
+
<origin bibitemid="ISO2191" type="inline" citeas=""><locality type="section"><referenceFrom>1</referenceFrom></locality></origin>
|
284
|
+
</termsource>
|
285
|
+
</term>
|
286
|
+
</terms>
|
287
|
+
</sections>
|
288
|
+
</iso-standard>
|
289
|
+
OUTPUT
|
290
|
+
end
|
291
|
+
|
292
|
+
it "removes extraneous material from Normative References" do
|
293
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
294
|
+
#{ASCIIDOC_BLANK_HDR}
|
295
|
+
[bibliography]
|
296
|
+
== Normative References
|
297
|
+
|
298
|
+
This is extraneous information
|
299
|
+
|
300
|
+
* [[[iso216,ISO 216]]], _Reference_
|
301
|
+
INPUT
|
302
|
+
#{BLANK_HDR}
|
303
|
+
<sections>
|
304
|
+
|
305
|
+
</sections><references id="_" obligation="informative"><title>Normative References</title>
|
306
|
+
<bibitem id="iso216" type="standard">
|
307
|
+
<title format="text/plain">Reference</title>
|
308
|
+
<docidentifier>ISO 216</docidentifier>
|
309
|
+
<contributor>
|
310
|
+
<role type="publisher"/>
|
311
|
+
<organization>
|
312
|
+
<name>ISO</name>
|
313
|
+
</organization>
|
314
|
+
</contributor>
|
315
|
+
</bibitem></references>
|
316
|
+
</iso-standard>
|
317
|
+
OUTPUT
|
318
|
+
end
|
319
|
+
|
320
|
+
it "inserts IDs into paragraphs" do
|
321
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
322
|
+
#{ASCIIDOC_BLANK_HDR}
|
323
|
+
Paragraph
|
324
|
+
INPUT
|
325
|
+
#{BLANK_HDR}
|
326
|
+
<sections>
|
327
|
+
<p id="_">Paragraph</p>
|
328
|
+
</sections>
|
329
|
+
</iso-standard>
|
330
|
+
OUTPUT
|
331
|
+
end
|
332
|
+
|
333
|
+
it "inserts IDs into notes" do
|
334
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
335
|
+
#{ASCIIDOC_BLANK_HDR}
|
336
|
+
[example]
|
337
|
+
====
|
338
|
+
NOTE: This note has no ID
|
339
|
+
====
|
340
|
+
INPUT
|
341
|
+
#{BLANK_HDR}
|
342
|
+
<sections>
|
343
|
+
<example id="_">
|
344
|
+
<note id="_">
|
345
|
+
<p id="_">This note has no ID</p>
|
346
|
+
</note>
|
347
|
+
</example>
|
348
|
+
</sections>
|
349
|
+
</iso-standard>
|
350
|
+
OUTPUT
|
351
|
+
end
|
352
|
+
|
353
|
+
it "moves table key inside table" do
|
354
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
355
|
+
#{ASCIIDOC_BLANK_HDR}
|
356
|
+
|===
|
357
|
+
|a |b |c
|
358
|
+
|===
|
359
|
+
|
360
|
+
Key
|
361
|
+
|
362
|
+
a:: b
|
363
|
+
INPUT
|
364
|
+
#{BLANK_HDR}
|
365
|
+
<sections><table id="_">
|
366
|
+
<tbody>
|
367
|
+
<tr>
|
368
|
+
<td align="left">a</td>
|
369
|
+
<td align="left">b</td>
|
370
|
+
<td align="left">c</td>
|
371
|
+
</tr>
|
372
|
+
</tbody>
|
373
|
+
<dl id="_">
|
374
|
+
<dt>a</dt>
|
375
|
+
<dd>
|
376
|
+
<p id="_">b</p>
|
377
|
+
</dd>
|
378
|
+
</dl></table>
|
379
|
+
|
380
|
+
</sections>
|
381
|
+
</iso-standard>
|
382
|
+
OUTPUT
|
383
|
+
end
|
384
|
+
|
385
|
+
it "processes headerrows attribute for table without header rows" do
|
386
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
387
|
+
#{ASCIIDOC_BLANK_HDR}
|
388
|
+
[headerrows=3]
|
389
|
+
|===
|
390
|
+
|a |b |c
|
391
|
+
|a |b |c
|
392
|
+
|a |b |c
|
393
|
+
|a |b |c
|
394
|
+
|===
|
395
|
+
INPUT
|
396
|
+
#{BLANK_HDR}
|
397
|
+
<sections>
|
398
|
+
<table id="_"><thead><tr>
|
399
|
+
<td align="left">a</td>
|
400
|
+
<td align="left">b</td>
|
401
|
+
<td align="left">c</td>
|
402
|
+
</tr><tr>
|
403
|
+
<td align="left">a</td>
|
404
|
+
<td align="left">b</td>
|
405
|
+
<td align="left">c</td>
|
406
|
+
</tr><tr>
|
407
|
+
<td align="left">a</td>
|
408
|
+
<td align="left">b</td>
|
409
|
+
<td align="left">c</td>
|
410
|
+
</tr></thead>
|
411
|
+
<tbody>
|
412
|
+
<tr>
|
413
|
+
<td align="left">a</td>
|
414
|
+
<td align="left">b</td>
|
415
|
+
<td align="left">c</td>
|
416
|
+
</tr>
|
417
|
+
</tbody>
|
418
|
+
</table>
|
419
|
+
</sections>
|
420
|
+
</iso-standard>
|
421
|
+
OUTPUT
|
422
|
+
end
|
423
|
+
|
424
|
+
it "processes headerrows attribute for table with header rows" do
|
425
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
426
|
+
#{ASCIIDOC_BLANK_HDR}
|
427
|
+
[headerrows=3]
|
428
|
+
|===
|
429
|
+
|a |b |c
|
430
|
+
|
431
|
+
|a |b |c
|
432
|
+
|a |b |c
|
433
|
+
|a |b |c
|
434
|
+
|===
|
435
|
+
INPUT
|
436
|
+
#{BLANK_HDR}
|
437
|
+
<sections>
|
438
|
+
<table id="_">
|
439
|
+
<thead>
|
440
|
+
<tr>
|
441
|
+
<th align="left">a</th>
|
442
|
+
<th align="left">b</th>
|
443
|
+
<th align="left">c</th>
|
444
|
+
</tr>
|
445
|
+
<tr>
|
446
|
+
<td align="left">a</td>
|
447
|
+
<td align="left">b</td>
|
448
|
+
<td align="left">c</td>
|
449
|
+
</tr><tr>
|
450
|
+
<td align="left">a</td>
|
451
|
+
<td align="left">b</td>
|
452
|
+
<td align="left">c</td>
|
453
|
+
</tr></thead>
|
454
|
+
<tbody>
|
455
|
+
|
456
|
+
|
457
|
+
<tr>
|
458
|
+
<td align="left">a</td>
|
459
|
+
<td align="left">b</td>
|
460
|
+
<td align="left">c</td>
|
461
|
+
</tr>
|
462
|
+
</tbody>
|
463
|
+
</table>
|
464
|
+
</sections>
|
465
|
+
</iso-standard>
|
466
|
+
OUTPUT
|
467
|
+
end
|
468
|
+
|
469
|
+
it "moves table notes inside table" do
|
470
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
471
|
+
#{ASCIIDOC_BLANK_HDR}
|
472
|
+
|===
|
473
|
+
|a |b |c
|
474
|
+
|===
|
475
|
+
|
476
|
+
NOTE: Note 1
|
477
|
+
|
478
|
+
NOTE: Note 2
|
479
|
+
INPUT
|
480
|
+
#{BLANK_HDR}
|
481
|
+
<sections><table id="_">
|
482
|
+
<tbody>
|
483
|
+
<tr>
|
484
|
+
<td align="left">a</td>
|
485
|
+
<td align="left">b</td>
|
486
|
+
<td align="left">c</td>
|
487
|
+
</tr>
|
488
|
+
</tbody>
|
489
|
+
<note id="_">
|
490
|
+
<p id="_">Note 1</p>
|
491
|
+
</note><note id="_">
|
492
|
+
<p id="_">Note 2</p>
|
493
|
+
</note></table>
|
494
|
+
|
495
|
+
</sections>
|
496
|
+
OUTPUT
|
497
|
+
end
|
498
|
+
|
499
|
+
it "moves formula key inside formula" do
|
500
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
501
|
+
#{ASCIIDOC_BLANK_HDR}
|
502
|
+
[stem]
|
503
|
+
++++
|
504
|
+
Formula
|
505
|
+
++++
|
506
|
+
|
507
|
+
where
|
508
|
+
|
509
|
+
a:: b
|
510
|
+
INPUT
|
511
|
+
#{BLANK_HDR}
|
512
|
+
<sections><formula id="_">
|
513
|
+
<stem type="AsciiMath">Formula</stem>
|
514
|
+
<dl id="_">
|
515
|
+
<dt>a</dt>
|
516
|
+
<dd>
|
517
|
+
<p id="_">b</p>
|
518
|
+
</dd>
|
519
|
+
</dl></formula>
|
520
|
+
|
521
|
+
</sections>
|
522
|
+
</iso-standard>
|
523
|
+
OUTPUT
|
524
|
+
end
|
525
|
+
|
526
|
+
it "moves footnotes inside figures" do
|
527
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
528
|
+
#{ASCIIDOC_BLANK_HDR}
|
529
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
530
|
+
|
531
|
+
footnote:[This is a footnote to a figure]
|
532
|
+
|
533
|
+
footnote:[This is another footnote to a figure]
|
534
|
+
INPUT
|
535
|
+
#{BLANK_HDR}
|
536
|
+
<sections><figure id="_">
|
537
|
+
<image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG"/>
|
538
|
+
<fn reference="a">
|
539
|
+
<p id="_">This is a footnote to a figure</p>
|
540
|
+
</fn><fn reference="b">
|
541
|
+
<p id="_">This is another footnote to a figure</p>
|
542
|
+
</fn></figure>
|
543
|
+
|
544
|
+
</sections>
|
545
|
+
|
546
|
+
</iso-standard>
|
547
|
+
OUTPUT
|
548
|
+
end
|
549
|
+
|
550
|
+
it "moves figure key inside figure" do
|
551
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
552
|
+
#{ASCIIDOC_BLANK_HDR}
|
553
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
554
|
+
|
555
|
+
Key
|
556
|
+
|
557
|
+
a:: b
|
558
|
+
INPUT
|
559
|
+
#{BLANK_HDR}
|
560
|
+
<sections><figure id="_">
|
561
|
+
<image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG"/>
|
562
|
+
<dl id="_">
|
563
|
+
<dt>a</dt>
|
564
|
+
<dd>
|
565
|
+
<p id="_">b</p>
|
566
|
+
</dd>
|
567
|
+
</dl></figure>
|
568
|
+
|
569
|
+
</sections>
|
570
|
+
|
571
|
+
</iso-standard>
|
572
|
+
OUTPUT
|
573
|
+
end
|
574
|
+
|
575
|
+
it "processes subfigures" do
|
576
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
577
|
+
#{ASCIIDOC_BLANK_HDR}
|
578
|
+
[[figureC-2]]
|
579
|
+
.Stages of gelatinization
|
580
|
+
====
|
581
|
+
.Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)
|
582
|
+
image::spec/examples/rice_images/rice_image3_1.png[]
|
583
|
+
|
584
|
+
.Intermediate stages: Some fully gelatinized kernels are visible
|
585
|
+
image::spec/examples/rice_images/rice_image3_2.png[]
|
586
|
+
|
587
|
+
.Final stages: All kernels are fully gelatinized
|
588
|
+
image::spec/examples/rice_images/rice_image3_3.png[]
|
589
|
+
====
|
590
|
+
INPUT
|
591
|
+
#{BLANK_HDR}
|
592
|
+
<sections>
|
593
|
+
<figure id="figureC-2"><figure id="_">
|
594
|
+
<name>Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)</name>
|
595
|
+
<image src="spec/examples/rice_images/rice_image3_1.png" id="_" imagetype="PNG"/>
|
596
|
+
</figure>
|
597
|
+
<figure id="_">
|
598
|
+
<name>Intermediate stages: Some fully gelatinized kernels are visible</name>
|
599
|
+
<image src="spec/examples/rice_images/rice_image3_2.png" id="_" imagetype="PNG"/>
|
600
|
+
</figure>
|
601
|
+
<figure id="_">
|
602
|
+
<name>Final stages: All kernels are fully gelatinized</name>
|
603
|
+
<image src="spec/examples/rice_images/rice_image3_3.png" id="_" imagetype="PNG"/>
|
604
|
+
</figure></figure>
|
605
|
+
</sections>
|
606
|
+
</iso-standard>
|
607
|
+
OUTPUT
|
608
|
+
end
|
609
|
+
|
610
|
+
it "numbers bibliographic notes and footnotes sequentially" do
|
611
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
612
|
+
#{ASCIIDOC_BLANK_HDR}
|
613
|
+
footnote:[Footnote]
|
614
|
+
|
615
|
+
[bibliography]
|
616
|
+
== Normative References
|
617
|
+
|
618
|
+
* [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_
|
619
|
+
|
620
|
+
== Clause
|
621
|
+
footnote:[Footnote2]
|
622
|
+
INPUT
|
623
|
+
#{BLANK_HDR}
|
624
|
+
<foreword obligation="informative">
|
625
|
+
<title>Foreword</title>
|
626
|
+
<p id="_"><fn reference="1">
|
627
|
+
<p id="_">Footnote</p>
|
628
|
+
</fn>
|
629
|
+
</p>
|
630
|
+
</foreword><sections>
|
631
|
+
|
632
|
+
<clause id="_" inline-header="false" obligation="normative">
|
633
|
+
<title>Clause</title>
|
634
|
+
<p id="_"><fn reference="3">
|
635
|
+
<p id="_">Footnote2</p>
|
636
|
+
</fn>
|
637
|
+
</p>
|
638
|
+
</clause></sections><references id="_" obligation="informative">
|
639
|
+
<title>Normative References</title>
|
640
|
+
<bibitem id="iso123" type="standard">
|
641
|
+
<title format="text/plain">Standard</title>
|
642
|
+
<docidentifier>ISO 123</docidentifier>
|
643
|
+
<date type="published">--</date>
|
644
|
+
<contributor>
|
645
|
+
<role type="publisher"/>
|
646
|
+
<organization>
|
647
|
+
<name>ISO</name>
|
648
|
+
</organization>
|
649
|
+
</contributor>
|
650
|
+
<note format="text/plain" reference="2">ISO DATE: The standard is in press</note>
|
651
|
+
</bibitem>
|
652
|
+
</references>
|
653
|
+
</iso-standard>
|
654
|
+
OUTPUT
|
655
|
+
end
|
656
|
+
|
657
|
+
it "defaults section obligations" do
|
658
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
659
|
+
#{ASCIIDOC_BLANK_HDR}
|
660
|
+
|
661
|
+
== Clause
|
662
|
+
Text
|
663
|
+
|
664
|
+
[appendix]
|
665
|
+
== Clause
|
666
|
+
|
667
|
+
Text
|
668
|
+
INPUT
|
669
|
+
#{BLANK_HDR}
|
670
|
+
<sections><clause id="_" inline-header="false" obligation="normative">
|
671
|
+
<title>Clause</title>
|
672
|
+
<p id="_">Text</p>
|
673
|
+
</clause>
|
674
|
+
</sections><annex id="_" inline-header="false" obligation="normative">
|
675
|
+
<title>Clause</title>
|
676
|
+
<p id="_">Text</p>
|
677
|
+
</annex>
|
678
|
+
</iso-standard>
|
679
|
+
OUTPUT
|
680
|
+
end
|
681
|
+
|
682
|
+
|
683
|
+
|
684
|
+
|
685
|
+
|
686
|
+
|
687
|
+
end
|