metanorma-iso 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +11 -41
- data/.gitignore +2 -0
- data/.rubocop.yml +6 -2
- data/lib/asciidoctor/iso/base.rb +12 -12
- data/lib/asciidoctor/iso/biblio.rng +4 -6
- data/lib/asciidoctor/iso/cleanup.rb +1 -1
- data/lib/asciidoctor/iso/front.rb +1 -1
- data/lib/asciidoctor/iso/front_id.rb +30 -25
- data/lib/asciidoctor/iso/isodoc.rng +235 -3
- data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
- data/lib/asciidoctor/iso/isostandard.rng +17 -97
- data/lib/asciidoctor/iso/validate.rb +1 -0
- data/lib/asciidoctor/iso/validate_title.rb +21 -13
- data/lib/isodoc/iso/base_convert.rb +11 -0
- data/lib/isodoc/iso/html/style-human.css +7 -0
- data/lib/isodoc/iso/html/style-iso.css +7 -0
- data/lib/isodoc/iso/html_convert.rb +0 -1
- data/lib/isodoc/iso/i18n-en.yaml +4 -0
- data/lib/isodoc/iso/i18n-fr.yaml +4 -0
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
- data/lib/isodoc/iso/index.rb +140 -0
- data/lib/isodoc/iso/iso.amendment.xsl +1010 -324
- data/lib/isodoc/iso/iso.international-standard.xsl +1010 -324
- data/lib/isodoc/iso/presentation_xml_convert.rb +32 -25
- data/lib/isodoc/iso/word_convert.rb +0 -1
- data/lib/isodoc/iso/xref.rb +13 -5
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +8 -8
- data/spec/asciidoctor/amd_spec.rb +696 -0
- data/spec/asciidoctor/base_spec.rb +704 -0
- data/spec/asciidoctor/blocks_spec.rb +527 -0
- data/spec/asciidoctor/cleanup_spec.rb +1134 -0
- data/spec/asciidoctor/inline_spec.rb +195 -0
- data/spec/asciidoctor/lists_spec.rb +197 -0
- data/spec/asciidoctor/refs_spec.rb +375 -0
- data/spec/asciidoctor/section_spec.rb +393 -0
- data/spec/asciidoctor/table_spec.rb +329 -0
- data/spec/asciidoctor/validate_spec.rb +1572 -0
- data/spec/isodoc/amd_spec.rb +967 -946
- data/spec/isodoc/blocks_spec.rb +530 -507
- data/spec/isodoc/i18n_spec.rb +953 -911
- data/spec/isodoc/inline_spec.rb +355 -293
- data/spec/isodoc/iso_spec.rb +338 -314
- data/spec/isodoc/metadata_spec.rb +392 -382
- data/spec/isodoc/postproc_spec.rb +837 -657
- data/spec/isodoc/ref_spec.rb +374 -331
- data/spec/isodoc/section_spec.rb +821 -519
- data/spec/isodoc/table_spec.rb +472 -411
- data/spec/isodoc/terms_spec.rb +209 -185
- data/spec/isodoc/xref_spec.rb +1370 -1236
- data/spec/metanorma/processor_spec.rb +28 -26
- data/spec/spec_helper.rb +186 -189
- metadata +65 -67
- data/.rubocop.ribose.yml +0 -66
- data/lib/isodoc/iso/html/scripts.html +0 -178
- data/spec/asciidoctor-iso/amd_spec.rb +0 -694
- data/spec/asciidoctor-iso/base_spec.rb +0 -713
- data/spec/asciidoctor-iso/blocks_spec.rb +0 -482
- data/spec/asciidoctor-iso/cleanup_spec.rb +0 -1025
- data/spec/asciidoctor-iso/inline_spec.rb +0 -170
- data/spec/asciidoctor-iso/lists_spec.rb +0 -190
- data/spec/asciidoctor-iso/refs_spec.rb +0 -317
- data/spec/asciidoctor-iso/section_spec.rb +0 -362
- data/spec/asciidoctor-iso/table_spec.rb +0 -313
- data/spec/asciidoctor-iso/validate_spec.rb +0 -1619
- data/spec/assets/xref_error.adoc +0 -7
@@ -0,0 +1,527 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Asciidoctor::ISO do
|
4
|
+
it "processes open blocks" do
|
5
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
|
+
#{ASCIIDOC_BLANK_HDR}
|
7
|
+
--
|
8
|
+
x
|
9
|
+
|
10
|
+
y
|
11
|
+
|
12
|
+
z
|
13
|
+
--
|
14
|
+
INPUT
|
15
|
+
#{BLANK_HDR}
|
16
|
+
<sections>
|
17
|
+
<p id="_">x</p>
|
18
|
+
<p id="_">y</p>
|
19
|
+
<p id="_">z</p>
|
20
|
+
</sections>
|
21
|
+
</iso-standard>
|
22
|
+
OUTPUT
|
23
|
+
end
|
24
|
+
|
25
|
+
it "processes stem blocks" do
|
26
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
27
|
+
#{ASCIIDOC_BLANK_HDR}
|
28
|
+
[stem]
|
29
|
+
++++
|
30
|
+
r = 1 %
|
31
|
+
r = 1 %
|
32
|
+
++++
|
33
|
+
|
34
|
+
[stem]
|
35
|
+
++++
|
36
|
+
<mml:math><mml:msub xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">F</mml:mi> </mml:mrow> </mml:mrow> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">Α</mml:mi> </mml:mrow> </mml:mrow> </mml:msub> </mml:math>
|
37
|
+
++++
|
38
|
+
INPUT
|
39
|
+
#{BLANK_HDR}
|
40
|
+
<sections>
|
41
|
+
<formula id="_">
|
42
|
+
<stem type="MathML">
|
43
|
+
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
44
|
+
<mi>r</mi>
|
45
|
+
<mo>=</mo>
|
46
|
+
<mn>1</mn>
|
47
|
+
<mi>%</mi>
|
48
|
+
<mi>r</mi>
|
49
|
+
<mo>=</mo>
|
50
|
+
<mn>1</mn>
|
51
|
+
<mi>%</mi>
|
52
|
+
</math>
|
53
|
+
</stem>
|
54
|
+
</formula>
|
55
|
+
<formula id="_">
|
56
|
+
<stem type="MathML">
|
57
|
+
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
58
|
+
<msub>
|
59
|
+
<mrow>
|
60
|
+
<mrow>
|
61
|
+
<mi mathvariant="bold-italic">F</mi>
|
62
|
+
</mrow>
|
63
|
+
</mrow>
|
64
|
+
<mrow>
|
65
|
+
<mrow>
|
66
|
+
<mi mathvariant="bold-italic">Α</mi>
|
67
|
+
</mrow>
|
68
|
+
</mrow>
|
69
|
+
</msub>
|
70
|
+
</math>
|
71
|
+
</stem>
|
72
|
+
</formula>
|
73
|
+
</sections>
|
74
|
+
</iso-standard>
|
75
|
+
OUTPUT
|
76
|
+
end
|
77
|
+
|
78
|
+
it "ignores review blocks unless document is in draft mode" do
|
79
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
80
|
+
#{ASCIIDOC_BLANK_HDR}
|
81
|
+
[[foreword]]
|
82
|
+
.Foreword
|
83
|
+
Foreword
|
84
|
+
|
85
|
+
[reviewer=ISO,date=20170101,from=foreword,to=foreword]
|
86
|
+
****
|
87
|
+
A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.
|
88
|
+
|
89
|
+
For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
|
90
|
+
****
|
91
|
+
INPUT
|
92
|
+
#{BLANK_HDR}
|
93
|
+
<sections>
|
94
|
+
<p id="foreword">Foreword</p>
|
95
|
+
</sections>
|
96
|
+
</iso-standard>
|
97
|
+
OUTPUT
|
98
|
+
end
|
99
|
+
|
100
|
+
it "processes review blocks if document is in draft mode" do
|
101
|
+
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
102
|
+
= Document title
|
103
|
+
Author
|
104
|
+
:docfile: test.adoc
|
105
|
+
:nodoc:
|
106
|
+
:novalid:
|
107
|
+
:draft: 1.2
|
108
|
+
:no-isobib:
|
109
|
+
|
110
|
+
[[foreword]]
|
111
|
+
.Foreword
|
112
|
+
Foreword
|
113
|
+
|
114
|
+
[reviewer=ISO,date=20170101,from=foreword,to=foreword]
|
115
|
+
****
|
116
|
+
A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.
|
117
|
+
|
118
|
+
For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
|
119
|
+
****
|
120
|
+
INPUT
|
121
|
+
expect(xmlpp(strip_guid(output).sub(/^.+<sections>/m, "<iso-standard><sections>")))
|
122
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
123
|
+
<iso-standard>
|
124
|
+
<sections>
|
125
|
+
<p id="foreword">Foreword</p>
|
126
|
+
<review date="20170101T00:00:00Z" from="foreword" id="_" reviewer="ISO" to="foreword">
|
127
|
+
<p id="_">A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.</p>
|
128
|
+
<p id="_">For further information on the Foreword, see#{' '}
|
129
|
+
<strong>ISO/IEC Directives, Part 2, 2016, Clause 12.</strong></p>
|
130
|
+
</review>
|
131
|
+
</sections>
|
132
|
+
</iso-standard>
|
133
|
+
OUTPUT
|
134
|
+
end
|
135
|
+
|
136
|
+
it "processes term notes" do
|
137
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
138
|
+
#{ASCIIDOC_BLANK_HDR}
|
139
|
+
== Terms and Definitions
|
140
|
+
|
141
|
+
=== Term1
|
142
|
+
|
143
|
+
NOTE: This is a note
|
144
|
+
INPUT
|
145
|
+
#{BLANK_HDR}
|
146
|
+
<sections>
|
147
|
+
<terms id="_" obligation="normative">
|
148
|
+
<title>Terms and definitions</title>
|
149
|
+
#{TERM_BOILERPLATE}#{' '}
|
150
|
+
<term id="term-term1">
|
151
|
+
<preferred>Term1</preferred>
|
152
|
+
<termnote id="_">
|
153
|
+
<p id="_">This is a note</p></termnote>
|
154
|
+
</term>
|
155
|
+
</terms>
|
156
|
+
</sections>
|
157
|
+
</iso-standard>
|
158
|
+
OUTPUT
|
159
|
+
end
|
160
|
+
|
161
|
+
it "processes notes" do
|
162
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
163
|
+
#{ASCIIDOC_BLANK_HDR}
|
164
|
+
NOTE: This is a note
|
165
|
+
INPUT
|
166
|
+
#{BLANK_HDR}
|
167
|
+
<sections>
|
168
|
+
<note id="_">
|
169
|
+
<p id="_">This is a note</p>
|
170
|
+
</note>
|
171
|
+
</sections>
|
172
|
+
</iso-standard>
|
173
|
+
OUTPUT
|
174
|
+
end
|
175
|
+
|
176
|
+
it "processes literals" do
|
177
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
178
|
+
#{ASCIIDOC_BLANK_HDR}
|
179
|
+
....
|
180
|
+
LITERAL
|
181
|
+
....
|
182
|
+
INPUT
|
183
|
+
#{BLANK_HDR}
|
184
|
+
<sections>
|
185
|
+
<figure id="_">
|
186
|
+
<pre id="_">LITERAL</pre>
|
187
|
+
</figure>
|
188
|
+
</sections>
|
189
|
+
</iso-standard>
|
190
|
+
OUTPUT
|
191
|
+
end
|
192
|
+
|
193
|
+
it "processes simple admonitions with Asciidoc names" do
|
194
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
195
|
+
#{ASCIIDOC_BLANK_HDR}
|
196
|
+
CAUTION: Only use paddy or parboiled rice for the determination of husked rice yield.
|
197
|
+
INPUT
|
198
|
+
#{BLANK_HDR}
|
199
|
+
<sections>
|
200
|
+
<admonition id="_" type="caution">
|
201
|
+
<p id="_">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
|
202
|
+
</admonition>
|
203
|
+
</sections>
|
204
|
+
</iso-standard>
|
205
|
+
OUTPUT
|
206
|
+
end
|
207
|
+
|
208
|
+
it "processes complex admonitions with non-Asciidoc names" do
|
209
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
210
|
+
#{ASCIIDOC_BLANK_HDR}
|
211
|
+
[CAUTION,type=Safety Precautions]
|
212
|
+
.Safety Precautions
|
213
|
+
====
|
214
|
+
While werewolves are hardy community members, keep in mind the following dietary concerns:
|
215
|
+
|
216
|
+
. They are allergic to cinnamon.
|
217
|
+
. More than two glasses of orange juice in 24 hours makes them howl in harmony with alarms and sirens.
|
218
|
+
. Celery makes them sad.
|
219
|
+
====
|
220
|
+
INPUT
|
221
|
+
#{BLANK_HDR}
|
222
|
+
<sections>
|
223
|
+
<admonition id="_" type="safety precautions">
|
224
|
+
<name>Safety Precautions</name>
|
225
|
+
<p id="_">While werewolves are hardy community members, keep in mind the following dietary concerns:</p>
|
226
|
+
<ol id="_">
|
227
|
+
<li>
|
228
|
+
<p id="_">They are allergic to cinnamon.</p>
|
229
|
+
</li>
|
230
|
+
<li>
|
231
|
+
<p id="_">More than two glasses of orange juice in 24 hours makes them howl in harmony with alarms and sirens.</p>
|
232
|
+
</li>
|
233
|
+
<li>
|
234
|
+
<p id="_">Celery makes them sad.</p>
|
235
|
+
</li>
|
236
|
+
</ol>
|
237
|
+
</admonition>
|
238
|
+
</sections>
|
239
|
+
</iso-standard>
|
240
|
+
OUTPUT
|
241
|
+
end
|
242
|
+
|
243
|
+
it "processes term examples" do
|
244
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
245
|
+
#{ASCIIDOC_BLANK_HDR}
|
246
|
+
== Terms and Definitions
|
247
|
+
|
248
|
+
=== Term1
|
249
|
+
|
250
|
+
[example]
|
251
|
+
This is an example
|
252
|
+
INPUT
|
253
|
+
#{BLANK_HDR}
|
254
|
+
<sections>
|
255
|
+
<terms id="_" obligation="normative">
|
256
|
+
<title>Terms and definitions</title>
|
257
|
+
#{TERM_BOILERPLATE}
|
258
|
+
<term id="term-term1">
|
259
|
+
<preferred>Term1</preferred>
|
260
|
+
<termexample id="_">
|
261
|
+
<p id="_">This is an example</p></termexample>
|
262
|
+
</term>
|
263
|
+
</terms>
|
264
|
+
</sections>
|
265
|
+
</iso-standard>
|
266
|
+
OUTPUT
|
267
|
+
end
|
268
|
+
|
269
|
+
it "processes examples" do
|
270
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
271
|
+
#{ASCIIDOC_BLANK_HDR}
|
272
|
+
[example]
|
273
|
+
====
|
274
|
+
This is an example
|
275
|
+
|
276
|
+
Amen
|
277
|
+
====
|
278
|
+
INPUT
|
279
|
+
#{BLANK_HDR}
|
280
|
+
<sections>
|
281
|
+
<example id="_">
|
282
|
+
<p id="_">This is an example</p>
|
283
|
+
<p id="_">Amen</p>
|
284
|
+
</example>
|
285
|
+
</sections>
|
286
|
+
</iso-standard>
|
287
|
+
OUTPUT
|
288
|
+
end
|
289
|
+
|
290
|
+
it "processes preambles" do
|
291
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
292
|
+
#{ASCIIDOC_BLANK_HDR}
|
293
|
+
This is a preamble
|
294
|
+
|
295
|
+
== Section 1
|
296
|
+
INPUT
|
297
|
+
#{BLANK_HDR}
|
298
|
+
<preface>
|
299
|
+
<foreword id="_" obligation="informative">
|
300
|
+
<title>Foreword</title>
|
301
|
+
<p id="_">This is a preamble</p>
|
302
|
+
</foreword>
|
303
|
+
</preface>
|
304
|
+
<sections>
|
305
|
+
<clause id="_" inline-header="false" obligation="normative">
|
306
|
+
<title>Section 1</title>
|
307
|
+
</clause>
|
308
|
+
</sections>
|
309
|
+
</iso-standard>
|
310
|
+
OUTPUT
|
311
|
+
end
|
312
|
+
|
313
|
+
it "processes images" do
|
314
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
315
|
+
#{ASCIIDOC_BLANK_HDR}
|
316
|
+
.Split-it-right sample divider
|
317
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
318
|
+
|
319
|
+
INPUT
|
320
|
+
#{BLANK_HDR}
|
321
|
+
<sections>
|
322
|
+
<figure id="_">
|
323
|
+
<name>Split-it-right sample divider</name>
|
324
|
+
<image height="auto" id="_" mimetype="image/png" src="spec/examples/rice_images/rice_image1.png" width="auto"/>
|
325
|
+
</figure>
|
326
|
+
</sections>
|
327
|
+
</iso-standard>
|
328
|
+
OUTPUT
|
329
|
+
end
|
330
|
+
|
331
|
+
it "accepts width and height attributes on images" do
|
332
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
333
|
+
#{ASCIIDOC_BLANK_HDR}
|
334
|
+
[height=4,width=3]
|
335
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
336
|
+
|
337
|
+
INPUT
|
338
|
+
#{BLANK_HDR}
|
339
|
+
<sections>
|
340
|
+
<figure id="_">
|
341
|
+
<image height="4" id="_" mimetype="image/png" src="spec/examples/rice_images/rice_image1.png" width="3"/>
|
342
|
+
</figure>
|
343
|
+
</sections>
|
344
|
+
</iso-standard>
|
345
|
+
OUTPUT
|
346
|
+
end
|
347
|
+
|
348
|
+
it "accepts auto for width and height attributes on images" do
|
349
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
350
|
+
#{ASCIIDOC_BLANK_HDR}
|
351
|
+
[height=4,width=auto]
|
352
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
353
|
+
|
354
|
+
INPUT
|
355
|
+
#{BLANK_HDR}
|
356
|
+
<sections>
|
357
|
+
<figure id="_">
|
358
|
+
<image height="4" id="_" mimetype="image/png" src="spec/examples/rice_images/rice_image1.png" width="auto"/>
|
359
|
+
</figure>
|
360
|
+
</sections>
|
361
|
+
</iso-standard>
|
362
|
+
OUTPUT
|
363
|
+
end
|
364
|
+
|
365
|
+
it "accepts alignment attribute on paragraphs" do
|
366
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
367
|
+
#{ASCIIDOC_BLANK_HDR}
|
368
|
+
[align=right]
|
369
|
+
This para is right-aligned.
|
370
|
+
INPUT
|
371
|
+
#{BLANK_HDR}
|
372
|
+
<sections>
|
373
|
+
<p align="right" id="_">This para is right-aligned.</p>
|
374
|
+
</sections>
|
375
|
+
</iso-standard>
|
376
|
+
OUTPUT
|
377
|
+
end
|
378
|
+
|
379
|
+
it "processes blockquotes" do
|
380
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
381
|
+
#{ASCIIDOC_BLANK_HDR}
|
382
|
+
[quote, ISO, "ISO7301,section 1"]
|
383
|
+
____
|
384
|
+
Block quotation
|
385
|
+
____
|
386
|
+
INPUT
|
387
|
+
#{BLANK_HDR}
|
388
|
+
<sections>
|
389
|
+
<quote id="_">
|
390
|
+
<source bibitemid="ISO7301" citeas="" type="inline">
|
391
|
+
<localityStack>
|
392
|
+
<locality type="section">
|
393
|
+
<referenceFrom>1</referenceFrom>
|
394
|
+
</locality>
|
395
|
+
</localityStack>
|
396
|
+
</source>
|
397
|
+
<author>ISO</author>
|
398
|
+
<p id="_">Block quotation</p>
|
399
|
+
</quote>
|
400
|
+
</sections>
|
401
|
+
</iso-standard>
|
402
|
+
OUTPUT
|
403
|
+
end
|
404
|
+
|
405
|
+
it "processes source code" do
|
406
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
407
|
+
#{ASCIIDOC_BLANK_HDR}
|
408
|
+
[source,ruby]
|
409
|
+
--
|
410
|
+
puts "Hello, world."
|
411
|
+
%w{a b c}.each do |x|
|
412
|
+
puts x
|
413
|
+
end
|
414
|
+
--
|
415
|
+
INPUT
|
416
|
+
#{BLANK_HDR}
|
417
|
+
<sections>
|
418
|
+
<sourcecode id="_" lang="ruby">
|
419
|
+
puts "Hello, world."
|
420
|
+
%w{a b c}.each do |x|
|
421
|
+
puts x
|
422
|
+
end
|
423
|
+
</sourcecode>
|
424
|
+
</sections>
|
425
|
+
</iso-standard>
|
426
|
+
OUTPUT
|
427
|
+
end
|
428
|
+
|
429
|
+
it "processes callouts" do
|
430
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
431
|
+
#{ASCIIDOC_BLANK_HDR}
|
432
|
+
[source,ruby]
|
433
|
+
--
|
434
|
+
puts "Hello, world." <1>
|
435
|
+
%w{a b c}.each do |x|
|
436
|
+
puts x <2>
|
437
|
+
end
|
438
|
+
--
|
439
|
+
<1> This is one callout
|
440
|
+
<2> This is another callout
|
441
|
+
INPUT
|
442
|
+
#{BLANK_HDR}
|
443
|
+
<sections>
|
444
|
+
<sourcecode id="_" lang="ruby">
|
445
|
+
puts "Hello, world." <callout target="_">1</callout>
|
446
|
+
%w{a b c}.each do |x|
|
447
|
+
puts x <callout target="_">2</callout>
|
448
|
+
end
|
449
|
+
<annotation id="_">
|
450
|
+
<p id="_">This is one callout</p>
|
451
|
+
</annotation>
|
452
|
+
<annotation id="_">
|
453
|
+
<p id="_">This is another callout</p>
|
454
|
+
</annotation>
|
455
|
+
</sourcecode>
|
456
|
+
</sections>
|
457
|
+
</iso-standard>
|
458
|
+
OUTPUT
|
459
|
+
end
|
460
|
+
|
461
|
+
it "processes unmodified term sources" do
|
462
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
463
|
+
#{ASCIIDOC_BLANK_HDR}
|
464
|
+
== Terms and Definitions
|
465
|
+
|
466
|
+
=== Term1
|
467
|
+
|
468
|
+
[.source]
|
469
|
+
<<ISO2191,section=1>>
|
470
|
+
INPUT
|
471
|
+
#{BLANK_HDR}
|
472
|
+
<sections>
|
473
|
+
<terms id="_" obligation="normative">
|
474
|
+
<title>Terms and definitions</title>
|
475
|
+
#{TERM_BOILERPLATE}
|
476
|
+
<term id="term-term1">
|
477
|
+
<preferred>Term1</preferred>
|
478
|
+
<termsource status="identical">
|
479
|
+
<origin bibitemid="ISO2191" citeas="" type="inline">
|
480
|
+
<localityStack>
|
481
|
+
<locality type="section">
|
482
|
+
<referenceFrom>1</referenceFrom></locality>
|
483
|
+
</localityStack>
|
484
|
+
</origin>
|
485
|
+
</termsource>
|
486
|
+
</term>
|
487
|
+
</terms>
|
488
|
+
</sections>
|
489
|
+
</iso-standard>
|
490
|
+
OUTPUT
|
491
|
+
end
|
492
|
+
|
493
|
+
it "processes modified term sources" do
|
494
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
495
|
+
#{ASCIIDOC_BLANK_HDR}
|
496
|
+
== Terms and Definitions
|
497
|
+
|
498
|
+
=== Term1
|
499
|
+
|
500
|
+
[.source]
|
501
|
+
<<ISO2191,section=1>>, with adjustments
|
502
|
+
INPUT
|
503
|
+
#{BLANK_HDR}
|
504
|
+
<sections>
|
505
|
+
<terms id="_" obligation="normative">
|
506
|
+
<title>Terms and definitions</title>
|
507
|
+
#{TERM_BOILERPLATE}
|
508
|
+
<term id="term-term1">
|
509
|
+
<preferred>Term1</preferred>
|
510
|
+
<termsource status="modified">
|
511
|
+
<origin bibitemid="ISO2191" citeas="" type="inline">
|
512
|
+
<localityStack>
|
513
|
+
<locality type="section">
|
514
|
+
<referenceFrom>1</referenceFrom></locality>
|
515
|
+
</localityStack>
|
516
|
+
</origin>
|
517
|
+
<modification>
|
518
|
+
<p id="_">with adjustments</p>
|
519
|
+
</modification>
|
520
|
+
</termsource>
|
521
|
+
</term>
|
522
|
+
</terms>
|
523
|
+
</sections>
|
524
|
+
</iso-standard>
|
525
|
+
OUTPUT
|
526
|
+
end
|
527
|
+
end
|