metanorma-iso 1.8.1 → 1.8.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -13
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -8
  5. data/lib/asciidoctor/iso/base.rb +1 -0
  6. data/lib/asciidoctor/iso/biblio.rng +1 -0
  7. data/lib/asciidoctor/iso/cleanup.rb +17 -5
  8. data/lib/asciidoctor/iso/front.rb +3 -1
  9. data/lib/asciidoctor/iso/front_id.rb +66 -50
  10. data/lib/asciidoctor/iso/isodoc.rng +209 -4
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +12 -0
  13. data/lib/asciidoctor/iso/section.rb +2 -1
  14. data/lib/asciidoctor/iso/validate_section.rb +16 -9
  15. data/lib/isodoc/iso/base_convert.rb +13 -13
  16. data/lib/isodoc/iso/html/isodoc.css +475 -20
  17. data/lib/isodoc/iso/html/isodoc.scss +456 -23
  18. data/lib/isodoc/iso/html/wordstyle.css +202 -31
  19. data/lib/isodoc/iso/html/wordstyle.scss +194 -32
  20. data/lib/isodoc/iso/iso.amendment.xsl +679 -473
  21. data/lib/isodoc/iso/iso.international-standard.xsl +679 -473
  22. data/lib/isodoc/iso/metadata.rb +3 -2
  23. data/lib/isodoc/iso/presentation_xml_convert.rb +18 -9
  24. data/lib/isodoc/iso/sts_convert.rb +10 -13
  25. data/lib/isodoc/iso/word_convert.rb +153 -39
  26. data/lib/isodoc/iso/xref.rb +42 -27
  27. data/lib/metanorma/iso/version.rb +1 -1
  28. data/metanorma-iso.gemspec +4 -4
  29. data/spec/asciidoctor/base_spec.rb +426 -334
  30. data/spec/asciidoctor/blocks_spec.rb +96 -34
  31. data/spec/asciidoctor/cleanup_spec.rb +383 -25
  32. data/spec/asciidoctor/section_spec.rb +0 -14
  33. data/spec/asciidoctor/validate_spec.rb +119 -39
  34. data/spec/isodoc/amd_spec.rb +193 -201
  35. data/spec/isodoc/blocks_spec.rb +100 -88
  36. data/spec/isodoc/i18n_spec.rb +36 -36
  37. data/spec/isodoc/inline_spec.rb +282 -2
  38. data/spec/isodoc/iso_spec.rb +86 -138
  39. data/spec/isodoc/postproc_spec.rb +492 -442
  40. data/spec/isodoc/ref_spec.rb +6 -6
  41. data/spec/isodoc/section_spec.rb +301 -306
  42. data/spec/isodoc/table_spec.rb +166 -231
  43. data/spec/isodoc/terms_spec.rb +11 -8
  44. data/spec/isodoc/xref_spec.rb +147 -118
  45. data/spec/spec_helper.rb +16 -15
  46. metadata +9 -9
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe Asciidoctor::ISO do
4
4
  it "processes open blocks" do
5
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ input = <<~INPUT
6
6
  #{ASCIIDOC_BLANK_HDR}
7
7
  --
8
8
  x
@@ -12,6 +12,7 @@ RSpec.describe Asciidoctor::ISO do
12
12
  z
13
13
  --
14
14
  INPUT
15
+ output = <<~OUTPUT
15
16
  #{BLANK_HDR}
16
17
  <sections>
17
18
  <p id="_">x</p>
@@ -20,10 +21,12 @@ RSpec.describe Asciidoctor::ISO do
20
21
  </sections>
21
22
  </iso-standard>
22
23
  OUTPUT
24
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
25
+ .to be_equivalent_to xmlpp(output)
23
26
  end
24
27
 
25
28
  it "processes stem blocks" do
26
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
29
+ input = <<~INPUT
27
30
  #{ASCIIDOC_BLANK_HDR}
28
31
  [stem]
29
32
  ++++
@@ -36,6 +39,7 @@ RSpec.describe Asciidoctor::ISO do
36
39
  <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>
37
40
  ++++
38
41
  INPUT
42
+ output = <<~OUTPUT
39
43
  #{BLANK_HDR}
40
44
  <sections>
41
45
  <formula id="_">
@@ -73,10 +77,12 @@ RSpec.describe Asciidoctor::ISO do
73
77
  </sections>
74
78
  </iso-standard>
75
79
  OUTPUT
80
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
81
+ .to be_equivalent_to xmlpp(output)
76
82
  end
77
83
 
78
84
  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")
85
+ input = <<~INPUT
80
86
  #{ASCIIDOC_BLANK_HDR}
81
87
  [[foreword]]
82
88
  .Foreword
@@ -89,16 +95,19 @@ RSpec.describe Asciidoctor::ISO do
89
95
  For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
90
96
  ****
91
97
  INPUT
98
+ output = <<~OUTPUT
92
99
  #{BLANK_HDR}
93
100
  <sections>
94
101
  <p id="foreword">Foreword</p>
95
102
  </sections>
96
103
  </iso-standard>
97
104
  OUTPUT
105
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
106
+ .to be_equivalent_to xmlpp(output)
98
107
  end
99
108
 
100
109
  it "processes review blocks if document is in draft mode" do
101
- output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
110
+ input = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
102
111
  = Document title
103
112
  Author
104
113
  :docfile: test.adoc
@@ -118,23 +127,25 @@ RSpec.describe Asciidoctor::ISO do
118
127
  For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
119
128
  ****
120
129
  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
130
+ output = <<~OUTPUT
131
+ <iso-standard>
132
+ <sections>
133
+ <p id="foreword">Foreword</p>
134
+ <review date="20170101T00:00:00Z" from="foreword" id="_" reviewer="ISO" to="foreword">
135
+ <p id="_">A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.</p>
136
+ <p id="_">For further information on the Foreword, see#{' '}
137
+ <strong>ISO/IEC Directives, Part 2, 2016, Clause 12.</strong></p>
138
+ </review>
139
+ </sections>
140
+ </iso-standard>
141
+ OUTPUT
142
+ expect(xmlpp(strip_guid(input)
143
+ .sub(/^.+<sections>/m, "<iso-standard><sections>")))
144
+ .to be_equivalent_to xmlpp(output)
134
145
  end
135
146
 
136
147
  it "processes term notes" do
137
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
148
+ input = <<~INPUT
138
149
  #{ASCIIDOC_BLANK_HDR}
139
150
  == Terms and Definitions
140
151
 
@@ -142,6 +153,7 @@ RSpec.describe Asciidoctor::ISO do
142
153
 
143
154
  NOTE: This is a note
144
155
  INPUT
156
+ output = <<~OUTPUT
145
157
  #{BLANK_HDR}
146
158
  <sections>
147
159
  <terms id="_" obligation="normative">
@@ -156,13 +168,16 @@ RSpec.describe Asciidoctor::ISO do
156
168
  </sections>
157
169
  </iso-standard>
158
170
  OUTPUT
171
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
172
+ .to be_equivalent_to xmlpp(output)
159
173
  end
160
174
 
161
175
  it "processes notes" do
162
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
176
+ input = <<~INPUT
163
177
  #{ASCIIDOC_BLANK_HDR}
164
178
  NOTE: This is a note
165
179
  INPUT
180
+ output = <<~OUTPUT
166
181
  #{BLANK_HDR}
167
182
  <sections>
168
183
  <note id="_">
@@ -171,15 +186,18 @@ RSpec.describe Asciidoctor::ISO do
171
186
  </sections>
172
187
  </iso-standard>
173
188
  OUTPUT
189
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
190
+ .to be_equivalent_to xmlpp(output)
174
191
  end
175
192
 
176
193
  it "processes literals" do
177
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
194
+ input = <<~INPUT
178
195
  #{ASCIIDOC_BLANK_HDR}
179
196
  ....
180
197
  LITERAL
181
198
  ....
182
199
  INPUT
200
+ output = <<~OUTPUT
183
201
  #{BLANK_HDR}
184
202
  <sections>
185
203
  <figure id="_">
@@ -188,13 +206,16 @@ RSpec.describe Asciidoctor::ISO do
188
206
  </sections>
189
207
  </iso-standard>
190
208
  OUTPUT
209
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
210
+ .to be_equivalent_to xmlpp(output)
191
211
  end
192
212
 
193
213
  it "processes simple admonitions with Asciidoc names" do
194
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
214
+ input = <<~INPUT
195
215
  #{ASCIIDOC_BLANK_HDR}
196
216
  CAUTION: Only use paddy or parboiled rice for the determination of husked rice yield.
197
217
  INPUT
218
+ output = <<~OUTPUT
198
219
  #{BLANK_HDR}
199
220
  <sections>
200
221
  <admonition id="_" type="caution">
@@ -203,10 +224,12 @@ RSpec.describe Asciidoctor::ISO do
203
224
  </sections>
204
225
  </iso-standard>
205
226
  OUTPUT
227
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
228
+ .to be_equivalent_to xmlpp(output)
206
229
  end
207
230
 
208
231
  it "processes complex admonitions with non-Asciidoc names" do
209
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
232
+ input = <<~INPUT
210
233
  #{ASCIIDOC_BLANK_HDR}
211
234
  [CAUTION,type=Safety Precautions]
212
235
  .Safety Precautions
@@ -218,6 +241,7 @@ RSpec.describe Asciidoctor::ISO do
218
241
  . Celery makes them sad.
219
242
  ====
220
243
  INPUT
244
+ output = <<~OUTPUT
221
245
  #{BLANK_HDR}
222
246
  <sections>
223
247
  <admonition id="_" type="safety precautions">
@@ -238,10 +262,12 @@ RSpec.describe Asciidoctor::ISO do
238
262
  </sections>
239
263
  </iso-standard>
240
264
  OUTPUT
265
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
266
+ .to be_equivalent_to xmlpp(output)
241
267
  end
242
268
 
243
269
  it "processes term examples" do
244
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
270
+ input = <<~INPUT
245
271
  #{ASCIIDOC_BLANK_HDR}
246
272
  == Terms and Definitions
247
273
 
@@ -250,6 +276,7 @@ RSpec.describe Asciidoctor::ISO do
250
276
  [example]
251
277
  This is an example
252
278
  INPUT
279
+ output = <<~OUTPUT
253
280
  #{BLANK_HDR}
254
281
  <sections>
255
282
  <terms id="_" obligation="normative">
@@ -264,10 +291,12 @@ RSpec.describe Asciidoctor::ISO do
264
291
  </sections>
265
292
  </iso-standard>
266
293
  OUTPUT
294
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
295
+ .to be_equivalent_to xmlpp(output)
267
296
  end
268
297
 
269
298
  it "processes examples" do
270
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
299
+ input = <<~INPUT
271
300
  #{ASCIIDOC_BLANK_HDR}
272
301
  [example]
273
302
  ====
@@ -276,6 +305,7 @@ RSpec.describe Asciidoctor::ISO do
276
305
  Amen
277
306
  ====
278
307
  INPUT
308
+ output = <<~OUTPUT
279
309
  #{BLANK_HDR}
280
310
  <sections>
281
311
  <example id="_">
@@ -285,15 +315,18 @@ RSpec.describe Asciidoctor::ISO do
285
315
  </sections>
286
316
  </iso-standard>
287
317
  OUTPUT
318
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
319
+ .to be_equivalent_to xmlpp(output)
288
320
  end
289
321
 
290
322
  it "processes preambles" do
291
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
323
+ input = <<~INPUT
292
324
  #{ASCIIDOC_BLANK_HDR}
293
325
  This is a preamble
294
326
 
295
327
  == Section 1
296
328
  INPUT
329
+ output = <<~OUTPUT
297
330
  #{BLANK_HDR}
298
331
  <preface>
299
332
  <foreword id="_" obligation="informative">
@@ -308,15 +341,18 @@ RSpec.describe Asciidoctor::ISO do
308
341
  </sections>
309
342
  </iso-standard>
310
343
  OUTPUT
344
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
345
+ .to be_equivalent_to xmlpp(output)
311
346
  end
312
347
 
313
348
  it "processes images" do
314
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
349
+ input = <<~INPUT
315
350
  #{ASCIIDOC_BLANK_HDR}
316
351
  .Split-it-right sample divider
317
352
  image::spec/examples/rice_images/rice_image1.png[]
318
353
 
319
354
  INPUT
355
+ output = <<~OUTPUT
320
356
  #{BLANK_HDR}
321
357
  <sections>
322
358
  <figure id="_">
@@ -326,15 +362,18 @@ RSpec.describe Asciidoctor::ISO do
326
362
  </sections>
327
363
  </iso-standard>
328
364
  OUTPUT
365
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
366
+ .to be_equivalent_to xmlpp(output)
329
367
  end
330
368
 
331
369
  it "accepts width and height attributes on images" do
332
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
370
+ input = <<~INPUT
333
371
  #{ASCIIDOC_BLANK_HDR}
334
372
  [height=4,width=3]
335
373
  image::spec/examples/rice_images/rice_image1.png[]
336
374
 
337
375
  INPUT
376
+ output = <<~OUTPUT
338
377
  #{BLANK_HDR}
339
378
  <sections>
340
379
  <figure id="_">
@@ -343,15 +382,18 @@ RSpec.describe Asciidoctor::ISO do
343
382
  </sections>
344
383
  </iso-standard>
345
384
  OUTPUT
385
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
386
+ .to be_equivalent_to xmlpp(output)
346
387
  end
347
388
 
348
389
  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")
390
+ input = <<~INPUT
350
391
  #{ASCIIDOC_BLANK_HDR}
351
392
  [height=4,width=auto]
352
393
  image::spec/examples/rice_images/rice_image1.png[]
353
394
 
354
395
  INPUT
396
+ output = <<~OUTPUT
355
397
  #{BLANK_HDR}
356
398
  <sections>
357
399
  <figure id="_">
@@ -360,30 +402,36 @@ RSpec.describe Asciidoctor::ISO do
360
402
  </sections>
361
403
  </iso-standard>
362
404
  OUTPUT
405
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
406
+ .to be_equivalent_to xmlpp(output)
363
407
  end
364
408
 
365
409
  it "accepts alignment attribute on paragraphs" do
366
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
410
+ input = <<~INPUT
367
411
  #{ASCIIDOC_BLANK_HDR}
368
412
  [align=right]
369
413
  This para is right-aligned.
370
414
  INPUT
415
+ output = <<~OUTPUT
371
416
  #{BLANK_HDR}
372
417
  <sections>
373
418
  <p align="right" id="_">This para is right-aligned.</p>
374
419
  </sections>
375
420
  </iso-standard>
376
421
  OUTPUT
422
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
423
+ .to be_equivalent_to xmlpp(output)
377
424
  end
378
425
 
379
426
  it "processes blockquotes" do
380
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
427
+ input = <<~INPUT
381
428
  #{ASCIIDOC_BLANK_HDR}
382
429
  [quote, ISO, "ISO7301,section 1"]
383
430
  ____
384
431
  Block quotation
385
432
  ____
386
433
  INPUT
434
+ output = <<~OUTPUT
387
435
  #{BLANK_HDR}
388
436
  <sections>
389
437
  <quote id="_">
@@ -400,10 +448,12 @@ RSpec.describe Asciidoctor::ISO do
400
448
  </sections>
401
449
  </iso-standard>
402
450
  OUTPUT
451
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
452
+ .to be_equivalent_to xmlpp(output)
403
453
  end
404
454
 
405
455
  it "processes source code" do
406
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
456
+ input = <<~INPUT
407
457
  #{ASCIIDOC_BLANK_HDR}
408
458
  [source,ruby]
409
459
  --
@@ -413,6 +463,7 @@ RSpec.describe Asciidoctor::ISO do
413
463
  end
414
464
  --
415
465
  INPUT
466
+ output = <<~OUTPUT
416
467
  #{BLANK_HDR}
417
468
  <sections>
418
469
  <sourcecode id="_" lang="ruby">
@@ -424,10 +475,12 @@ RSpec.describe Asciidoctor::ISO do
424
475
  </sections>
425
476
  </iso-standard>
426
477
  OUTPUT
478
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
479
+ .to be_equivalent_to xmlpp(output)
427
480
  end
428
481
 
429
482
  it "processes callouts" do
430
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
483
+ input = <<~INPUT
431
484
  #{ASCIIDOC_BLANK_HDR}
432
485
  [source,ruby]
433
486
  --
@@ -439,6 +492,7 @@ RSpec.describe Asciidoctor::ISO do
439
492
  <1> This is one callout
440
493
  <2> This is another callout
441
494
  INPUT
495
+ output = <<~OUTPUT
442
496
  #{BLANK_HDR}
443
497
  <sections>
444
498
  <sourcecode id="_" lang="ruby">
@@ -456,10 +510,12 @@ RSpec.describe Asciidoctor::ISO do
456
510
  </sections>
457
511
  </iso-standard>
458
512
  OUTPUT
513
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
514
+ .to be_equivalent_to xmlpp(output)
459
515
  end
460
516
 
461
517
  it "processes unmodified term sources" do
462
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
518
+ input = <<~INPUT
463
519
  #{ASCIIDOC_BLANK_HDR}
464
520
  == Terms and Definitions
465
521
 
@@ -468,6 +524,7 @@ RSpec.describe Asciidoctor::ISO do
468
524
  [.source]
469
525
  <<ISO2191,section=1>>
470
526
  INPUT
527
+ output = <<~OUTPUT
471
528
  #{BLANK_HDR}
472
529
  <sections>
473
530
  <terms id="_" obligation="normative">
@@ -488,10 +545,12 @@ RSpec.describe Asciidoctor::ISO do
488
545
  </sections>
489
546
  </iso-standard>
490
547
  OUTPUT
548
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
549
+ .to be_equivalent_to xmlpp(output)
491
550
  end
492
551
 
493
552
  it "processes modified term sources" do
494
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
553
+ input = <<~INPUT
495
554
  #{ASCIIDOC_BLANK_HDR}
496
555
  == Terms and Definitions
497
556
 
@@ -500,6 +559,7 @@ RSpec.describe Asciidoctor::ISO do
500
559
  [.source]
501
560
  <<ISO2191,section=1>>, with adjustments
502
561
  INPUT
562
+ output = <<~OUTPUT
503
563
  #{BLANK_HDR}
504
564
  <sections>
505
565
  <terms id="_" obligation="normative">
@@ -523,5 +583,7 @@ RSpec.describe Asciidoctor::ISO do
523
583
  </sections>
524
584
  </iso-standard>
525
585
  OUTPUT
586
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
587
+ .to be_equivalent_to xmlpp(output)
526
588
  end
527
589
  end
@@ -2,20 +2,23 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe Asciidoctor::ISO do
4
4
  it "removes empty text elements" do
5
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ input = <<~INPUT
6
6
  #{ASCIIDOC_BLANK_HDR}
7
7
  == {blank}
8
8
  INPUT
9
+ output = <<~OUTPUT
9
10
  #{BLANK_HDR}
10
11
  <sections>
11
12
  <clause id="_" inline-header="false" obligation="normative"/>
12
13
  </sections>
13
14
  </iso-standard>
14
15
  OUTPUT
16
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
17
+ .to be_equivalent_to xmlpp(output)
15
18
  end
16
19
 
17
20
  it "processes stem-only terms as admitted" do
18
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
21
+ input = <<~INPUT
19
22
  #{ASCIIDOC_BLANK_HDR}
20
23
  == Terms and Definitions
21
24
 
@@ -25,6 +28,7 @@ RSpec.describe Asciidoctor::ISO do
25
28
 
26
29
  Time
27
30
  INPUT
31
+ output = <<~OUTPUT
28
32
  #{BLANK_HDR}
29
33
  <sections>
30
34
  <terms id="_" obligation="normative">
@@ -66,10 +70,12 @@ RSpec.describe Asciidoctor::ISO do
66
70
  </sections>
67
71
  </iso-standard>
68
72
  OUTPUT
73
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
74
+ .to be_equivalent_to xmlpp(output)
69
75
  end
70
76
 
71
77
  it "moves term domains out of the term definition paragraph" do
72
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
78
+ input = <<~INPUT
73
79
  #{ASCIIDOC_BLANK_HDR}
74
80
  == Terms and Definitions
75
81
 
@@ -77,6 +83,7 @@ RSpec.describe Asciidoctor::ISO do
77
83
 
78
84
  domain:[relativity] Time
79
85
  INPUT
86
+ output = <<~OUTPUT
80
87
  #{BLANK_HDR}
81
88
  <sections>
82
89
  <terms id="_" obligation="normative">
@@ -92,10 +99,12 @@ RSpec.describe Asciidoctor::ISO do
92
99
  </sections>
93
100
  </iso-standard>
94
101
  OUTPUT
102
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
103
+ .to be_equivalent_to xmlpp(output)
95
104
  end
96
105
 
97
106
  it "permits multiple blocks in term definition paragraph" do
98
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
107
+ input = <<~INPUT
99
108
  = Document title
100
109
  Author
101
110
  :docfile: test.adoc
@@ -115,6 +124,7 @@ RSpec.describe Asciidoctor::ISO do
115
124
 
116
125
  This paragraph is extraneous
117
126
  INPUT
127
+ output = <<~OUTPUT
118
128
  #{BLANK_HDR}
119
129
  <sections>
120
130
  <terms id="_" obligation="normative">
@@ -156,10 +166,12 @@ RSpec.describe Asciidoctor::ISO do
156
166
  </sections>
157
167
  </iso-standard>
158
168
  OUTPUT
169
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
170
+ .to be_equivalent_to xmlpp(output)
159
171
  end
160
172
 
161
173
  it "keeps any initial boilerplate from terms and definitions" do
162
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
174
+ input = <<~INPUT
163
175
  #{ASCIIDOC_BLANK_HDR}
164
176
  == Terms and Definitions
165
177
 
@@ -171,6 +183,7 @@ RSpec.describe Asciidoctor::ISO do
171
183
 
172
184
  This paragraph is extraneous
173
185
  INPUT
186
+ output = <<~OUTPUT
174
187
  #{BLANK_HDR}
175
188
  <sections>
176
189
  <terms id="_" obligation="normative">
@@ -191,10 +204,12 @@ RSpec.describe Asciidoctor::ISO do
191
204
  </sections>
192
205
  </iso-standard>
193
206
  OUTPUT
207
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
208
+ .to be_equivalent_to xmlpp(output)
194
209
  end
195
210
 
196
211
  it "moves notes inside preceding blocks, if they are not at clause end, and the blocks are not delimited" do
197
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
212
+ input = <<~INPUT
198
213
  #{ASCIIDOC_BLANK_HDR}
199
214
  [stem]
200
215
  ++++
@@ -206,6 +221,7 @@ RSpec.describe Asciidoctor::ISO do
206
221
 
207
222
  Indeed.
208
223
  INPUT
224
+ output = <<~OUTPUT
209
225
  #{BLANK_HDR}
210
226
  <sections>
211
227
  <formula id="_">
@@ -229,10 +245,12 @@ RSpec.describe Asciidoctor::ISO do
229
245
  </sections>
230
246
  </iso-standard>
231
247
  OUTPUT
248
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
249
+ .to be_equivalent_to xmlpp(output)
232
250
  end
233
251
 
234
252
  it "does not move notes inside preceding blocks, if they are at clause end" do
235
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
253
+ input = <<~INPUT
236
254
  #{ASCIIDOC_BLANK_HDR}
237
255
  [source,ruby]
238
256
  [1...x].each do |y|
@@ -241,6 +259,7 @@ RSpec.describe Asciidoctor::ISO do
241
259
 
242
260
  NOTE: That loop does not do much
243
261
  INPUT
262
+ output = <<~OUTPUT
244
263
  #{BLANK_HDR}
245
264
  <sections>
246
265
  <sourcecode id="_" lang="ruby">[1...x].each do |y|
@@ -252,10 +271,12 @@ RSpec.describe Asciidoctor::ISO do
252
271
  </sections>
253
272
  </iso-standard>
254
273
  OUTPUT
274
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
275
+ .to be_equivalent_to xmlpp(output)
255
276
  end
256
277
 
257
278
  it "converts xrefs to references into erefs" do
258
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
279
+ input = <<~INPUT
259
280
  #{ASCIIDOC_BLANK_HDR}
260
281
  <<iso216>>
261
282
 
@@ -263,6 +284,7 @@ RSpec.describe Asciidoctor::ISO do
263
284
  == Normative References
264
285
  * [[[iso216,ISO 216:2001]]], _Reference_
265
286
  INPUT
287
+ output = <<~OUTPUT
266
288
  #{BLANK_HDR}
267
289
  <preface>
268
290
  <foreword id="_" obligation="informative">
@@ -297,10 +319,12 @@ RSpec.describe Asciidoctor::ISO do
297
319
  </bibliography>
298
320
  </iso-standard>
299
321
  OUTPUT
322
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
323
+ .to be_equivalent_to xmlpp(output)
300
324
  end
301
325
 
302
326
  it "extracts localities from erefs" do
303
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
327
+ input = <<~INPUT
304
328
  #{ASCIIDOC_BLANK_HDR}
305
329
  <<iso216,whole,clause=3,example=9-11,locality:prelude=33,locality:entirety:the reference>>
306
330
 
@@ -308,6 +332,7 @@ RSpec.describe Asciidoctor::ISO do
308
332
  == Normative References
309
333
  * [[[iso216,ISO 216]]], _Reference_
310
334
  INPUT
335
+ output = <<~OUTPUT
311
336
  #{BLANK_HDR}
312
337
  <preface>
313
338
  <foreword id="_" obligation="informative">
@@ -353,10 +378,12 @@ RSpec.describe Asciidoctor::ISO do
353
378
  </bibliography>
354
379
  </iso-standard>
355
380
  OUTPUT
381
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
382
+ .to be_equivalent_to xmlpp(output)
356
383
  end
357
384
 
358
385
  it "strips type from xrefs" do
359
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
386
+ input = <<~INPUT
360
387
  #{ASCIIDOC_BLANK_HDR}
361
388
  <<iso216>>
362
389
 
@@ -364,6 +391,7 @@ RSpec.describe Asciidoctor::ISO do
364
391
  == Clause
365
392
  * [[[iso216,ISO 216]]], _Reference_
366
393
  INPUT
394
+ output = <<~OUTPUT
367
395
  #{BLANK_HDR}
368
396
  <preface>
369
397
  <foreword id="_" obligation="informative">
@@ -394,10 +422,12 @@ RSpec.describe Asciidoctor::ISO do
394
422
  </bibliography>
395
423
  </iso-standard>
396
424
  OUTPUT
425
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
426
+ .to be_equivalent_to xmlpp(output)
397
427
  end
398
428
 
399
429
  it "processes localities in term sources" do
400
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
430
+ input = <<~INPUT
401
431
  #{ASCIIDOC_BLANK_HDR}
402
432
  == Terms and Definitions
403
433
 
@@ -406,6 +436,7 @@ RSpec.describe Asciidoctor::ISO do
406
436
  [.source]
407
437
  <<ISO2191,section=1>>
408
438
  INPUT
439
+ output = <<~OUTPUT
409
440
  #{BLANK_HDR}
410
441
  <sections>
411
442
  <terms id="_" obligation="normative">
@@ -426,10 +457,12 @@ RSpec.describe Asciidoctor::ISO do
426
457
  </sections>
427
458
  </iso-standard>
428
459
  OUTPUT
460
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
461
+ .to be_equivalent_to xmlpp(output)
429
462
  end
430
463
 
431
464
  it "removes extraneous material from Normative References" do
432
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
465
+ input = <<~INPUT
433
466
  #{ASCIIDOC_BLANK_HDR}
434
467
  [bibliography]
435
468
  == Normative References
@@ -438,6 +471,7 @@ RSpec.describe Asciidoctor::ISO do
438
471
 
439
472
  * [[[iso216,ISO 216]]], _Reference_
440
473
  INPUT
474
+ output = <<~OUTPUT
441
475
  #{BLANK_HDR}
442
476
  <sections></sections>
443
477
  <bibliography>
@@ -460,29 +494,35 @@ RSpec.describe Asciidoctor::ISO do
460
494
  </bibliography>
461
495
  </iso-standard>
462
496
  OUTPUT
497
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
498
+ .to be_equivalent_to xmlpp(output)
463
499
  end
464
500
 
465
501
  it "inserts IDs into paragraphs" do
466
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
502
+ input = <<~INPUT
467
503
  #{ASCIIDOC_BLANK_HDR}
468
504
  Paragraph
469
505
  INPUT
506
+ output = <<~OUTPUT
470
507
  #{BLANK_HDR}
471
508
  <sections>
472
509
  <p id="_">Paragraph</p>
473
510
  </sections>
474
511
  </iso-standard>
475
512
  OUTPUT
513
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
514
+ .to be_equivalent_to xmlpp(output)
476
515
  end
477
516
 
478
517
  it "inserts IDs into notes" do
479
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
518
+ input = <<~INPUT
480
519
  #{ASCIIDOC_BLANK_HDR}
481
520
  [example]
482
521
  ====
483
522
  NOTE: This note has no ID
484
523
  ====
485
524
  INPUT
525
+ output = <<~OUTPUT
486
526
  #{BLANK_HDR}
487
527
  <sections>
488
528
  <example id="_">
@@ -493,10 +533,12 @@ RSpec.describe Asciidoctor::ISO do
493
533
  </sections>
494
534
  </iso-standard>
495
535
  OUTPUT
536
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
537
+ .to be_equivalent_to xmlpp(output)
496
538
  end
497
539
 
498
540
  it "moves table key inside table" do
499
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
541
+ input = <<~INPUT
500
542
  #{ASCIIDOC_BLANK_HDR}
501
543
  |===
502
544
  |a |b |c
@@ -506,6 +548,7 @@ RSpec.describe Asciidoctor::ISO do
506
548
 
507
549
  a:: b
508
550
  INPUT
551
+ output = <<~OUTPUT
509
552
  #{BLANK_HDR}
510
553
  <sections>
511
554
  <table id="_">
@@ -526,10 +569,12 @@ RSpec.describe Asciidoctor::ISO do
526
569
  </sections>
527
570
  </iso-standard>
528
571
  OUTPUT
572
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
573
+ .to be_equivalent_to xmlpp(output)
529
574
  end
530
575
 
531
576
  it "processes headerrows attribute for table without header rows" do
532
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
577
+ input = <<~INPUT
533
578
  #{ASCIIDOC_BLANK_HDR}
534
579
  [headerrows=3]
535
580
  |===
@@ -539,6 +584,7 @@ RSpec.describe Asciidoctor::ISO do
539
584
  |a |b |c
540
585
  |===
541
586
  INPUT
587
+ output = <<~OUTPUT
542
588
  #{BLANK_HDR}
543
589
  <sections>
544
590
  <table id="_">
@@ -570,10 +616,12 @@ RSpec.describe Asciidoctor::ISO do
570
616
  </sections>
571
617
  </iso-standard>
572
618
  OUTPUT
619
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
620
+ .to be_equivalent_to xmlpp(output)
573
621
  end
574
622
 
575
623
  it "processes headerrows attribute for table with header rows" do
576
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
624
+ input = <<~INPUT
577
625
  #{ASCIIDOC_BLANK_HDR}
578
626
  [headerrows=3]
579
627
  |===
@@ -584,6 +632,7 @@ RSpec.describe Asciidoctor::ISO do
584
632
  |a |b |c
585
633
  |===
586
634
  INPUT
635
+ output = <<~OUTPUT
587
636
  #{BLANK_HDR}
588
637
  <sections>
589
638
  <table id="_">
@@ -615,10 +664,12 @@ RSpec.describe Asciidoctor::ISO do
615
664
  </sections>
616
665
  </iso-standard>
617
666
  OUTPUT
667
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
668
+ .to be_equivalent_to xmlpp(output)
618
669
  end
619
670
 
620
671
  it "moves table notes inside table" do
621
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
672
+ input = <<~INPUT
622
673
  #{ASCIIDOC_BLANK_HDR}
623
674
  |===
624
675
  |a |b |c
@@ -628,6 +679,7 @@ RSpec.describe Asciidoctor::ISO do
628
679
 
629
680
  NOTE: Note 2
630
681
  INPUT
682
+ output = <<~OUTPUT
631
683
  #{BLANK_HDR}
632
684
  <sections>
633
685
  <table id="_">
@@ -648,10 +700,12 @@ RSpec.describe Asciidoctor::ISO do
648
700
  </sections>
649
701
  </iso-standard>
650
702
  OUTPUT
703
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
704
+ .to be_equivalent_to xmlpp(output)
651
705
  end
652
706
 
653
707
  it "moves formula key inside formula" do
654
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
708
+ input = <<~INPUT
655
709
  #{ASCIIDOC_BLANK_HDR}
656
710
  [stem]
657
711
  ++++
@@ -662,6 +716,7 @@ RSpec.describe Asciidoctor::ISO do
662
716
 
663
717
  a:: b
664
718
  INPUT
719
+ output = <<~OUTPUT
665
720
  #{BLANK_HDR}
666
721
  <sections>
667
722
  <formula id="_">
@@ -684,10 +739,12 @@ RSpec.describe Asciidoctor::ISO do
684
739
  </sections>
685
740
  </iso-standard>
686
741
  OUTPUT
742
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
743
+ .to be_equivalent_to xmlpp(output)
687
744
  end
688
745
 
689
746
  it "moves footnotes inside figures" do
690
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
747
+ input = <<~INPUT
691
748
  #{ASCIIDOC_BLANK_HDR}
692
749
  image::spec/examples/rice_images/rice_image1.png[]
693
750
 
@@ -695,6 +752,7 @@ RSpec.describe Asciidoctor::ISO do
695
752
 
696
753
  footnote:[This is another footnote to a figure]
697
754
  INPUT
755
+ output = <<~OUTPUT
698
756
  #{BLANK_HDR}
699
757
  <sections>
700
758
  <figure id="_">
@@ -709,10 +767,12 @@ RSpec.describe Asciidoctor::ISO do
709
767
  </sections>
710
768
  </iso-standard>
711
769
  OUTPUT
770
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
771
+ .to be_equivalent_to xmlpp(output)
712
772
  end
713
773
 
714
774
  it "moves figure key inside figure" do
715
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
775
+ input = <<~INPUT
716
776
  #{ASCIIDOC_BLANK_HDR}
717
777
  image::spec/examples/rice_images/rice_image1.png[]
718
778
 
@@ -720,6 +780,7 @@ RSpec.describe Asciidoctor::ISO do
720
780
 
721
781
  a:: b
722
782
  INPUT
783
+ output = <<~OUTPUT
723
784
  #{BLANK_HDR}
724
785
  <sections>
725
786
  <figure id="_">
@@ -734,10 +795,12 @@ RSpec.describe Asciidoctor::ISO do
734
795
  </sections>
735
796
  </iso-standard>
736
797
  OUTPUT
798
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
799
+ .to be_equivalent_to xmlpp(output)
737
800
  end
738
801
 
739
802
  it "numbers bibliographic notes and footnotes sequentially" do
740
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
803
+ input = <<~INPUT
741
804
  #{ASCIIDOC_BLANK_HDR}
742
805
  footnote:[Footnote]
743
806
 
@@ -749,6 +812,7 @@ RSpec.describe Asciidoctor::ISO do
749
812
  == Clause
750
813
  footnote:[Footnote2]
751
814
  INPUT
815
+ output = <<~OUTPUT
752
816
  #{BLANK_HDR}
753
817
  <preface>
754
818
  <foreword id="_" obligation="informative">
@@ -794,10 +858,12 @@ RSpec.describe Asciidoctor::ISO do
794
858
  </bibliography>
795
859
  </iso-standard>
796
860
  OUTPUT
861
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
862
+ .to be_equivalent_to xmlpp(output)
797
863
  end
798
864
 
799
865
  it "defaults section obligations" do
800
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
866
+ input = <<~INPUT
801
867
  #{ASCIIDOC_BLANK_HDR}
802
868
 
803
869
  == Clause
@@ -808,6 +874,7 @@ RSpec.describe Asciidoctor::ISO do
808
874
 
809
875
  Text
810
876
  INPUT
877
+ output = <<~OUTPUT
811
878
  #{BLANK_HDR}
812
879
  <sections>
813
880
  <clause id="_" inline-header="false" obligation="normative">
@@ -821,10 +888,12 @@ RSpec.describe Asciidoctor::ISO do
821
888
  </annex>
822
889
  </iso-standard>
823
890
  OUTPUT
891
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
892
+ .to be_equivalent_to xmlpp(output)
824
893
  end
825
894
 
826
895
  it "extends clause levels past 5" do
827
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
896
+ input = <<~INPUT
828
897
  #{ASCIIDOC_BLANK_HDR}
829
898
 
830
899
  == Clause1
@@ -852,6 +921,7 @@ RSpec.describe Asciidoctor::ISO do
852
921
  ====== Clause 5B
853
922
 
854
923
  INPUT
924
+ output = <<~OUTPUT
855
925
  #{BLANK_HDR}
856
926
  <sections>
857
927
  <clause id="_" inline-header="false" obligation="normative">
@@ -887,10 +957,12 @@ RSpec.describe Asciidoctor::ISO do
887
957
  </sections>
888
958
  </iso-standard>
889
959
  OUTPUT
960
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
961
+ .to be_equivalent_to xmlpp(output)
890
962
  end
891
963
 
892
964
  it "reorders references in bibliography, and renumbers citations accordingly" do
893
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
965
+ input = <<~INPUT
894
966
  #{ASCIIDOC_BLANK_HDR}
895
967
 
896
968
  == Clause 1
@@ -932,6 +1004,7 @@ RSpec.describe Asciidoctor::ISO do
932
1004
  * [[[ref16,(B)]]], _Standard 20_
933
1005
  * [[[ref17,(A)]]], _Standard 30_
934
1006
  INPUT
1007
+ output = <<~OUTPUT
935
1008
  #{BLANK_HDR}
936
1009
  <sections>
937
1010
  <clause id="_" inline-header="false" obligation="normative">
@@ -1130,5 +1203,290 @@ RSpec.describe Asciidoctor::ISO do
1130
1203
  </bibliography>
1131
1204
  </iso-standard>
1132
1205
  OUTPUT
1206
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1207
+ .to be_equivalent_to xmlpp(output)
1208
+ end
1209
+
1210
+ context "terms & definitions boilerplate" do
1211
+ it "places normal terms & definitions boilerplate in flat clause" do
1212
+ input = <<~INPUT
1213
+ #{ASCIIDOC_BLANK_HDR}
1214
+
1215
+ == Terms and definitions
1216
+
1217
+ === Term1
1218
+ INPUT
1219
+ output = <<~OUTPUT
1220
+ #{BLANK_HDR}
1221
+ <sections>
1222
+ <terms id='_' obligation='normative'>
1223
+ <title>Terms and definitions</title>
1224
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1225
+ <p id='_'>
1226
+ ISO and IEC maintain terminological databases for use in standardization
1227
+ at the following addresses:
1228
+ </p>
1229
+ <ul id='_'>
1230
+ <li>
1231
+ <p id='_'>
1232
+ ISO Online browsing platform: available at
1233
+ <link target='http://www.iso.org/obp'/>
1234
+ </p>
1235
+ </li>
1236
+ <li>
1237
+ <p id='_'>
1238
+ IEC Electropedia: available at
1239
+ <link target='http://www.electropedia.org'/>
1240
+ </p>
1241
+ </li>
1242
+ </ul>
1243
+ <term id='term-term1'>
1244
+ <preferred>Term1</preferred>
1245
+ </term>
1246
+ </terms>
1247
+ </sections>
1248
+ </iso-standard>
1249
+ OUTPUT
1250
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1251
+ .to be_equivalent_to xmlpp(output)
1252
+ end
1253
+
1254
+ it "places normal terms & definitions boilerplate in multi-clause" do
1255
+ input = <<~INPUT
1256
+ #{ASCIIDOC_BLANK_HDR}
1257
+
1258
+ == Terms and definitions
1259
+
1260
+ === Normal Terms
1261
+
1262
+ ==== Term1
1263
+
1264
+ === Abnormal terms
1265
+
1266
+ ==== Term 2
1267
+ INPUT
1268
+ output = <<~OUTPUT
1269
+ #{BLANK_HDR}
1270
+ <sections>
1271
+ <clause id='_' obligation='normative'>
1272
+ <title>Terms and definitions</title>
1273
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1274
+ <p id='_'>
1275
+ ISO and IEC maintain terminological databases for use in standardization
1276
+ at the following addresses:
1277
+ </p>
1278
+ <ul id='_'>
1279
+ <li>
1280
+ <p id='_'>
1281
+ ISO Online browsing platform: available at
1282
+ <link target='http://www.iso.org/obp'/>
1283
+ </p>
1284
+ </li>
1285
+ <li>
1286
+ <p id='_'>
1287
+ IEC Electropedia: available at
1288
+ <link target='http://www.electropedia.org'/>
1289
+ </p>
1290
+ </li>
1291
+ </ul>
1292
+ <terms id='_' obligation='normative'>
1293
+ <title>Normal Terms</title>
1294
+ <term id='term-term1'>
1295
+ <preferred>Term1</preferred>
1296
+ </term>
1297
+ </terms>
1298
+ <terms id='_' obligation='normative'>
1299
+ <title>Abnormal terms</title>
1300
+ <term id='term-term-2'>
1301
+ <preferred>Term 2</preferred>
1302
+ </term>
1303
+ </terms>
1304
+ </clause>
1305
+ </sections>
1306
+ </iso-standard>
1307
+ OUTPUT
1308
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1309
+ .to be_equivalent_to xmlpp(output)
1310
+ end
1311
+
1312
+ it "places normal terms & definitions boilerplate in single clause that excludes symbols" do
1313
+ input = <<~INPUT
1314
+ #{ASCIIDOC_BLANK_HDR}
1315
+
1316
+ == Terms, definitions, symbols and abbreviated terms
1317
+
1318
+ === Terms and definitions
1319
+
1320
+ ==== Normal Terms
1321
+
1322
+ ===== Term1
1323
+
1324
+ ==== Abnormal terms
1325
+
1326
+ ===== Term 2
1327
+
1328
+ === Symbols and abbreviated terms
1329
+ INPUT
1330
+ output = <<~OUTPUT
1331
+ #{BLANK_HDR}
1332
+ <sections>
1333
+ <clause id='_' obligation='normative'>
1334
+ <title>Terms, definitions, symbols and abbreviated terms</title>
1335
+ <clause id='_' obligation='normative'>
1336
+ <title>Terms and definitions</title>
1337
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1338
+ <p id='_'>
1339
+ ISO and IEC maintain terminological databases for use in
1340
+ standardization at the following addresses:
1341
+ </p>
1342
+ <ul id='_'>
1343
+ <li>
1344
+ <p id='_'>
1345
+ ISO Online browsing platform: available at
1346
+ <link target='http://www.iso.org/obp'/>
1347
+ </p>
1348
+ </li>
1349
+ <li>
1350
+ <p id='_'>
1351
+ IEC Electropedia: available at
1352
+ <link target='http://www.electropedia.org'/>
1353
+ </p>
1354
+ </li>
1355
+ </ul>
1356
+ <terms id='_' obligation='normative'>
1357
+ <title>Normal Terms</title>
1358
+ <term id='term-term1'>
1359
+ <preferred>Term1</preferred>
1360
+ </term>
1361
+ </terms>
1362
+ <terms id='_' obligation='normative'>
1363
+ <title>Abnormal terms</title>
1364
+ <term id='term-term-2'>
1365
+ <preferred>Term 2</preferred>
1366
+ </term>
1367
+ </terms>
1368
+ </clause>
1369
+ <definitions id='_' obligation='normative'>
1370
+ <title>Symbols and abbreviated terms</title>
1371
+ </definitions>
1372
+ </clause>
1373
+ </sections>
1374
+ </iso-standard>
1375
+ OUTPUT
1376
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1377
+ .to be_equivalent_to xmlpp(output)
1378
+ end
1379
+
1380
+ it "places normal terms & definitions boilerplate in first of multiple clauses that excludes symbols" do
1381
+ input = <<~INPUT
1382
+ #{ASCIIDOC_BLANK_HDR}
1383
+
1384
+ == Terms, definitions, symbols and abbreviated terms
1385
+
1386
+ === Terms and definitions
1387
+
1388
+ ==== Term1
1389
+
1390
+ [heading=terms]
1391
+ === Other Terms
1392
+
1393
+ ==== Term 2
1394
+
1395
+ === Symbols and abbreviated terms
1396
+ INPUT
1397
+ output = <<~OUTPUT
1398
+ #{BLANK_HDR}
1399
+ <sections>
1400
+ <clause id='_' obligation='normative'>
1401
+ <title>Terms, definitions, symbols and abbreviated terms</title>
1402
+ <terms id='_' obligation='normative'>
1403
+ <title>Terms and definitions</title>
1404
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1405
+ <p id='_'>
1406
+ ISO and IEC maintain terminological databases for use in
1407
+ standardization at the following addresses:
1408
+ </p>
1409
+ <ul id='_'>
1410
+ <li>
1411
+ <p id='_'>
1412
+ ISO Online browsing platform: available at
1413
+ <link target='http://www.iso.org/obp'/>
1414
+ </p>
1415
+ </li>
1416
+ <li>
1417
+ <p id='_'>
1418
+ IEC Electropedia: available at
1419
+ <link target='http://www.electropedia.org'/>
1420
+ </p>
1421
+ </li>
1422
+ </ul>
1423
+ <term id='term-term1'>
1424
+ <preferred>Term1</preferred>
1425
+ </term>
1426
+ </terms>
1427
+ <terms id='_' obligation='normative'>
1428
+ <title>Other Terms</title>
1429
+ <term id='term-term-2'>
1430
+ <preferred>Term 2</preferred>
1431
+ </term>
1432
+ </terms>
1433
+ <definitions id='_' obligation='normative'>
1434
+ <title>Symbols and abbreviated terms</title>
1435
+ </definitions>
1436
+ </clause>
1437
+ </sections>
1438
+ </iso-standard>
1439
+ OUTPUT
1440
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1441
+ .to be_equivalent_to xmlpp(output)
1442
+ end
1443
+
1444
+ it "modifies normal terms & definitions boilerplate in vocabulary document" do
1445
+ input = <<~INPUT
1446
+ = Document title
1447
+ Author
1448
+ :docfile: test.adoc
1449
+ :nodoc:
1450
+ :novalid:
1451
+ :no-isobib:
1452
+ :docsubtype: vocabulary
1453
+
1454
+ == Terms and definitions
1455
+
1456
+ === Term1
1457
+ INPUT
1458
+ output = <<~OUTPUT
1459
+ #{BLANK_HDR.sub(%r{</doctype>}, '</doctype><subdoctype>vocabulary</subdoctype>')}
1460
+ <sections>
1461
+ <terms id='_' obligation='normative'>
1462
+ <title>Terms and definitions</title>
1463
+ <p id='_'>
1464
+ ISO and IEC maintain terminological databases for use in standardization
1465
+ at the following addresses:
1466
+ </p>
1467
+ <ul id='_'>
1468
+ <li>
1469
+ <p id='_'>
1470
+ ISO Online browsing platform: available at
1471
+ <link target='http://www.iso.org/obp'/>
1472
+ </p>
1473
+ </li>
1474
+ <li>
1475
+ <p id='_'>
1476
+ IEC Electropedia: available at
1477
+ <link target='http://www.electropedia.org'/>
1478
+ </p>
1479
+ </li>
1480
+ </ul>
1481
+ <term id='term-term1'>
1482
+ <preferred>Term1</preferred>
1483
+ </term>
1484
+ </terms>
1485
+ </sections>
1486
+ </iso-standard>
1487
+ OUTPUT
1488
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1489
+ .to be_equivalent_to xmlpp(output)
1490
+ end
1133
1491
  end
1134
1492
  end