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,469 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Asciidoctor::ISO do
|
4
|
+
it "processes open blocks" do
|
5
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
6
|
+
#{ASCIIDOC_BLANK_HDR}
|
7
|
+
--
|
8
|
+
x
|
9
|
+
|
10
|
+
y
|
11
|
+
|
12
|
+
z
|
13
|
+
--
|
14
|
+
INPUT
|
15
|
+
#{BLANK_HDR}
|
16
|
+
<sections><p id="_">x</p>
|
17
|
+
<p id="_">y</p>
|
18
|
+
<p id="_">z</p></sections>
|
19
|
+
</iso-standard>
|
20
|
+
OUTPUT
|
21
|
+
end
|
22
|
+
|
23
|
+
it "processes stem blocks" do
|
24
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
25
|
+
#{ASCIIDOC_BLANK_HDR}
|
26
|
+
[stem]
|
27
|
+
++++
|
28
|
+
r = 1 %
|
29
|
+
r = 1 %
|
30
|
+
++++
|
31
|
+
|
32
|
+
[stem]
|
33
|
+
++++
|
34
|
+
<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>
|
35
|
+
++++
|
36
|
+
INPUT
|
37
|
+
#{BLANK_HDR}
|
38
|
+
<sections>
|
39
|
+
<formula id="_">
|
40
|
+
<stem type="AsciiMath">r = 1 %
|
41
|
+
r = 1 %</stem>
|
42
|
+
</formula>
|
43
|
+
|
44
|
+
<formula id="_">
|
45
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
|
46
|
+
</stem>
|
47
|
+
</formula>
|
48
|
+
</sections>
|
49
|
+
</iso-standard>
|
50
|
+
OUTPUT
|
51
|
+
end
|
52
|
+
|
53
|
+
it "ignores review blocks unless document is in draft mode" do
|
54
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
55
|
+
#{ASCIIDOC_BLANK_HDR}
|
56
|
+
[[foreword]]
|
57
|
+
.Foreword
|
58
|
+
Foreword
|
59
|
+
|
60
|
+
[reviewer=ISO,date=20170101,from=foreword,to=foreword]
|
61
|
+
****
|
62
|
+
A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.
|
63
|
+
|
64
|
+
For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
|
65
|
+
****
|
66
|
+
INPUT
|
67
|
+
#{BLANK_HDR}
|
68
|
+
<sections><p id="foreword">Foreword</p>
|
69
|
+
</sections>
|
70
|
+
</iso-standard>
|
71
|
+
OUTPUT
|
72
|
+
end
|
73
|
+
|
74
|
+
it "processes review blocks if document is in draft mode" do
|
75
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
76
|
+
= Document title
|
77
|
+
Author
|
78
|
+
:docfile: test.adoc
|
79
|
+
:nodoc:
|
80
|
+
:novalid:
|
81
|
+
:draft: 1.2
|
82
|
+
|
83
|
+
[[foreword]]
|
84
|
+
.Foreword
|
85
|
+
Foreword
|
86
|
+
|
87
|
+
[reviewer=ISO,date=20170101,from=foreword,to=foreword]
|
88
|
+
****
|
89
|
+
A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.
|
90
|
+
|
91
|
+
For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
|
92
|
+
****
|
93
|
+
INPUT
|
94
|
+
#{BLANK_HDR}
|
95
|
+
<version>
|
96
|
+
<draft>1.2</draft>
|
97
|
+
</version>
|
98
|
+
<sections><p id="foreword">Foreword</p>
|
99
|
+
<review reviewer="ISO" id="_" date="20170101T00:00:00Z" from="foreword" to="foreword"><p id="_">A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.</p>
|
100
|
+
<p id="_">For further information on the Foreword, see <strong>ISO/IEC Directives, Part 2, 2016, Clause 12.</strong></p></review></sections>
|
101
|
+
</iso-standard>
|
102
|
+
|
103
|
+
OUTPUT
|
104
|
+
end
|
105
|
+
|
106
|
+
it "processes term notes" do
|
107
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
108
|
+
#{ASCIIDOC_BLANK_HDR}
|
109
|
+
== Terms and Definitions
|
110
|
+
|
111
|
+
=== Term1
|
112
|
+
|
113
|
+
NOTE: This is a note
|
114
|
+
INPUT
|
115
|
+
#{BLANK_HDR}
|
116
|
+
<sections>
|
117
|
+
<terms id="_" obligation="normative">
|
118
|
+
<title>Terms and definitions</title>
|
119
|
+
<term id="_">
|
120
|
+
<preferred>Term1</preferred>
|
121
|
+
<termnote id="_">
|
122
|
+
<p id="_">This is a note</p>
|
123
|
+
</termnote>
|
124
|
+
</term>
|
125
|
+
</terms>
|
126
|
+
</sections>
|
127
|
+
</iso-standard>
|
128
|
+
OUTPUT
|
129
|
+
end
|
130
|
+
|
131
|
+
it "processes notes" do
|
132
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
133
|
+
#{ASCIIDOC_BLANK_HDR}
|
134
|
+
NOTE: This is a note
|
135
|
+
INPUT
|
136
|
+
#{BLANK_HDR}
|
137
|
+
<sections>
|
138
|
+
<note id="_">
|
139
|
+
<p id="_">This is a note</p>
|
140
|
+
</note>
|
141
|
+
</sections>
|
142
|
+
</iso-standard>
|
143
|
+
|
144
|
+
OUTPUT
|
145
|
+
end
|
146
|
+
|
147
|
+
it "does nothing in particular with literals" do
|
148
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
149
|
+
#{ASCIIDOC_BLANK_HDR}
|
150
|
+
....
|
151
|
+
LITERAL
|
152
|
+
....
|
153
|
+
INPUT
|
154
|
+
#{BLANK_HDR}
|
155
|
+
<sections>
|
156
|
+
<p id="_">LITERAL</p>
|
157
|
+
</sections>
|
158
|
+
</iso-standard>
|
159
|
+
|
160
|
+
OUTPUT
|
161
|
+
end
|
162
|
+
|
163
|
+
it "processes simple admonitions with Asciidoc names" do
|
164
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
165
|
+
#{ASCIIDOC_BLANK_HDR}
|
166
|
+
CAUTION: Only use paddy or parboiled rice for the determination of husked rice yield.
|
167
|
+
INPUT
|
168
|
+
#{BLANK_HDR}
|
169
|
+
<sections>
|
170
|
+
<admonition id="_" type="caution">
|
171
|
+
<p id="_">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
|
172
|
+
</admonition>
|
173
|
+
</sections>
|
174
|
+
</iso-standard>
|
175
|
+
|
176
|
+
OUTPUT
|
177
|
+
end
|
178
|
+
|
179
|
+
|
180
|
+
it "processes complex admonitions with non-Asciidoc names" do
|
181
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
182
|
+
#{ASCIIDOC_BLANK_HDR}
|
183
|
+
[CAUTION,type=Safety Precautions]
|
184
|
+
.Safety Precautions
|
185
|
+
====
|
186
|
+
While werewolves are hardy community members, keep in mind the following dietary concerns:
|
187
|
+
|
188
|
+
. They are allergic to cinnamon.
|
189
|
+
. More than two glasses of orange juice in 24 hours makes them howl in harmony with alarms and sirens.
|
190
|
+
. Celery makes them sad.
|
191
|
+
====
|
192
|
+
INPUT
|
193
|
+
#{BLANK_HDR}
|
194
|
+
<sections>
|
195
|
+
<admonition id="_" type="safety precautions"><p id="_">While werewolves are hardy community members, keep in mind the following dietary concerns:</p>
|
196
|
+
<ol id="_" type="arabic">
|
197
|
+
<li>
|
198
|
+
<p id="_">They are allergic to cinnamon.</p>
|
199
|
+
</li>
|
200
|
+
<li>
|
201
|
+
<p id="_">More than two glasses of orange juice in 24 hours makes them howl in harmony with alarms and sirens.</p>
|
202
|
+
</li>
|
203
|
+
<li>
|
204
|
+
<p id="_">Celery makes them sad.</p>
|
205
|
+
</li>
|
206
|
+
</ol></admonition>
|
207
|
+
</sections>
|
208
|
+
</iso-standard>
|
209
|
+
|
210
|
+
OUTPUT
|
211
|
+
end
|
212
|
+
|
213
|
+
it "processes term examples" do
|
214
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
215
|
+
#{ASCIIDOC_BLANK_HDR}
|
216
|
+
== Terms and Definitions
|
217
|
+
|
218
|
+
=== Term1
|
219
|
+
|
220
|
+
[example]
|
221
|
+
This is an example
|
222
|
+
INPUT
|
223
|
+
#{BLANK_HDR}
|
224
|
+
<sections>
|
225
|
+
<terms id="_" obligation="normative">
|
226
|
+
<title>Terms and definitions</title>
|
227
|
+
<term id="_">
|
228
|
+
<preferred>Term1</preferred>
|
229
|
+
<termexample id="_">
|
230
|
+
<p id="_">This is an example</p>
|
231
|
+
</termexample>
|
232
|
+
</term>
|
233
|
+
</terms>
|
234
|
+
</sections>
|
235
|
+
</iso-standard>
|
236
|
+
|
237
|
+
OUTPUT
|
238
|
+
end
|
239
|
+
|
240
|
+
it "processes examples" do
|
241
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
242
|
+
#{ASCIIDOC_BLANK_HDR}
|
243
|
+
[example]
|
244
|
+
====
|
245
|
+
This is an example
|
246
|
+
|
247
|
+
Amen
|
248
|
+
====
|
249
|
+
INPUT
|
250
|
+
#{BLANK_HDR}
|
251
|
+
<sections>
|
252
|
+
<example id="_"><p id="_">This is an example</p>
|
253
|
+
<p id="_">Amen</p></example>
|
254
|
+
</sections>
|
255
|
+
</iso-standard>
|
256
|
+
OUTPUT
|
257
|
+
end
|
258
|
+
|
259
|
+
it "processes preambles" do
|
260
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
261
|
+
#{ASCIIDOC_BLANK_HDR}
|
262
|
+
This is a preamble
|
263
|
+
|
264
|
+
== Section 1
|
265
|
+
INPUT
|
266
|
+
#{BLANK_HDR}
|
267
|
+
<preface><foreword obligation="informative">
|
268
|
+
<title>Foreword</title>
|
269
|
+
<p id="_">This is a preamble</p>
|
270
|
+
</foreword></preface><sections>
|
271
|
+
<clause id="_" inline-header="false" obligation="normative">
|
272
|
+
<title>Section 1</title>
|
273
|
+
</clause></sections>
|
274
|
+
</iso-standard>
|
275
|
+
OUTPUT
|
276
|
+
end
|
277
|
+
|
278
|
+
it "processes images" do
|
279
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
280
|
+
#{ASCIIDOC_BLANK_HDR}
|
281
|
+
.Split-it-right sample divider
|
282
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
283
|
+
|
284
|
+
INPUT
|
285
|
+
#{BLANK_HDR}
|
286
|
+
<sections>
|
287
|
+
<figure id="_">
|
288
|
+
<name>Split-it-right sample divider</name>
|
289
|
+
<image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
290
|
+
</figure>
|
291
|
+
</sections>
|
292
|
+
</iso-standard>
|
293
|
+
OUTPUT
|
294
|
+
end
|
295
|
+
|
296
|
+
it "accepts width and height attributes on images" do
|
297
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
298
|
+
#{ASCIIDOC_BLANK_HDR}
|
299
|
+
[height=4,width=3]
|
300
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
301
|
+
|
302
|
+
INPUT
|
303
|
+
#{BLANK_HDR}
|
304
|
+
<sections>
|
305
|
+
<figure id="_">
|
306
|
+
<image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG" height="4" width="3"/>
|
307
|
+
</figure>
|
308
|
+
</sections>
|
309
|
+
</iso-standard>
|
310
|
+
OUTPUT
|
311
|
+
end
|
312
|
+
|
313
|
+
it "accepts auto for width and height attributes on images" do
|
314
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
315
|
+
#{ASCIIDOC_BLANK_HDR}
|
316
|
+
[height=4,width=auto]
|
317
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
318
|
+
|
319
|
+
INPUT
|
320
|
+
#{BLANK_HDR}
|
321
|
+
<sections>
|
322
|
+
<figure id="_">
|
323
|
+
<image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG" height="4" width="auto"/>
|
324
|
+
</figure>
|
325
|
+
</sections>
|
326
|
+
</iso-standard>
|
327
|
+
OUTPUT
|
328
|
+
end
|
329
|
+
|
330
|
+
it "accepts alignment attribute on paragraphs" do
|
331
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
332
|
+
#{ASCIIDOC_BLANK_HDR}
|
333
|
+
[align=right]
|
334
|
+
This para is right-aligned.
|
335
|
+
INPUT
|
336
|
+
#{BLANK_HDR}
|
337
|
+
<sections>
|
338
|
+
<p align="right" id="_">This para is right-aligned.</p>
|
339
|
+
</sections>
|
340
|
+
</iso-standard>
|
341
|
+
OUTPUT
|
342
|
+
end
|
343
|
+
|
344
|
+
it "processes blockquotes" do
|
345
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
346
|
+
#{ASCIIDOC_BLANK_HDR}
|
347
|
+
[quote, ISO, "ISO7301,section 1"]
|
348
|
+
____
|
349
|
+
Block quotation
|
350
|
+
____
|
351
|
+
INPUT
|
352
|
+
#{BLANK_HDR}
|
353
|
+
<sections>
|
354
|
+
<quote id="_">
|
355
|
+
<source type="inline" bibitemid="ISO7301" citeas=""><locality type="section"><referenceFrom>1</referenceFrom></locality></source>
|
356
|
+
<author>ISO</author>
|
357
|
+
<p id="_">Block quotation</p>
|
358
|
+
</quote>
|
359
|
+
</sections>
|
360
|
+
</iso-standard>
|
361
|
+
OUTPUT
|
362
|
+
end
|
363
|
+
|
364
|
+
it "processes source code" do
|
365
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
366
|
+
#{ASCIIDOC_BLANK_HDR}
|
367
|
+
[source,ruby]
|
368
|
+
--
|
369
|
+
puts "Hello, world."
|
370
|
+
%w{a b c}.each do |x|
|
371
|
+
puts x
|
372
|
+
end
|
373
|
+
--
|
374
|
+
INPUT
|
375
|
+
#{BLANK_HDR}
|
376
|
+
<sections>
|
377
|
+
<sourcecode id="_">puts "Hello, world."
|
378
|
+
%w{a b c}.each do |x|
|
379
|
+
puts x
|
380
|
+
end</sourcecode>
|
381
|
+
</sections>
|
382
|
+
</iso-standard>
|
383
|
+
OUTPUT
|
384
|
+
end
|
385
|
+
|
386
|
+
it "processes callouts" do
|
387
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
388
|
+
#{ASCIIDOC_BLANK_HDR}
|
389
|
+
[source,ruby]
|
390
|
+
--
|
391
|
+
puts "Hello, world." <1>
|
392
|
+
%w{a b c}.each do |x|
|
393
|
+
puts x <2>
|
394
|
+
end
|
395
|
+
--
|
396
|
+
<1> This is one callout
|
397
|
+
<2> This is another callout
|
398
|
+
INPUT
|
399
|
+
#{BLANK_HDR}
|
400
|
+
<sections><sourcecode id="_">puts "Hello, world." <callout target="_">1</callout>
|
401
|
+
%w{a b c}.each do |x|
|
402
|
+
puts x <callout target="_">2</callout>
|
403
|
+
end<annotation id="_">
|
404
|
+
<p id="_">This is one callout</p>
|
405
|
+
</annotation><annotation id="_">
|
406
|
+
<p id="_">This is another callout</p>
|
407
|
+
</annotation></sourcecode>
|
408
|
+
</sections>
|
409
|
+
</iso-standard>
|
410
|
+
OUTPUT
|
411
|
+
end
|
412
|
+
|
413
|
+
it "processes unmodified term sources" do
|
414
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
415
|
+
#{ASCIIDOC_BLANK_HDR}
|
416
|
+
== Terms and Definitions
|
417
|
+
|
418
|
+
=== Term1
|
419
|
+
|
420
|
+
[.source]
|
421
|
+
<<ISO2191,section=1>>
|
422
|
+
INPUT
|
423
|
+
#{BLANK_HDR}
|
424
|
+
<sections>
|
425
|
+
<terms id="_" obligation="normative">
|
426
|
+
<title>Terms and definitions</title>
|
427
|
+
<term id="_">
|
428
|
+
<preferred>Term1</preferred>
|
429
|
+
<termsource status="identical">
|
430
|
+
<origin bibitemid="ISO2191" type="inline" citeas=""><locality type="section"><referenceFrom>1</referenceFrom></locality></origin>
|
431
|
+
</termsource>
|
432
|
+
</term>
|
433
|
+
</terms>
|
434
|
+
</sections>
|
435
|
+
</iso-standard>
|
436
|
+
OUTPUT
|
437
|
+
end
|
438
|
+
|
439
|
+
it "processes modified term sources" do
|
440
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
441
|
+
#{ASCIIDOC_BLANK_HDR}
|
442
|
+
== Terms and Definitions
|
443
|
+
|
444
|
+
=== Term1
|
445
|
+
|
446
|
+
[.source]
|
447
|
+
<<ISO2191,section=1>>, with adjustments
|
448
|
+
INPUT
|
449
|
+
#{BLANK_HDR}
|
450
|
+
<sections>
|
451
|
+
<terms id="_" obligation="normative">
|
452
|
+
<title>Terms and definitions</title>
|
453
|
+
<term id="_">
|
454
|
+
<preferred>Term1</preferred>
|
455
|
+
<termsource status="modified">
|
456
|
+
<origin bibitemid="ISO2191" type="inline" citeas=""><locality type="section"><referenceFrom>1</referenceFrom></locality></origin>
|
457
|
+
<modification>
|
458
|
+
<p id="_">with adjustments</p>
|
459
|
+
</modification>
|
460
|
+
</termsource>
|
461
|
+
</term>
|
462
|
+
</terms>
|
463
|
+
</sections>
|
464
|
+
</iso-standard>
|
465
|
+
OUTPUT
|
466
|
+
end
|
467
|
+
|
468
|
+
|
469
|
+
end
|