metanorma-iec 0.0.1
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 +7 -0
- data/Gemfile +7 -0
- data/bin/rspec +18 -0
- data/lib/asciidoctor/iec/biblio.rng +949 -0
- data/lib/asciidoctor/iec/converter.rb +68 -0
- data/lib/asciidoctor/iec/iec_intro_en.xml +15 -0
- data/lib/asciidoctor/iec/iec_intro_fr.xml +15 -0
- data/lib/asciidoctor/iec/isodoc.rng +1132 -0
- data/lib/asciidoctor/iec/isostandard.rng +789 -0
- data/lib/asciidoctor/iec/reqt.rng +162 -0
- data/lib/isodoc/iec/base_convert.rb +69 -0
- data/lib/isodoc/iec/html/header.html +160 -0
- data/lib/isodoc/iec/html/html_iec_intro.html +34 -0
- data/lib/isodoc/iec/html/html_iec_titlepage.html +62 -0
- data/lib/isodoc/iec/html/htmlstyle.scss +840 -0
- data/lib/isodoc/iec/html/isodoc.scss +785 -0
- data/lib/isodoc/iec/html/scripts.html +176 -0
- data/lib/isodoc/iec/html/word_iec_intro.html +72 -0
- data/lib/isodoc/iec/html/word_iec_titlepage.html +92 -0
- data/lib/isodoc/iec/html/wordstyle.scss +1849 -0
- data/lib/isodoc/iec/html_convert.rb +33 -0
- data/lib/isodoc/iec/i18n-en.yaml +3 -0
- data/lib/isodoc/iec/i18n-fr.yaml +3 -0
- data/lib/isodoc/iec/i18n-zh-Hans.yaml +3 -0
- data/lib/isodoc/iec/metadata.rb +20 -0
- data/lib/isodoc/iec/word_convert.rb +165 -0
- data/lib/metanorma-iec.rb +12 -0
- data/lib/metanorma/iec.rb +8 -0
- data/lib/metanorma/iec/processor.rb +40 -0
- data/lib/metanorma/iec/version.rb +6 -0
- data/metanorma-iec.gemspec +47 -0
- data/spec/asciidoctor-iec/base_spec.rb +609 -0
- data/spec/asciidoctor-iec/blocks_spec.rb +467 -0
- data/spec/asciidoctor-iec/cleanup_spec.rb +766 -0
- data/spec/asciidoctor-iec/inline_spec.rb +162 -0
- data/spec/asciidoctor-iec/lists_spec.rb +190 -0
- data/spec/asciidoctor-iec/macros_spec.rb +21 -0
- data/spec/asciidoctor-iec/refs_spec.rb +268 -0
- data/spec/asciidoctor-iec/section_spec.rb +341 -0
- data/spec/asciidoctor-iec/table_spec.rb +307 -0
- data/spec/asciidoctor-iec/validate_spec.rb +132 -0
- data/spec/examples/rice.adoc +723 -0
- data/spec/examples/rice.doc +19162 -0
- data/spec/examples/rice.html +1787 -0
- data/spec/examples/rice.xml +1951 -0
- data/spec/isodoc/i18n_spec.rb +642 -0
- data/spec/isodoc/inline_spec.rb +265 -0
- data/spec/isodoc/iso_spec.rb +319 -0
- data/spec/isodoc/metadata_spec.rb +153 -0
- data/spec/isodoc/postproc_spec.rb +569 -0
- data/spec/isodoc/section_spec.rb +686 -0
- data/spec/isodoc/terms_spec.rb +206 -0
- data/spec/isodoc/xref_spec.rb +1323 -0
- data/spec/metanorma/processor_spec.rb +88 -0
- data/spec/spec_helper.rb +253 -0
- metadata +325 -0
@@ -0,0 +1,766 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Asciidoctor::Iec do
|
4
|
+
it "removes empty text elements" do
|
5
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, 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: :iec, 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="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>91</mn></msub></math></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: :iec, 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: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
67
|
+
= Document title
|
68
|
+
Author
|
69
|
+
:docfile: test.adoc
|
70
|
+
:nodoc:
|
71
|
+
:novalid:
|
72
|
+
:stem:
|
73
|
+
:no-isobib:
|
74
|
+
|
75
|
+
== Terms and Definitions
|
76
|
+
|
77
|
+
=== stem:[t_90]
|
78
|
+
|
79
|
+
[stem]
|
80
|
+
++++
|
81
|
+
t_A
|
82
|
+
++++
|
83
|
+
|
84
|
+
This paragraph is extraneous
|
85
|
+
INPUT
|
86
|
+
#{BLANK_HDR}
|
87
|
+
<sections>
|
88
|
+
<terms id="_" obligation="normative">
|
89
|
+
<title>Terms and definitions</title>
|
90
|
+
<term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><definition><formula id="_">
|
91
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mi>A</mi></msub></math></stem>
|
92
|
+
</formula><p id="_">This paragraph is extraneous</p></definition>
|
93
|
+
</term>
|
94
|
+
</terms>
|
95
|
+
</sections>
|
96
|
+
</iso-standard>
|
97
|
+
OUTPUT
|
98
|
+
end
|
99
|
+
|
100
|
+
it "strips any initial boilerplate from terms and definitions" do
|
101
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
102
|
+
#{ASCIIDOC_BLANK_HDR}
|
103
|
+
== Terms and Definitions
|
104
|
+
|
105
|
+
I am boilerplate
|
106
|
+
|
107
|
+
* So am I
|
108
|
+
|
109
|
+
=== Time
|
110
|
+
|
111
|
+
This paragraph is extraneous
|
112
|
+
INPUT
|
113
|
+
#{BLANK_HDR}
|
114
|
+
<sections>
|
115
|
+
<terms id="_" obligation="normative"><title>Terms and definitions</title>
|
116
|
+
|
117
|
+
<term id="_">
|
118
|
+
<preferred>Time</preferred>
|
119
|
+
<definition><p id="_">This paragraph is extraneous</p></definition>
|
120
|
+
</term></terms>
|
121
|
+
</sections>
|
122
|
+
</iso-standard>
|
123
|
+
OUTPUT
|
124
|
+
end
|
125
|
+
|
126
|
+
it "moves notes inside preceding blocks, if they are not at clause end, and the blocks are not delimited" do
|
127
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
128
|
+
#{ASCIIDOC_BLANK_HDR}
|
129
|
+
[stem]
|
130
|
+
++++
|
131
|
+
r = 1 %
|
132
|
+
r = 1 %
|
133
|
+
++++
|
134
|
+
|
135
|
+
NOTE: That formula does not do much
|
136
|
+
|
137
|
+
Indeed.
|
138
|
+
INPUT
|
139
|
+
#{BLANK_HDR}
|
140
|
+
<sections><formula id="_">
|
141
|
+
<stem type="AsciiMath">r = 1 %
|
142
|
+
r = 1 %</stem>
|
143
|
+
<note id="_">
|
144
|
+
<p id="_">That formula does not do much</p>
|
145
|
+
</note></formula>
|
146
|
+
|
147
|
+
<p id="_">Indeed.</p></sections>
|
148
|
+
</iso-standard>
|
149
|
+
OUTPUT
|
150
|
+
end
|
151
|
+
|
152
|
+
it "does not move notes inside preceding blocks, if they are at clause end" do
|
153
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
154
|
+
#{ASCIIDOC_BLANK_HDR}
|
155
|
+
[source,ruby]
|
156
|
+
[1...x].each do |y|
|
157
|
+
puts y
|
158
|
+
end
|
159
|
+
|
160
|
+
NOTE: That loop does not do much
|
161
|
+
INPUT
|
162
|
+
#{BLANK_HDR}
|
163
|
+
<sections><sourcecode lang="ruby" id="_">[1...x].each do |y|
|
164
|
+
puts y
|
165
|
+
end</sourcecode>
|
166
|
+
<note id="_">
|
167
|
+
<p id="_">That loop does not do much</p>
|
168
|
+
</note></sections>
|
169
|
+
</iso-standard>
|
170
|
+
OUTPUT
|
171
|
+
end
|
172
|
+
|
173
|
+
it "converts xrefs to references into erefs" do
|
174
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
175
|
+
#{ASCIIDOC_BLANK_HDR}
|
176
|
+
<<iso216>>
|
177
|
+
|
178
|
+
[bibliography]
|
179
|
+
== Normative References
|
180
|
+
* [[[iso216,ISO 216:2001]]], _Reference_
|
181
|
+
INPUT
|
182
|
+
#{BLANK_HDR}
|
183
|
+
<preface><foreword obligation="informative">
|
184
|
+
<title>Foreword</title>
|
185
|
+
<p id="_">
|
186
|
+
<eref type="inline" bibitemid="iso216" citeas="ISO 216:2001"/>
|
187
|
+
</p>
|
188
|
+
</foreword></preface><sections>
|
189
|
+
</sections><bibliography><references id="_" obligation="informative">
|
190
|
+
<title>Normative References</title>
|
191
|
+
<bibitem id="iso216" type="standard">
|
192
|
+
<title format="text/plain">Reference</title>
|
193
|
+
<docidentifier>ISO 216:2001</docidentifier>
|
194
|
+
<date type="published">
|
195
|
+
<on>2001</on>
|
196
|
+
</date>
|
197
|
+
<contributor>
|
198
|
+
<role type="publisher"/>
|
199
|
+
<organization>
|
200
|
+
<name>International Organization for Standardization</name>
|
201
|
+
<abbreviation>ISO</abbreviation>
|
202
|
+
</organization>
|
203
|
+
</contributor>
|
204
|
+
</bibitem>
|
205
|
+
</references>
|
206
|
+
</bibliography
|
207
|
+
</iso-standard>
|
208
|
+
OUTPUT
|
209
|
+
end
|
210
|
+
|
211
|
+
it "extracts localities from erefs" do
|
212
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
213
|
+
#{ASCIIDOC_BLANK_HDR}
|
214
|
+
<<iso216,whole,clause=3,example=9-11,locality:prelude=33,locality:entirety:the reference>>
|
215
|
+
|
216
|
+
[bibliography]
|
217
|
+
== Normative References
|
218
|
+
* [[[iso216,ISO 216]]], _Reference_
|
219
|
+
INPUT
|
220
|
+
#{BLANK_HDR}
|
221
|
+
<preface><foreword obligation="informative">
|
222
|
+
<title>Foreword</title>
|
223
|
+
<p id="_">
|
224
|
+
<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><locality type="locality:prelude"><referenceFrom>33</referenceFrom></locality><locality type="locality:entirety"/>the reference</eref>
|
225
|
+
</p>
|
226
|
+
</foreword></preface><sections>
|
227
|
+
</sections><bibliography><references id="_" obligation="informative">
|
228
|
+
<title>Normative References</title>
|
229
|
+
<bibitem id="iso216" type="standard">
|
230
|
+
<title format="text/plain">Reference</title>
|
231
|
+
<docidentifier>ISO 216</docidentifier>
|
232
|
+
<contributor>
|
233
|
+
<role type="publisher"/>
|
234
|
+
<organization>
|
235
|
+
<name>International Organization for Standardization</name>
|
236
|
+
<abbreviation>ISO</abbreviation>
|
237
|
+
</organization>
|
238
|
+
</contributor>
|
239
|
+
</bibitem>
|
240
|
+
</references>
|
241
|
+
</bibliography>
|
242
|
+
</iso-standard>
|
243
|
+
OUTPUT
|
244
|
+
end
|
245
|
+
|
246
|
+
|
247
|
+
it "strips type from xrefs" do
|
248
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
249
|
+
#{ASCIIDOC_BLANK_HDR}
|
250
|
+
<<iso216>>
|
251
|
+
|
252
|
+
[bibliography]
|
253
|
+
== Clause
|
254
|
+
* [[[iso216,ISO 216]]], _Reference_
|
255
|
+
INPUT
|
256
|
+
#{BLANK_HDR}
|
257
|
+
<preface>
|
258
|
+
<foreword obligation="informative">
|
259
|
+
<title>Foreword</title>
|
260
|
+
<p id="_">
|
261
|
+
<eref type="inline" bibitemid="iso216" citeas="ISO 216"/>
|
262
|
+
</p>
|
263
|
+
</foreword></preface><sections>
|
264
|
+
</sections><bibliography><references id="_" obligation="informative">
|
265
|
+
<title>Bibliography</title>
|
266
|
+
<bibitem id="iso216" type="standard">
|
267
|
+
<title format="text/plain">Reference</title>
|
268
|
+
<docidentifier>ISO 216</docidentifier>
|
269
|
+
<contributor>
|
270
|
+
<role type="publisher"/>
|
271
|
+
<organization>
|
272
|
+
<name>International Organization for Standardization</name>
|
273
|
+
<abbreviation>ISO</abbreviation>
|
274
|
+
</organization>
|
275
|
+
</contributor>
|
276
|
+
</bibitem>
|
277
|
+
</references></bibliography>
|
278
|
+
</iso-standard>
|
279
|
+
OUTPUT
|
280
|
+
end
|
281
|
+
|
282
|
+
it "processes localities in term sources" do
|
283
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
284
|
+
#{ASCIIDOC_BLANK_HDR}
|
285
|
+
== Terms and Definitions
|
286
|
+
|
287
|
+
=== Term1
|
288
|
+
|
289
|
+
[.source]
|
290
|
+
<<ISO2191,section=1>>
|
291
|
+
INPUT
|
292
|
+
#{BLANK_HDR}
|
293
|
+
<sections>
|
294
|
+
<terms id="_" obligation="normative">
|
295
|
+
<title>Terms and definitions</title>
|
296
|
+
<term id="_">
|
297
|
+
<preferred>Term1</preferred>
|
298
|
+
<termsource status="identical">
|
299
|
+
<origin bibitemid="ISO2191" type="inline" citeas=""><locality type="section"><referenceFrom>1</referenceFrom></locality></origin>
|
300
|
+
</termsource>
|
301
|
+
</term>
|
302
|
+
</terms>
|
303
|
+
</sections>
|
304
|
+
</iso-standard>
|
305
|
+
OUTPUT
|
306
|
+
end
|
307
|
+
|
308
|
+
it "removes extraneous material from Normative References" do
|
309
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
310
|
+
#{ASCIIDOC_BLANK_HDR}
|
311
|
+
[bibliography]
|
312
|
+
== Normative References
|
313
|
+
|
314
|
+
This is extraneous information
|
315
|
+
|
316
|
+
* [[[iso216,ISO 216]]], _Reference_
|
317
|
+
INPUT
|
318
|
+
#{BLANK_HDR}
|
319
|
+
<sections></sections>
|
320
|
+
<bibliography><references id="_" obligation="informative"><title>Normative References</title>
|
321
|
+
<bibitem id="iso216" type="standard">
|
322
|
+
<title format="text/plain">Reference</title>
|
323
|
+
<docidentifier>ISO 216</docidentifier>
|
324
|
+
<contributor>
|
325
|
+
<role type="publisher"/>
|
326
|
+
<organization>
|
327
|
+
<name>International Organization for Standardization</name>
|
328
|
+
<abbreviation>ISO</abbreviation>
|
329
|
+
</organization>
|
330
|
+
</contributor>
|
331
|
+
</bibitem>
|
332
|
+
</references>
|
333
|
+
</bibliography>
|
334
|
+
</iso-standard>
|
335
|
+
OUTPUT
|
336
|
+
end
|
337
|
+
|
338
|
+
it "inserts IDs into paragraphs" do
|
339
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
340
|
+
#{ASCIIDOC_BLANK_HDR}
|
341
|
+
Paragraph
|
342
|
+
INPUT
|
343
|
+
#{BLANK_HDR}
|
344
|
+
<sections>
|
345
|
+
<p id="_">Paragraph</p>
|
346
|
+
</sections>
|
347
|
+
</iso-standard>
|
348
|
+
OUTPUT
|
349
|
+
end
|
350
|
+
|
351
|
+
it "inserts IDs into notes" do
|
352
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
353
|
+
#{ASCIIDOC_BLANK_HDR}
|
354
|
+
[example]
|
355
|
+
====
|
356
|
+
NOTE: This note has no ID
|
357
|
+
====
|
358
|
+
INPUT
|
359
|
+
#{BLANK_HDR}
|
360
|
+
<sections>
|
361
|
+
<example id="_">
|
362
|
+
<note id="_">
|
363
|
+
<p id="_">This note has no ID</p>
|
364
|
+
</note>
|
365
|
+
</example>
|
366
|
+
</sections>
|
367
|
+
</iso-standard>
|
368
|
+
OUTPUT
|
369
|
+
end
|
370
|
+
|
371
|
+
it "moves table key inside table" do
|
372
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
373
|
+
#{ASCIIDOC_BLANK_HDR}
|
374
|
+
|===
|
375
|
+
|a |b |c
|
376
|
+
|===
|
377
|
+
|
378
|
+
Key
|
379
|
+
|
380
|
+
a:: b
|
381
|
+
INPUT
|
382
|
+
#{BLANK_HDR}
|
383
|
+
<sections><table id="_">
|
384
|
+
<tbody>
|
385
|
+
<tr>
|
386
|
+
<td align="left">a</td>
|
387
|
+
<td align="left">b</td>
|
388
|
+
<td align="left">c</td>
|
389
|
+
</tr>
|
390
|
+
</tbody>
|
391
|
+
<dl id="_">
|
392
|
+
<dt>a</dt>
|
393
|
+
<dd>
|
394
|
+
<p id="_">b</p>
|
395
|
+
</dd>
|
396
|
+
</dl></table>
|
397
|
+
|
398
|
+
</sections>
|
399
|
+
</iso-standard>
|
400
|
+
OUTPUT
|
401
|
+
end
|
402
|
+
|
403
|
+
it "processes headerrows attribute for table without header rows" do
|
404
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
405
|
+
#{ASCIIDOC_BLANK_HDR}
|
406
|
+
[headerrows=3]
|
407
|
+
|===
|
408
|
+
|a |b |c
|
409
|
+
|a |b |c
|
410
|
+
|a |b |c
|
411
|
+
|a |b |c
|
412
|
+
|===
|
413
|
+
INPUT
|
414
|
+
#{BLANK_HDR}
|
415
|
+
<sections>
|
416
|
+
<table id="_"><thead><tr>
|
417
|
+
<td align="left">a</td>
|
418
|
+
<td align="left">b</td>
|
419
|
+
<td align="left">c</td>
|
420
|
+
</tr><tr>
|
421
|
+
<td align="left">a</td>
|
422
|
+
<td align="left">b</td>
|
423
|
+
<td align="left">c</td>
|
424
|
+
</tr><tr>
|
425
|
+
<td align="left">a</td>
|
426
|
+
<td align="left">b</td>
|
427
|
+
<td align="left">c</td>
|
428
|
+
</tr></thead>
|
429
|
+
<tbody>
|
430
|
+
<tr>
|
431
|
+
<td align="left">a</td>
|
432
|
+
<td align="left">b</td>
|
433
|
+
<td align="left">c</td>
|
434
|
+
</tr>
|
435
|
+
</tbody>
|
436
|
+
</table>
|
437
|
+
</sections>
|
438
|
+
</iso-standard>
|
439
|
+
OUTPUT
|
440
|
+
end
|
441
|
+
|
442
|
+
it "processes headerrows attribute for table with header rows" do
|
443
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
444
|
+
#{ASCIIDOC_BLANK_HDR}
|
445
|
+
[headerrows=3]
|
446
|
+
|===
|
447
|
+
|a |b |c
|
448
|
+
|
449
|
+
|a |b |c
|
450
|
+
|a |b |c
|
451
|
+
|a |b |c
|
452
|
+
|===
|
453
|
+
INPUT
|
454
|
+
#{BLANK_HDR}
|
455
|
+
<sections>
|
456
|
+
<table id="_">
|
457
|
+
<thead>
|
458
|
+
<tr>
|
459
|
+
<th align="left">a</th>
|
460
|
+
<th align="left">b</th>
|
461
|
+
<th align="left">c</th>
|
462
|
+
</tr>
|
463
|
+
<tr>
|
464
|
+
<td align="left">a</td>
|
465
|
+
<td align="left">b</td>
|
466
|
+
<td align="left">c</td>
|
467
|
+
</tr><tr>
|
468
|
+
<td align="left">a</td>
|
469
|
+
<td align="left">b</td>
|
470
|
+
<td align="left">c</td>
|
471
|
+
</tr></thead>
|
472
|
+
<tbody>
|
473
|
+
|
474
|
+
|
475
|
+
<tr>
|
476
|
+
<td align="left">a</td>
|
477
|
+
<td align="left">b</td>
|
478
|
+
<td align="left">c</td>
|
479
|
+
</tr>
|
480
|
+
</tbody>
|
481
|
+
</table>
|
482
|
+
</sections>
|
483
|
+
</iso-standard>
|
484
|
+
OUTPUT
|
485
|
+
end
|
486
|
+
|
487
|
+
it "moves table notes inside table" do
|
488
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
489
|
+
#{ASCIIDOC_BLANK_HDR}
|
490
|
+
|===
|
491
|
+
|a |b |c
|
492
|
+
|===
|
493
|
+
|
494
|
+
NOTE: Note 1
|
495
|
+
|
496
|
+
NOTE: Note 2
|
497
|
+
INPUT
|
498
|
+
#{BLANK_HDR}
|
499
|
+
<sections><table id="_">
|
500
|
+
<tbody>
|
501
|
+
<tr>
|
502
|
+
<td align="left">a</td>
|
503
|
+
<td align="left">b</td>
|
504
|
+
<td align="left">c</td>
|
505
|
+
</tr>
|
506
|
+
</tbody>
|
507
|
+
<note id="_">
|
508
|
+
<p id="_">Note 1</p>
|
509
|
+
</note><note id="_">
|
510
|
+
<p id="_">Note 2</p>
|
511
|
+
</note></table>
|
512
|
+
|
513
|
+
</sections>
|
514
|
+
OUTPUT
|
515
|
+
end
|
516
|
+
|
517
|
+
it "moves formula key inside formula" do
|
518
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
519
|
+
#{ASCIIDOC_BLANK_HDR}
|
520
|
+
[stem]
|
521
|
+
++++
|
522
|
+
Formula
|
523
|
+
++++
|
524
|
+
|
525
|
+
where
|
526
|
+
|
527
|
+
a:: b
|
528
|
+
INPUT
|
529
|
+
#{BLANK_HDR}
|
530
|
+
<sections><formula id="_">
|
531
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>F</mi><mtext>or</mtext><mi>μ</mi><mi>l</mi><mi>a</mi></math></stem>
|
532
|
+
<dl id="_">
|
533
|
+
<dt>a</dt>
|
534
|
+
<dd>
|
535
|
+
<p id="_">b</p>
|
536
|
+
</dd>
|
537
|
+
</dl></formula>
|
538
|
+
|
539
|
+
</sections>
|
540
|
+
</iso-standard>
|
541
|
+
OUTPUT
|
542
|
+
end
|
543
|
+
|
544
|
+
it "moves footnotes inside figures" do
|
545
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
546
|
+
#{ASCIIDOC_BLANK_HDR}
|
547
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
548
|
+
|
549
|
+
footnote:[This is a footnote to a figure]
|
550
|
+
|
551
|
+
footnote:[This is another footnote to a figure]
|
552
|
+
INPUT
|
553
|
+
#{BLANK_HDR}
|
554
|
+
<sections><figure id="_">
|
555
|
+
<image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
556
|
+
<fn reference="a">
|
557
|
+
<p id="_">This is a footnote to a figure</p>
|
558
|
+
</fn><fn reference="b">
|
559
|
+
<p id="_">This is another footnote to a figure</p>
|
560
|
+
</fn></figure>
|
561
|
+
|
562
|
+
</sections>
|
563
|
+
|
564
|
+
</iso-standard>
|
565
|
+
OUTPUT
|
566
|
+
end
|
567
|
+
|
568
|
+
it "moves figure key inside figure" do
|
569
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
570
|
+
#{ASCIIDOC_BLANK_HDR}
|
571
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
572
|
+
|
573
|
+
Key
|
574
|
+
|
575
|
+
a:: b
|
576
|
+
INPUT
|
577
|
+
#{BLANK_HDR}
|
578
|
+
<sections><figure id="_">
|
579
|
+
<image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
580
|
+
<dl id="_">
|
581
|
+
<dt>a</dt>
|
582
|
+
<dd>
|
583
|
+
<p id="_">b</p>
|
584
|
+
</dd>
|
585
|
+
</dl></figure>
|
586
|
+
|
587
|
+
</sections>
|
588
|
+
|
589
|
+
</iso-standard>
|
590
|
+
OUTPUT
|
591
|
+
end
|
592
|
+
|
593
|
+
it "processes subfigures" do
|
594
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
595
|
+
#{ASCIIDOC_BLANK_HDR}
|
596
|
+
[[figureC-2]]
|
597
|
+
.Stages of gelatinization
|
598
|
+
====
|
599
|
+
.Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)
|
600
|
+
image::spec/examples/rice_images/rice_image3_1.png[]
|
601
|
+
|
602
|
+
.Intermediate stages: Some fully gelatinized kernels are visible
|
603
|
+
image::spec/examples/rice_images/rice_image3_2.png[]
|
604
|
+
|
605
|
+
.Final stages: All kernels are fully gelatinized
|
606
|
+
image::spec/examples/rice_images/rice_image3_3.png[]
|
607
|
+
====
|
608
|
+
INPUT
|
609
|
+
#{BLANK_HDR}
|
610
|
+
<sections>
|
611
|
+
<figure id="figureC-2"><figure id="_">
|
612
|
+
<name>Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)</name>
|
613
|
+
<image src="spec/examples/rice_images/rice_image3_1.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
614
|
+
</figure>
|
615
|
+
<figure id="_">
|
616
|
+
<name>Intermediate stages: Some fully gelatinized kernels are visible</name>
|
617
|
+
<image src="spec/examples/rice_images/rice_image3_2.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
618
|
+
</figure>
|
619
|
+
<figure id="_">
|
620
|
+
<name>Final stages: All kernels are fully gelatinized</name>
|
621
|
+
<image src="spec/examples/rice_images/rice_image3_3.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
622
|
+
</figure></figure>
|
623
|
+
</sections>
|
624
|
+
</iso-standard>
|
625
|
+
OUTPUT
|
626
|
+
end
|
627
|
+
|
628
|
+
it "numbers bibliographic notes and footnotes sequentially" do
|
629
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
630
|
+
#{ASCIIDOC_BLANK_HDR}
|
631
|
+
footnote:[Footnote]
|
632
|
+
|
633
|
+
[bibliography]
|
634
|
+
== Normative References
|
635
|
+
|
636
|
+
* [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_
|
637
|
+
|
638
|
+
== Clause
|
639
|
+
footnote:[Footnote2]
|
640
|
+
INPUT
|
641
|
+
#{BLANK_HDR}
|
642
|
+
<preface><foreword obligation="informative">
|
643
|
+
<title>Foreword</title>
|
644
|
+
<p id="_"><fn reference="1">
|
645
|
+
<p id="_">Footnote</p>
|
646
|
+
</fn>
|
647
|
+
</p>
|
648
|
+
</foreword></preface><sections>
|
649
|
+
|
650
|
+
<clause id="_" inline-header="false" obligation="normative">
|
651
|
+
<title>Clause</title>
|
652
|
+
<p id="_"><fn reference="3">
|
653
|
+
<p id="_">Footnote2</p>
|
654
|
+
</fn>
|
655
|
+
</p>
|
656
|
+
</clause></sections><bibliography><references id="_" obligation="informative">
|
657
|
+
<title>Normative References</title>
|
658
|
+
<bibitem id="iso123" type="standard">
|
659
|
+
<title format="text/plain">Standard</title>
|
660
|
+
<docidentifier>ISO 123:—</docidentifier>
|
661
|
+
<date type="published">
|
662
|
+
<on>--</on>
|
663
|
+
</date>
|
664
|
+
<contributor>
|
665
|
+
<role type="publisher"/>
|
666
|
+
<organization>
|
667
|
+
<name>International Organization for Standardization</name>
|
668
|
+
<abbreviation>ISO</abbreviation>
|
669
|
+
</organization>
|
670
|
+
</contributor>
|
671
|
+
<note format="text/plain" reference="2">ISO DATE: The standard is in press</note>
|
672
|
+
</bibitem>
|
673
|
+
</references>
|
674
|
+
</bibliography>
|
675
|
+
</iso-standard>
|
676
|
+
OUTPUT
|
677
|
+
end
|
678
|
+
|
679
|
+
it "defaults section obligations" do
|
680
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
681
|
+
#{ASCIIDOC_BLANK_HDR}
|
682
|
+
|
683
|
+
== Clause
|
684
|
+
Text
|
685
|
+
|
686
|
+
[appendix]
|
687
|
+
== Clause
|
688
|
+
|
689
|
+
Text
|
690
|
+
INPUT
|
691
|
+
#{BLANK_HDR}
|
692
|
+
<sections><clause id="_" inline-header="false" obligation="normative">
|
693
|
+
<title>Clause</title>
|
694
|
+
<p id="_">Text</p>
|
695
|
+
</clause>
|
696
|
+
</sections><annex id="_" inline-header="false" obligation="normative">
|
697
|
+
<title>Clause</title>
|
698
|
+
<p id="_">Text</p>
|
699
|
+
</annex>
|
700
|
+
</iso-standard>
|
701
|
+
OUTPUT
|
702
|
+
end
|
703
|
+
|
704
|
+
it "extends clause levels past 5" do
|
705
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
706
|
+
#{ASCIIDOC_BLANK_HDR}
|
707
|
+
|
708
|
+
== Clause1
|
709
|
+
|
710
|
+
=== Clause2
|
711
|
+
|
712
|
+
==== Clause3
|
713
|
+
|
714
|
+
===== Clause4
|
715
|
+
|
716
|
+
====== Clause 5
|
717
|
+
|
718
|
+
[level=6]
|
719
|
+
====== Clause 6
|
720
|
+
|
721
|
+
[level=7]
|
722
|
+
====== Clause 7A
|
723
|
+
|
724
|
+
[level=7]
|
725
|
+
====== Clause 7B
|
726
|
+
|
727
|
+
[level=6]
|
728
|
+
====== Clause 6B
|
729
|
+
|
730
|
+
====== Clause 5B
|
731
|
+
|
732
|
+
INPUT
|
733
|
+
#{BLANK_HDR}
|
734
|
+
<sections>
|
735
|
+
<clause id="_" inline-header="false" obligation="normative">
|
736
|
+
<title>Clause1</title>
|
737
|
+
<clause id="_" inline-header="false" obligation="normative">
|
738
|
+
<title>Clause2</title>
|
739
|
+
<clause id="_" inline-header="false" obligation="normative">
|
740
|
+
<title>Clause3</title>
|
741
|
+
<clause id="_" inline-header="false" obligation="normative"><title>Clause4</title><clause id="_" inline-header="false" obligation="normative">
|
742
|
+
<title>Clause 5</title>
|
743
|
+
<clause id="_" inline-header="false" obligation="normative">
|
744
|
+
<title>Clause 6</title>
|
745
|
+
<clause id="_" inline-header="false" obligation="normative">
|
746
|
+
<title>Clause 7A</title>
|
747
|
+
</clause><clause id="_" inline-header="false" obligation="normative">
|
748
|
+
<title>Clause 7B</title>
|
749
|
+
</clause></clause><clause id="_" inline-header="false" obligation="normative">
|
750
|
+
<title>Clause 6B</title>
|
751
|
+
</clause></clause>
|
752
|
+
|
753
|
+
|
754
|
+
|
755
|
+
|
756
|
+
<clause id="_" inline-header="false" obligation="normative">
|
757
|
+
<title>Clause 5B</title>
|
758
|
+
</clause></clause>
|
759
|
+
</clause>
|
760
|
+
</clause>
|
761
|
+
</clause>
|
762
|
+
</sections>
|
763
|
+
</iso-standard>
|
764
|
+
OUTPUT
|
765
|
+
end
|
766
|
+
end
|