metanorma-iec 1.2.17 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +12 -11
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +3 -7
  5. data/lib/asciidoctor/iec/biblio.rng +1 -0
  6. data/lib/asciidoctor/iec/front.rb +11 -5
  7. data/lib/asciidoctor/iec/iec.rng +4 -0
  8. data/lib/asciidoctor/iec/iec_intro_en.xml +1 -1
  9. data/lib/asciidoctor/iec/isodoc.rng +321 -4
  10. data/lib/asciidoctor/iec/isostandard.rng +12 -0
  11. data/lib/isodoc/iec/html/htmlstyle.css +7 -0
  12. data/lib/isodoc/iec/html_convert.rb +0 -1
  13. data/lib/isodoc/iec/iec.international-standard.xsl +503 -67
  14. data/lib/metanorma/iec/version.rb +1 -1
  15. data/metanorma-iec.gemspec +4 -4
  16. data/spec/asciidoctor/base_spec.rb +1062 -0
  17. data/spec/{asciidoctor-iec → asciidoctor}/blocks_spec.rb +214 -154
  18. data/spec/{asciidoctor-iec → asciidoctor}/cleanup_spec.rb +0 -0
  19. data/spec/{asciidoctor-iec → asciidoctor}/iev_spec.rb +0 -0
  20. data/spec/{asciidoctor-iec → asciidoctor}/inline_spec.rb +0 -0
  21. data/spec/{asciidoctor-iec → asciidoctor}/lists_spec.rb +0 -0
  22. data/spec/{asciidoctor-iec → asciidoctor}/section_spec.rb +0 -38
  23. data/spec/{asciidoctor-iec → asciidoctor}/validate_spec.rb +0 -0
  24. data/spec/isodoc/postproc_spec.rb +2 -20
  25. metadata +44 -53
  26. data/spec/asciidoctor-iec/base_spec.rb +0 -1045
  27. data/spec/examples/rice.adoc +0 -723
  28. data/spec/examples/rice.doc +0 -19162
  29. data/spec/examples/rice.html +0 -1787
  30. data/spec/examples/rice.xml +0 -1951
  31. data/spec/examples/rice_img/rice_image1.png +0 -0
  32. data/spec/examples/rice_img/rice_image2.png +0 -0
  33. data/spec/examples/rice_img/rice_image3_1.png +0 -0
  34. data/spec/examples/rice_img/rice_image3_2.png +0 -0
  35. data/spec/examples/rice_img/rice_image3_3.png +0 -0
@@ -1,12 +1,14 @@
1
1
  require "spec_helper"
2
2
 
3
+ OPTIONS = [backend: :iec, header_footer: true].freeze
4
+
3
5
  RSpec.describe Asciidoctor::Iec do
4
6
  before(:all) do
5
- @blank_hdr = blank_hdr_gen
6
- end
7
+ @blank_hdr = blank_hdr_gen
8
+ end
7
9
 
8
10
  it "processes open blocks" do
9
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
11
+ input = <<~INPUT
10
12
  #{ASCIIDOC_BLANK_HDR}
11
13
  --
12
14
  x
@@ -16,21 +18,24 @@ end
16
18
  z
17
19
  --
18
20
  INPUT
19
- #{@blank_hdr}
20
- <sections><p id="_">x</p>
21
- <p id="_">y</p>
22
- <p id="_">z</p></sections>
23
- </iec-standard>
21
+ output = <<~OUTPUT
22
+ #{@blank_hdr}
23
+ <sections><p id="_">x</p>
24
+ <p id="_">y</p>
25
+ <p id="_">z</p></sections>
26
+ </iec-standard>
24
27
  OUTPUT
28
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
29
+ .to be_equivalent_to xmlpp(output)
25
30
  end
26
31
 
27
32
  it "processes stem blocks" do
28
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
33
+ input = <<~INPUT
29
34
  #{ASCIIDOC_BLANK_HDR}
30
35
  [stem]
31
36
  ++++
32
- r = 1 %
33
- r = 1 %
37
+ r = 1 %#{' '}
38
+ r = 1 %#{' '}
34
39
  ++++
35
40
 
36
41
  [stem]
@@ -38,22 +43,25 @@ end
38
43
  <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">&#x0391;</mml:mi> </mml:mrow> </mml:mrow> </mml:msub> </mml:math>
39
44
  ++++
40
45
  INPUT
41
- #{@blank_hdr}
42
- <sections>
43
- <formula id="_">
44
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi></math></stem>
45
- </formula>
46
-
47
- <formula id="_">
48
- <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>
49
- </formula>
50
- </sections>
51
- </iec-standard>
46
+ output = <<~OUTPUT
47
+ #{@blank_hdr}
48
+ <sections>
49
+ <formula id="_">
50
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi></math></stem>
51
+ </formula>
52
+
53
+ <formula id="_">
54
+ <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>
55
+ </formula>
56
+ </sections>
57
+ </iec-standard>
52
58
  OUTPUT
59
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
60
+ .to be_equivalent_to xmlpp(output)
53
61
  end
54
62
 
55
- it "ignores review blocks unless document is in draft mode" do
56
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
63
+ it "ignores review blocks unless document is in draft mode" do
64
+ input = <<~INPUT
57
65
  #{ASCIIDOC_BLANK_HDR}
58
66
  [[foreword]]
59
67
  .Foreword
@@ -65,16 +73,19 @@ end
65
73
 
66
74
  For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
67
75
  ****
68
- INPUT
69
- #{@blank_hdr}
70
- <sections><p id="foreword">Foreword</p>
71
- </sections>
72
- </iec-standard>
73
- OUTPUT
74
- end
76
+ INPUT
77
+ output = <<~OUTPUT
78
+ #{@blank_hdr}
79
+ <sections><p id="foreword">Foreword</p>
80
+ </sections>
81
+ </iec-standard>
82
+ OUTPUT
83
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
84
+ .to be_equivalent_to xmlpp(output)
85
+ end
75
86
 
76
87
  it "processes review blocks if document is in draft mode" do
77
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)).sub(/^.+<sections>/m, "<sections>").sub(%r{</sections>.*$}m, "</sections>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
88
+ input = <<~INPUT
78
89
  = Document title
79
90
  Author
80
91
  :docfile: test.adoc
@@ -93,80 +104,94 @@ end
93
104
 
94
105
  For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
95
106
  ****
96
- INPUT
107
+ INPUT
108
+ output = <<~OUTPUT
97
109
  <sections>
98
110
  <p id="foreword">Foreword</p>
99
111
  <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
112
  <p id="_">For further information on the Foreword, see <strong>ISO/IEC Directives, Part 2, 2016, Clause 12.</strong></p></review></sections>
101
113
 
102
- OUTPUT
114
+ OUTPUT
115
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))
116
+ .sub(/^.+<sections>/m, "<sections>")
117
+ .sub(%r{</sections>.*$}m, "</sections>")))
118
+ .to be_equivalent_to xmlpp(output)
103
119
  end
104
120
 
105
121
  it "processes term notes" do
106
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
122
+ input = <<~INPUT
107
123
  #{ASCIIDOC_BLANK_HDR}
108
124
  == Terms and Definitions
109
125
 
110
126
  === Term1
111
127
 
112
128
  NOTE: This is a note
113
- INPUT
114
- #{@blank_hdr}
115
- <sections>
116
- <terms id="_" obligation="normative">
117
- <title>Terms and definitions</title>
118
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
119
- #{TERMS_BOILERPLATE}
120
- <term id="term-term1">
121
- <preferred>Term1</preferred>
122
- <termnote id="_">
123
- <p id="_">This is a note</p>
124
- </termnote>
125
- </term>
126
- </terms>
127
- </sections>
128
- </iec-standard>
129
- OUTPUT
129
+ INPUT
130
+ output = <<~OUTPUT
131
+ #{@blank_hdr}
132
+ <sections>
133
+ <terms id="_" obligation="normative">
134
+ <title>Terms and definitions</title>
135
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
136
+ #{TERMS_BOILERPLATE}
137
+ <term id="term-term1">
138
+ <preferred>Term1</preferred>
139
+ <termnote id="_">
140
+ <p id="_">This is a note</p>
141
+ </termnote>
142
+ </term>
143
+ </terms>
144
+ </sections>
145
+ </iec-standard>
146
+ OUTPUT
147
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
148
+ .to be_equivalent_to xmlpp(output)
130
149
  end
131
150
 
132
- it "processes notes" do
133
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
151
+ it "processes notes" do
152
+ input = <<~INPUT
134
153
  #{ASCIIDOC_BLANK_HDR}
135
154
  NOTE: This is a note
136
- INPUT
137
- #{@blank_hdr}
138
- <sections>
139
- <note id="_">
140
- <p id="_">This is a note</p>
141
- </note>
142
- </sections>
143
- </iec-standard>
144
-
145
- OUTPUT
146
- end
155
+ INPUT
156
+ output = <<~OUTPUT
157
+ #{@blank_hdr}
158
+ <sections>
159
+ <note id="_">
160
+ <p id="_">This is a note</p>
161
+ </note>
162
+ </sections>
163
+ </iec-standard>
164
+ OUTPUT
165
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
166
+ .to be_equivalent_to xmlpp(output)
167
+ end
147
168
 
148
- it "processes literals" do
149
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
169
+ it "processes literals" do
170
+ input = <<~INPUT
150
171
  #{ASCIIDOC_BLANK_HDR}
151
172
  ....
152
173
  LITERAL
153
174
  ....
154
- INPUT
155
- #{@blank_hdr}
156
- <sections>
157
- <figure id="_">
158
- <pre id="_">LITERAL</pre>
159
- </figure>
160
- </sections>
161
- </iec-standard>
162
- OUTPUT
163
- end
164
-
165
- it "processes simple admonitions with Asciidoc names" do
166
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
175
+ INPUT
176
+ output = <<~OUTPUT
177
+ #{@blank_hdr}
178
+ <sections>
179
+ <figure id="_">
180
+ <pre id="_">LITERAL</pre>
181
+ </figure>
182
+ </sections>
183
+ </iec-standard>
184
+ OUTPUT
185
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
186
+ .to be_equivalent_to xmlpp(output)
187
+ end
188
+
189
+ it "processes simple admonitions with Asciidoc names" do
190
+ input = <<~INPUT
167
191
  #{ASCIIDOC_BLANK_HDR}
168
192
  CAUTION: Only use paddy or parboiled rice for the determination of husked rice yield.
169
- INPUT
193
+ INPUT
194
+ output = <<~OUTPUT
170
195
  #{@blank_hdr}
171
196
  <sections>
172
197
  <admonition id="_" type="caution">
@@ -174,13 +199,13 @@ end
174
199
  </admonition>
175
200
  </sections>
176
201
  </iec-standard>
202
+ OUTPUT
203
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
204
+ .to be_equivalent_to xmlpp(output)
205
+ end
177
206
 
178
- OUTPUT
179
- end
180
-
181
-
182
- it "processes complex admonitions with non-Asciidoc names" do
183
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
207
+ it "processes complex admonitions with non-Asciidoc names" do
208
+ input = <<~INPUT
184
209
  #{ASCIIDOC_BLANK_HDR}
185
210
  [CAUTION,type=Safety Precautions]
186
211
  .Safety Precautions
@@ -191,7 +216,8 @@ end
191
216
  . More than two glasses of orange juice in 24 hours makes them howl in harmony with alarms and sirens.
192
217
  . Celery makes them sad.
193
218
  ====
194
- INPUT
219
+ INPUT
220
+ output = <<~OUTPUT
195
221
  #{@blank_hdr}
196
222
  <sections>
197
223
  <admonition id="_" type="safety precautions"><name>Safety Precautions</name><p id="_">While werewolves are hardy community members, keep in mind the following dietary concerns:</p>
@@ -208,12 +234,13 @@ end
208
234
  </ol></admonition>
209
235
  </sections>
210
236
  </iec-standard>
237
+ OUTPUT
238
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
239
+ .to be_equivalent_to xmlpp(output)
240
+ end
211
241
 
212
- OUTPUT
213
- end
214
-
215
- it "processes term examples" do
216
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
242
+ it "processes term examples" do
243
+ input = <<~INPUT
217
244
  #{ASCIIDOC_BLANK_HDR}
218
245
  == Terms and Definitions
219
246
 
@@ -221,7 +248,8 @@ end
221
248
 
222
249
  [example]
223
250
  This is an example
224
- INPUT
251
+ INPUT
252
+ output = <<~OUTPUT
225
253
  #{@blank_hdr}
226
254
  <sections>
227
255
  <terms id="_" obligation="normative">
@@ -237,12 +265,13 @@ end
237
265
  </terms>
238
266
  </sections>
239
267
  </iec-standard>
268
+ OUTPUT
269
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
270
+ .to be_equivalent_to xmlpp(output)
271
+ end
240
272
 
241
- OUTPUT
242
- end
243
-
244
- it "processes examples" do
245
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
273
+ it "processes examples" do
274
+ input = <<~INPUT
246
275
  #{ASCIIDOC_BLANK_HDR}
247
276
  [example]
248
277
  ====
@@ -250,23 +279,27 @@ end
250
279
 
251
280
  Amen
252
281
  ====
253
- INPUT
282
+ INPUT
283
+ output = <<~OUTPUT
254
284
  #{@blank_hdr}
255
285
  <sections>
256
286
  <example id="_"><p id="_">This is an example</p>
257
287
  <p id="_">Amen</p></example>
258
288
  </sections>
259
289
  </iec-standard>
260
- OUTPUT
261
- end
290
+ OUTPUT
291
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
292
+ .to be_equivalent_to xmlpp(output)
293
+ end
262
294
 
263
- it "processes preambles" do
264
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
295
+ it "processes preambles" do
296
+ input = <<~INPUT
265
297
  #{ASCIIDOC_BLANK_HDR}
266
298
  This is a preamble
267
299
 
268
300
  == Section 1
269
- INPUT
301
+ INPUT
302
+ output = <<~OUTPUT
270
303
  #{@blank_hdr}
271
304
  <preface><foreword id="_" obligation="informative">
272
305
  <title>FOREWORD</title>
@@ -276,16 +309,19 @@ end
276
309
  <title>Section 1</title>
277
310
  </clause></sections>
278
311
  </iec-standard>
279
- OUTPUT
280
- end
312
+ OUTPUT
313
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
314
+ .to be_equivalent_to xmlpp(output)
315
+ end
281
316
 
282
- it "processes images" do
283
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
317
+ it "processes images" do
318
+ input = <<~INPUT
284
319
  #{ASCIIDOC_BLANK_HDR}
285
320
  .Split-it-right sample divider
286
321
  image::spec/examples/rice_images/rice_image1.png[]
287
322
 
288
- INPUT
323
+ INPUT
324
+ output = <<~OUTPUT
289
325
  #{@blank_hdr}
290
326
  <sections>
291
327
  <figure id="_">
@@ -294,16 +330,19 @@ end
294
330
  </figure>
295
331
  </sections>
296
332
  </iec-standard>
297
- OUTPUT
298
- end
333
+ OUTPUT
334
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
335
+ .to be_equivalent_to xmlpp(output)
336
+ end
299
337
 
300
- it "accepts width and height attributes on images" do
301
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
338
+ it "accepts width and height attributes on images" do
339
+ input = <<~INPUT
302
340
  #{ASCIIDOC_BLANK_HDR}
303
341
  [height=4,width=3]
304
342
  image::spec/examples/rice_images/rice_image1.png[]
305
343
 
306
- INPUT
344
+ INPUT
345
+ output = <<~OUTPUT
307
346
  #{@blank_hdr}
308
347
  <sections>
309
348
  <figure id="_">
@@ -311,16 +350,19 @@ end
311
350
  </figure>
312
351
  </sections>
313
352
  </iec-standard>
314
- OUTPUT
315
- end
353
+ OUTPUT
354
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
355
+ .to be_equivalent_to xmlpp(output)
356
+ end
316
357
 
317
- it "accepts auto for width and height attributes on images" do
318
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
358
+ it "accepts auto for width and height attributes on images" do
359
+ input = <<~INPUT
319
360
  #{ASCIIDOC_BLANK_HDR}
320
361
  [height=4,width=auto]
321
362
  image::spec/examples/rice_images/rice_image1.png[]
322
363
 
323
- INPUT
364
+ INPUT
365
+ output = <<~OUTPUT
324
366
  #{@blank_hdr}
325
367
  <sections>
326
368
  <figure id="_">
@@ -328,31 +370,37 @@ end
328
370
  </figure>
329
371
  </sections>
330
372
  </iec-standard>
331
- OUTPUT
332
- end
373
+ OUTPUT
374
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
375
+ .to be_equivalent_to xmlpp(output)
376
+ end
333
377
 
334
- it "accepts alignment attribute on paragraphs" do
335
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
378
+ it "accepts alignment attribute on paragraphs" do
379
+ input = <<~INPUT
336
380
  #{ASCIIDOC_BLANK_HDR}
337
381
  [align=right]
338
382
  This para is right-aligned.
339
- INPUT
383
+ INPUT
384
+ output = <<~OUTPUT
340
385
  #{@blank_hdr}
341
386
  <sections>
342
387
  <p align="right" id="_">This para is right-aligned.</p>
343
388
  </sections>
344
389
  </iec-standard>
345
- OUTPUT
346
- end
390
+ OUTPUT
391
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
392
+ .to be_equivalent_to xmlpp(output)
393
+ end
347
394
 
348
- it "processes blockquotes" do
349
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
395
+ it "processes blockquotes" do
396
+ input = <<~INPUT
350
397
  #{ASCIIDOC_BLANK_HDR}
351
398
  [quote, ISO, "ISO7301,section 1"]
352
399
  ____
353
400
  Block quotation
354
401
  ____
355
- INPUT
402
+ INPUT
403
+ output = <<~OUTPUT
356
404
  #{@blank_hdr}
357
405
  <sections>
358
406
  <quote id="_">
@@ -362,11 +410,13 @@ end
362
410
  </quote>
363
411
  </sections>
364
412
  </iec-standard>
365
- OUTPUT
366
- end
413
+ OUTPUT
414
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
415
+ .to be_equivalent_to xmlpp(output)
416
+ end
367
417
 
368
- it "processes source code" do
369
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
418
+ it "processes source code" do
419
+ input = <<~INPUT
370
420
  #{ASCIIDOC_BLANK_HDR}
371
421
  [source,ruby]
372
422
  --
@@ -375,7 +425,8 @@ end
375
425
  puts x
376
426
  end
377
427
  --
378
- INPUT
428
+ INPUT
429
+ output = <<~OUTPUT
379
430
  #{@blank_hdr}
380
431
  <sections>
381
432
  <sourcecode lang="ruby" id="_">puts "Hello, world."
@@ -384,11 +435,13 @@ end
384
435
  end</sourcecode>
385
436
  </sections>
386
437
  </iec-standard>
387
- OUTPUT
388
- end
438
+ OUTPUT
439
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
440
+ .to be_equivalent_to xmlpp(output)
441
+ end
389
442
 
390
- it "processes callouts" do
391
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
443
+ it "processes callouts" do
444
+ input = <<~INPUT
392
445
  #{ASCIIDOC_BLANK_HDR}
393
446
  [source,ruby]
394
447
  --
@@ -399,7 +452,8 @@ end
399
452
  --
400
453
  <1> This is one callout
401
454
  <2> This is another callout
402
- INPUT
455
+ INPUT
456
+ output = <<~OUTPUT
403
457
  #{@blank_hdr}
404
458
  <sections><sourcecode lang="ruby" id="_">puts "Hello, world." <callout target="_">1</callout>
405
459
  %w{a b c}.each do |x|
@@ -411,11 +465,13 @@ end
411
465
  </annotation></sourcecode>
412
466
  </sections>
413
467
  </iec-standard>
414
- OUTPUT
415
- end
468
+ OUTPUT
469
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
470
+ .to be_equivalent_to xmlpp(output)
471
+ end
416
472
 
417
- it "processes unmodified term sources" do
418
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
473
+ it "processes unmodified term sources" do
474
+ input = <<~INPUT
419
475
  #{ASCIIDOC_BLANK_HDR}
420
476
  == Terms and Definitions
421
477
 
@@ -423,7 +479,8 @@ end
423
479
 
424
480
  [.source]
425
481
  <<ISO2191,section=1>>
426
- INPUT
482
+ INPUT
483
+ output = <<~OUTPUT
427
484
  #{@blank_hdr}
428
485
  <sections>
429
486
  <terms id="_" obligation="normative">
@@ -443,11 +500,13 @@ end
443
500
  </terms>
444
501
  </sections>
445
502
  </iec-standard>
446
- OUTPUT
447
- end
503
+ OUTPUT
504
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
505
+ .to be_equivalent_to xmlpp(output)
506
+ end
448
507
 
449
- it "processes modified term sources" do
450
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
508
+ it "processes modified term sources" do
509
+ input = <<~INPUT
451
510
  #{ASCIIDOC_BLANK_HDR}
452
511
  == Terms and Definitions
453
512
 
@@ -455,7 +514,8 @@ end
455
514
 
456
515
  [.source]
457
516
  <<ISO2191,section=1>>, with adjustments
458
- INPUT
517
+ INPUT
518
+ output = <<~OUTPUT
459
519
  #{@blank_hdr}
460
520
  <sections>
461
521
  <terms id="_" obligation="normative">
@@ -478,8 +538,8 @@ end
478
538
  </terms>
479
539
  </sections>
480
540
  </iec-standard>
481
- OUTPUT
482
- end
483
-
484
-
541
+ OUTPUT
542
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
543
+ .to be_equivalent_to xmlpp(output)
544
+ end
485
545
  end