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