metanorma-iso 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/iso/html/header-dis.html +111 -29
  3. data/lib/isodoc/iso/html/isodoc-dis.css +65 -64
  4. data/lib/isodoc/iso/html/isodoc-dis.scss +65 -64
  5. data/lib/isodoc/iso/html/style-human.css +1 -2
  6. data/lib/isodoc/iso/html/style-human.scss +0 -1
  7. data/lib/isodoc/iso/html/style-iso.css +1 -2
  8. data/lib/isodoc/iso/html/style-iso.scss +0 -1
  9. data/lib/isodoc/iso/html/wordstyle-dis.css +10 -4
  10. data/lib/isodoc/iso/html/wordstyle-dis.scss +10 -4
  11. data/lib/isodoc/iso/i18n-en.yaml +4 -4
  12. data/lib/isodoc/iso/iso.amendment.xsl +205 -37
  13. data/lib/isodoc/iso/iso.international-standard.xsl +205 -37
  14. data/lib/isodoc/iso/presentation_bibdata.rb +13 -9
  15. data/lib/isodoc/iso/presentation_xml_convert.rb +5 -3
  16. data/lib/isodoc/iso/word_convert.rb +6 -4
  17. data/lib/isodoc/iso/word_dis_cleanup.rb +24 -3
  18. data/lib/isodoc/iso/word_dis_convert.rb +4 -1
  19. data/lib/metanorma/iso/base.rb +2 -1
  20. data/lib/metanorma/iso/biblio.rng +5 -0
  21. data/lib/metanorma/iso/isodoc.rng +46 -12
  22. data/lib/metanorma/iso/version.rb +1 -1
  23. data/metanorma-iso.gemspec +5 -2
  24. metadata +4 -87
  25. data/.github/workflows/automerge.yml +0 -31
  26. data/.github/workflows/rake.yml +0 -15
  27. data/.github/workflows/release.yml +0 -24
  28. data/.github/workflows/ubuntu.yml +0 -41
  29. data/Rakefile +0 -8
  30. data/bin/rspec +0 -17
  31. data/spec/assets/header.html +0 -7
  32. data/spec/assets/html.css +0 -2
  33. data/spec/assets/htmlcover.html +0 -4
  34. data/spec/assets/htmlintro.html +0 -5
  35. data/spec/assets/i18n.yaml +0 -2
  36. data/spec/assets/iso.adoc +0 -10
  37. data/spec/assets/iso.headless.html +0 -33
  38. data/spec/assets/iso.xml +0 -71
  39. data/spec/assets/rice_image1.png +0 -0
  40. data/spec/assets/scripts.html +0 -3
  41. data/spec/assets/std.css +0 -2
  42. data/spec/assets/word.css +0 -2
  43. data/spec/assets/wordcover.html +0 -3
  44. data/spec/assets/wordintro.html +0 -4
  45. data/spec/examples/103_01_02.html +0 -247
  46. data/spec/examples/english.yaml +0 -69
  47. data/spec/examples/iso_123_.xml +0 -45
  48. data/spec/examples/iso_123_all_parts.xml +0 -45
  49. data/spec/examples/iso_123_no_year_note.xml +0 -46
  50. data/spec/examples/iso_124_.xml +0 -41
  51. data/spec/examples/iso_216_.xml +0 -47
  52. data/spec/examples/iso_iec_12382_.xml +0 -48
  53. data/spec/examples/rice.adoc +0 -714
  54. data/spec/examples/rice.preview.html +0 -1870
  55. data/spec/examples/rice.sh +0 -4
  56. data/spec/examples/rice_img/1000-1_ed2amd3fig1a.png +0 -0
  57. data/spec/examples/rice_img/1000-1_ed2amd3fig1b.png +0 -0
  58. data/spec/examples/rice_img/1000-1_ed2amd3fig2.png +0 -0
  59. data/spec/examples/rice_img/1000-1_ed2amd3fig3.png +0 -0
  60. data/spec/examples/rice_img/1000-1_ed2amd3fig4.png +0 -0
  61. data/spec/examples/rice_img/1000-1_ed2amd3fig5_f.png +0 -0
  62. data/spec/examples/rice_img/1000-1_ed2amd3figA.png +0 -0
  63. data/spec/examples/rice_img/1000-1_ed2amd3figA1.png +0 -0
  64. data/spec/examples/rice_img/1000-1_ed2amd3figA2.png +0 -0
  65. data/spec/examples/rice_img/1000-1_ed2amd3figTab1.png +0 -0
  66. data/spec/examples/rice_img/1000-1_ed2amd3figTab2.png +0 -0
  67. data/spec/examples/rice_img/1001_ed2amd3fig1.png +0 -0
  68. data/spec/examples/rice_img/ISO_1213_1.png +0 -0
  69. data/spec/examples/rice_img/SL1000-1_ed2amd3fig1.png +0 -0
  70. data/spec/examples/rice_img/rice_image1.png +0 -0
  71. data/spec/examples/rice_img/rice_image2.png +0 -0
  72. data/spec/examples/rice_img/rice_image3_1.png +0 -0
  73. data/spec/examples/rice_img/rice_image3_2.png +0 -0
  74. data/spec/examples/rice_img/rice_image3_3.png +0 -0
  75. data/spec/isodoc/amd_spec.rb +0 -986
  76. data/spec/isodoc/blocks_spec.rb +0 -1174
  77. data/spec/isodoc/i18n_spec.rb +0 -1579
  78. data/spec/isodoc/inline_spec.rb +0 -1060
  79. data/spec/isodoc/iso_spec.rb +0 -255
  80. data/spec/isodoc/metadata_spec.rb +0 -701
  81. data/spec/isodoc/postproc_spec.rb +0 -1089
  82. data/spec/isodoc/ref_spec.rb +0 -439
  83. data/spec/isodoc/section_spec.rb +0 -998
  84. data/spec/isodoc/table_spec.rb +0 -420
  85. data/spec/isodoc/terms_spec.rb +0 -314
  86. data/spec/isodoc/word_dis_spec.rb +0 -2064
  87. data/spec/isodoc/xref_spec.rb +0 -1747
  88. data/spec/metanorma/amd_spec.rb +0 -724
  89. data/spec/metanorma/base_spec.rb +0 -1384
  90. data/spec/metanorma/blank_spec.rb +0 -38
  91. data/spec/metanorma/blocks_spec.rb +0 -624
  92. data/spec/metanorma/cleanup_spec.rb +0 -1645
  93. data/spec/metanorma/inline_spec.rb +0 -203
  94. data/spec/metanorma/lists_spec.rb +0 -197
  95. data/spec/metanorma/macros_spec.rb +0 -99
  96. data/spec/metanorma/processor_spec.rb +0 -161
  97. data/spec/metanorma/refs_spec.rb +0 -672
  98. data/spec/metanorma/section_spec.rb +0 -492
  99. data/spec/metanorma/table_spec.rb +0 -329
  100. data/spec/metanorma/validate_spec.rb +0 -2153
  101. data/spec/relaton/render_spec.rb +0 -568
  102. data/spec/requirements/requirement_components_spec.rb +0 -610
  103. data/spec/requirements/requirements_spec.rb +0 -1596
  104. data/spec/requirements/xref_spec.rb +0 -1211
  105. data/spec/spec_helper.rb +0 -313
  106. data/spec/vcr_cassettes/docrels.yml +0 -385
  107. data/spec/vcr_cassettes/withdrawn_iso.yml +0 -295
@@ -1,1645 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe Metanorma::ISO do
4
- it "removes empty text elements" do
5
- input = <<~INPUT
6
- #{ASCIIDOC_BLANK_HDR}
7
- == {blank}
8
- INPUT
9
- output = <<~OUTPUT
10
- #{BLANK_HDR}
11
- <sections>
12
- <clause id="_" inline-header="false" obligation="normative"/>
13
- </sections>
14
- </iso-standard>
15
- OUTPUT
16
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
17
- .to be_equivalent_to xmlpp(output)
18
- end
19
-
20
- it "processes stem-only terms as admitted" do
21
- input = <<~INPUT
22
- #{ASCIIDOC_BLANK_HDR}
23
- == Terms and Definitions
24
-
25
- === stem:[t_90]
26
-
27
- stem:[t_91]
28
-
29
- Time
30
- INPUT
31
- output = <<~OUTPUT
32
- #{BLANK_HDR}
33
- <sections>
34
- <terms id="_" obligation="normative">
35
- <title>Terms and definitions</title>
36
- #{TERM_BOILERPLATE}
37
- <term id="term-t90">
38
- <preferred>
39
- <letter-symbol><name>
40
- <stem type="MathML">
41
- <math xmlns="http://www.w3.org/1998/Math/MathML">
42
- <msub>
43
- <mrow>
44
- <mi>t</mi></mrow>
45
- <mrow>
46
- <mn>90</mn>
47
- </mrow>
48
- </msub>
49
- </math>
50
- </stem>
51
- </name></letter-symbol>
52
- </preferred>
53
- <admitted>
54
- <letter-symbol><name>
55
- <stem type="MathML">
56
- <math xmlns="http://www.w3.org/1998/Math/MathML">
57
- <msub>
58
- <mrow>
59
- <mi>t</mi>
60
- </mrow>
61
- <mrow>
62
- <mn>91</mn>
63
- </mrow>
64
- </msub>
65
- </math>
66
- </stem>
67
- </name></letter-symbol>
68
- </admitted>
69
- <definition><verbal-definition>
70
- <p id="_">Time</p>
71
- </verbal-definition></definition>
72
- </term>
73
- </terms>
74
- </sections>
75
- </iso-standard>
76
- OUTPUT
77
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
78
- .to be_equivalent_to xmlpp(output)
79
- end
80
-
81
- it "moves term domains out of the term definition paragraph" do
82
- input = <<~INPUT
83
- #{ASCIIDOC_BLANK_HDR}
84
- == Terms and Definitions
85
-
86
- === Tempus
87
-
88
- domain:[relativity] Time
89
- INPUT
90
- output = <<~OUTPUT
91
- #{BLANK_HDR}
92
- <sections>
93
- <terms id="_" obligation="normative">
94
- <title>Terms and definitions</title>#{TERM_BOILERPLATE}
95
-
96
- <term id="term-Tempus">
97
- <preferred><expression><name>Tempus</name></expression></preferred>
98
- <domain>relativity</domain>
99
- <definition><verbal-definition>
100
- <p id="_">Time</p></verbal-definition></definition>
101
- </term>
102
- </terms>
103
- </sections>
104
- </iso-standard>
105
- OUTPUT
106
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
107
- .to be_equivalent_to xmlpp(output)
108
- end
109
-
110
- it "permits multiple blocks in term definition paragraph" do
111
- input = <<~INPUT
112
- = Document title
113
- Author
114
- :docfile: test.adoc
115
- :nodoc:
116
- :novalid:
117
- :stem:
118
- :no-isobib:
119
-
120
- == Terms and Definitions
121
-
122
- === stem:[t_90]
123
-
124
- [.definition]
125
- --
126
- [stem]
127
- ++++
128
- t_A
129
- ++++
130
-
131
- This paragraph is extraneous
132
- --
133
- INPUT
134
- output = <<~OUTPUT
135
- #{BLANK_HDR}
136
- <sections>
137
- <terms id="_" obligation="normative">
138
- <title>Terms and definitions</title>
139
- #{TERM_BOILERPLATE}
140
- <term id="term-t90">
141
- <preferred>
142
- <letter-symbol><name>
143
- <stem type="MathML">
144
- <math xmlns="http://www.w3.org/1998/Math/MathML">
145
- <msub>
146
- <mrow>
147
- <mi>t</mi></mrow>
148
- <mrow>
149
- <mn>90</mn>
150
- </mrow>
151
- </msub>
152
- </math>
153
- </stem>
154
- </name></letter-symbol>
155
- </preferred>
156
- <definition>
157
- <verbal-definition>
158
- <formula id="_">
159
- <stem type="MathML">
160
- <math xmlns="http://www.w3.org/1998/Math/MathML">
161
- <msub>
162
- <mrow>
163
- <mi>t</mi>
164
- </mrow>
165
- <mrow>
166
- <mi>A</mi>
167
- </mrow>
168
- </msub>
169
- </math>
170
- </stem>
171
- </formula>
172
- <p id="_">This paragraph is extraneous</p></verbal-definition>
173
- </definition>
174
- </term>
175
- </terms>
176
- </sections>
177
- </iso-standard>
178
- OUTPUT
179
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
180
- .to be_equivalent_to xmlpp(output)
181
- end
182
-
183
- it "keeps any initial boilerplate from terms and definitions" do
184
- input = <<~INPUT
185
- #{ASCIIDOC_BLANK_HDR}
186
- == Terms and Definitions
187
-
188
- I am boilerplate
189
-
190
- * So am I
191
-
192
- === Time
193
-
194
- This paragraph is extraneous
195
- INPUT
196
- output = <<~OUTPUT
197
- #{BLANK_HDR}
198
- <sections>
199
- <terms id="_" obligation="normative">
200
- <title>Terms and definitions</title>#{TERM_BOILERPLATE}
201
-
202
- <p id="_">I am boilerplate</p>
203
- <ul id="_">
204
- <li>
205
- <p id="_">So am I</p></li>
206
- </ul>
207
- <term id="term-Time">
208
- <preferred><expression><name>Time</name></expression></preferred>
209
- <definition><verbal-definition>
210
- <p id="_">This paragraph is extraneous</p>
211
- </verbal-definition></definition>
212
- </term>
213
- </terms>
214
- </sections>
215
- </iso-standard>
216
- OUTPUT
217
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
218
- .to be_equivalent_to xmlpp(output)
219
- end
220
-
221
- it "moves notes inside preceding blocks, if they are not at clause end, and the blocks are not delimited" do
222
- input = <<~INPUT
223
- #{ASCIIDOC_BLANK_HDR}
224
- [stem]
225
- ++++
226
- r = 1 %
227
- r = 1 %
228
- ++++
229
-
230
- NOTE: That formula does not do much
231
-
232
- Indeed.
233
- INPUT
234
- output = <<~OUTPUT
235
- #{BLANK_HDR}
236
- <sections>
237
- <formula id="_">
238
- <stem type="MathML">
239
- <math xmlns="http://www.w3.org/1998/Math/MathML">
240
- <mi>r</mi>
241
- <mo>=</mo>
242
- <mn>1</mn>
243
- <mo>%</mo>
244
- <mi>r</mi>
245
- <mo>=</mo>
246
- <mn>1</mn>
247
- <mo>%</mo>
248
- </math>
249
- </stem>
250
- <note id="_">
251
- <p id="_">That formula does not do much</p>
252
- </note>
253
- </formula>
254
- <p id="_">Indeed.</p>
255
- </sections>
256
- </iso-standard>
257
- OUTPUT
258
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
259
- .to be_equivalent_to xmlpp(output)
260
- end
261
-
262
- it "does not move notes inside preceding blocks, if they are at clause end" do
263
- input = <<~INPUT
264
- #{ASCIIDOC_BLANK_HDR}
265
- [source,ruby]
266
- [1...x].each do |y|
267
- puts y
268
- end
269
-
270
- NOTE: That loop does not do much
271
- INPUT
272
- output = <<~OUTPUT
273
- #{BLANK_HDR}
274
- <sections>
275
- <sourcecode id="_" lang="ruby">[1...x].each do |y|
276
- puts y
277
- end</sourcecode>
278
- <note id="_">
279
- <p id="_">That loop does not do much</p>
280
- </note>
281
- </sections>
282
- </iso-standard>
283
- OUTPUT
284
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
285
- .to be_equivalent_to xmlpp(output)
286
- end
287
-
288
- it "converts xrefs to references into erefs" do
289
- input = <<~INPUT
290
- #{ASCIIDOC_BLANK_HDR}
291
- <<iso216>>
292
-
293
- [bibliography]
294
- == Normative References
295
- * [[[iso216,ISO 216:2001]]], _Reference_
296
- INPUT
297
- output = <<~OUTPUT
298
- #{BLANK_HDR}
299
- <preface>
300
- <foreword id="_" obligation="informative">
301
- <title>Foreword</title>
302
- <p id="_">
303
- <eref bibitemid="iso216" citeas="ISO 216:2001" type="inline"/>
304
- </p>
305
- </foreword>
306
- </preface>
307
- <sections>
308
- </sections>
309
- <bibliography>
310
- <references id="_" normative="true" obligation="informative">
311
- <title>Normative references</title>
312
- <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
313
- <bibitem id="iso216" type="standard">
314
- <title format="text/plain">Reference</title>
315
- <docidentifier>ISO 216:2001</docidentifier>
316
- <docnumber>216</docnumber>
317
- <date type="published">
318
- <on>2001</on>
319
- </date>
320
- <contributor>
321
- <role type="publisher"/>
322
- <organization>
323
- <name>International Organization for Standardization</name>
324
- <abbreviation>ISO</abbreviation>
325
- </organization>
326
- </contributor>
327
- </bibitem>
328
- </references>
329
- </bibliography>
330
- </iso-standard>
331
- OUTPUT
332
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
333
- .to be_equivalent_to xmlpp(output)
334
- end
335
-
336
- it "extracts localities from erefs" do
337
- input = <<~INPUT
338
- #{ASCIIDOC_BLANK_HDR}
339
- <<iso216,whole,clause=3,example=9-11,locality:prelude=33,locality:entirety:the reference>>
340
-
341
- [bibliography]
342
- == Normative References
343
- * [[[iso216,ISO 216]]], _Reference_
344
- INPUT
345
- output = <<~OUTPUT
346
- #{BLANK_HDR}
347
- <preface>
348
- <foreword id="_" obligation="informative">
349
- <title>Foreword</title>
350
- <p id="_">
351
- <eref bibitemid="iso216" citeas="ISO 216" type="inline">
352
- <localityStack>
353
- <locality type="whole"/>
354
- <locality type="clause">
355
- <referenceFrom>3</referenceFrom>
356
- </locality>
357
- <locality type="example">
358
- <referenceFrom>9</referenceFrom>
359
- <referenceTo>11</referenceTo>
360
- </locality>
361
- <locality type="locality:prelude">
362
- <referenceFrom>33</referenceFrom>
363
- </locality>
364
- <locality type="locality:entirety"/>
365
- </localityStack>the reference</eref>
366
- </p>
367
- </foreword>
368
- </preface>
369
- <sections>
370
- </sections>
371
- <bibliography>
372
- <references id="_" normative="true" obligation="informative">
373
- <title>Normative references</title>
374
- <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
375
- <bibitem id="iso216" type="standard">
376
- <title format="text/plain">Reference</title>
377
- <docidentifier>ISO 216</docidentifier>
378
- <docnumber>216</docnumber>
379
- <contributor>
380
- <role type="publisher"/>
381
- <organization>
382
- <name>International Organization for Standardization</name>
383
- <abbreviation>ISO</abbreviation>
384
- </organization>
385
- </contributor>
386
- </bibitem>
387
- </references>
388
- </bibliography>
389
- </iso-standard>
390
- OUTPUT
391
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
392
- .to be_equivalent_to xmlpp(output)
393
- end
394
-
395
- it "strips type from xrefs" do
396
- input = <<~INPUT
397
- #{ASCIIDOC_BLANK_HDR}
398
- <<iso216>>
399
-
400
- [bibliography]
401
- == Clause
402
- * [[[iso216,ISO 216]]], _Reference_
403
- INPUT
404
- output = <<~OUTPUT
405
- #{BLANK_HDR}
406
- <preface>
407
- <foreword id="_" obligation="informative">
408
- <title>Foreword</title>
409
- <p id="_">
410
- <eref bibitemid="iso216" citeas="ISO 216" type="inline"/>
411
- </p>
412
- </foreword>
413
- </preface>
414
- <sections>
415
- </sections>
416
- <bibliography>
417
- <references id="_" normative="false" obligation="informative">
418
- <title>Bibliography</title>
419
- <bibitem id="iso216" type="standard">
420
- <title format="text/plain">Reference</title>
421
- <docidentifier>ISO 216</docidentifier>
422
- <docnumber>216</docnumber>
423
- <contributor>
424
- <role type="publisher"/>
425
- <organization>
426
- <name>International Organization for Standardization</name>
427
- <abbreviation>ISO</abbreviation>
428
- </organization>
429
- </contributor>
430
- </bibitem>
431
- </references>
432
- </bibliography>
433
- </iso-standard>
434
- OUTPUT
435
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
436
- .to be_equivalent_to xmlpp(output)
437
- end
438
-
439
- it "processes localities in term sources" do
440
- input = <<~INPUT
441
- #{ASCIIDOC_BLANK_HDR}
442
- == Terms and Definitions
443
-
444
- === Term1
445
-
446
- Definition
447
-
448
- [.source]
449
- <<ISO2191,section=1>>
450
- INPUT
451
- output = <<~OUTPUT
452
- #{BLANK_HDR}
453
- <sections>
454
- <terms id="_" obligation="normative">
455
- <title>Terms and definitions</title>
456
- #{TERM_BOILERPLATE}
457
- <term id="term-Term1">
458
- <preferred><expression><name>Term1</name></expression></preferred>
459
- <definition>
460
- <verbal-definition>
461
- <p id='_'>Definition</p>
462
- </verbal-definition>
463
- </definition>
464
- <termsource status='identical' type='authoritative'>
465
- <origin bibitemid="ISO2191" citeas="" type="inline">
466
- <localityStack>
467
- <locality type="section">
468
- <referenceFrom>1</referenceFrom></locality>
469
- </localityStack>
470
- </origin>
471
- </termsource>
472
- </term>
473
- </terms>
474
- </sections>
475
- </iso-standard>
476
- OUTPUT
477
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
478
- .to be_equivalent_to xmlpp(output)
479
- end
480
-
481
- it "removes extraneous material from Normative References" do
482
- input = <<~INPUT
483
- #{ASCIIDOC_BLANK_HDR}
484
- [bibliography]
485
- == Normative References
486
-
487
- This is extraneous information
488
-
489
- * [[[iso216,ISO 216]]], _Reference_
490
- INPUT
491
- output = <<~OUTPUT
492
- #{BLANK_HDR}
493
- <sections></sections>
494
- <bibliography>
495
- <references id="_" normative="true" obligation="informative">
496
- <title>Normative references</title>
497
- <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
498
- <bibitem id="iso216" type="standard">
499
- <title format="text/plain">Reference</title>
500
- <docidentifier>ISO 216</docidentifier>
501
- <docnumber>216</docnumber>
502
- <contributor>
503
- <role type="publisher"/>
504
- <organization>
505
- <name>International Organization for Standardization</name>
506
- <abbreviation>ISO</abbreviation>
507
- </organization>
508
- </contributor>
509
- </bibitem>
510
- </references>
511
- </bibliography>
512
- </iso-standard>
513
- OUTPUT
514
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
515
- .to be_equivalent_to xmlpp(output)
516
- end
517
-
518
- it "inserts IDs into paragraphs" do
519
- input = <<~INPUT
520
- #{ASCIIDOC_BLANK_HDR}
521
- Paragraph
522
- INPUT
523
- output = <<~OUTPUT
524
- #{BLANK_HDR}
525
- <sections>
526
- <p id="_">Paragraph</p>
527
- </sections>
528
- </iso-standard>
529
- OUTPUT
530
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
531
- .to be_equivalent_to xmlpp(output)
532
- end
533
-
534
- it "inserts IDs into notes" do
535
- input = <<~INPUT
536
- #{ASCIIDOC_BLANK_HDR}
537
- [example]
538
- ====
539
- NOTE: This note has no ID
540
- ====
541
- INPUT
542
- output = <<~OUTPUT
543
- #{BLANK_HDR}
544
- <sections>
545
- <example id="_">
546
- <note id="_">
547
- <p id="_">This note has no ID</p>
548
- </note>
549
- </example>
550
- </sections>
551
- </iso-standard>
552
- OUTPUT
553
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
554
- .to be_equivalent_to xmlpp(output)
555
- end
556
-
557
- it "moves table key inside table" do
558
- input = <<~INPUT
559
- #{ASCIIDOC_BLANK_HDR}
560
- |===
561
- |a |b |c
562
- |===
563
-
564
- Key
565
-
566
- a:: b
567
- INPUT
568
- output = <<~OUTPUT
569
- #{BLANK_HDR}
570
- <sections>
571
- <table id="_">
572
- <tbody>
573
- <tr>
574
- <td align="left" valign="top">a</td>
575
- <td align="left" valign="top">b</td>
576
- <td align="left" valign="top">c</td>
577
- </tr>
578
- </tbody>
579
- <dl id="_" key="true">
580
- <dt>a</dt>
581
- <dd>
582
- <p id="_">b</p>
583
- </dd>
584
- </dl>
585
- </table>
586
- </sections>
587
- </iso-standard>
588
- OUTPUT
589
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
590
- .to be_equivalent_to xmlpp(output)
591
- end
592
-
593
- it "processes headerrows attribute for table without header rows" do
594
- input = <<~INPUT
595
- #{ASCIIDOC_BLANK_HDR}
596
- [headerrows=3]
597
- |===
598
- |a |b |c
599
- |a |b |c
600
- |a |b |c
601
- |a |b |c
602
- |===
603
- INPUT
604
- output = <<~OUTPUT
605
- #{BLANK_HDR}
606
- <sections>
607
- <table id="_">
608
- <thead>
609
- <tr>
610
- <th align="left" valign="top">a</th>
611
- <th align="left" valign="top">b</th>
612
- <th align="left" valign="top">c</th>
613
- </tr>
614
- <tr>
615
- <th align="left" valign="top">a</th>
616
- <th align="left" valign="top">b</th>
617
- <th align="left" valign="top">c</th>
618
- </tr>
619
- <tr>
620
- <th align="left" valign="top">a</th>
621
- <th align="left" valign="top">b</th>
622
- <th align="left" valign="top">c</th>
623
- </tr>
624
- </thead>
625
- <tbody>
626
- <tr>
627
- <td align="left" valign="top">a</td>
628
- <td align="left" valign="top">b</td>
629
- <td align="left" valign="top">c</td>
630
- </tr>
631
- </tbody>
632
- </table>
633
- </sections>
634
- </iso-standard>
635
- OUTPUT
636
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
637
- .to be_equivalent_to xmlpp(output)
638
- end
639
-
640
- it "processes headerrows attribute for table with header rows" do
641
- input = <<~INPUT
642
- #{ASCIIDOC_BLANK_HDR}
643
- [headerrows=3]
644
- |===
645
- |a |b |c
646
-
647
- |a |b |c
648
- |a |b |c
649
- |a |b |c
650
- |===
651
- INPUT
652
- output = <<~OUTPUT
653
- #{BLANK_HDR}
654
- <sections>
655
- <table id="_">
656
- <thead>
657
- <tr>
658
- <th align="left" valign="top">a</th>
659
- <th align="left" valign="top">b</th>
660
- <th align="left" valign="top">c</th>
661
- </tr>
662
- <tr>
663
- <th align="left" valign="top">a</th>
664
- <th align="left" valign="top">b</th>
665
- <th align="left" valign="top">c</th>
666
- </tr>
667
- <tr>
668
- <th align="left" valign="top">a</th>
669
- <th align="left" valign="top">b</th>
670
- <th align="left" valign="top">c</th>
671
- </tr>
672
- </thead>
673
- <tbody>
674
- <tr>
675
- <td align="left" valign="top">a</td>
676
- <td align="left" valign="top">b</td>
677
- <td align="left" valign="top">c</td>
678
- </tr>
679
- </tbody>
680
- </table>
681
- </sections>
682
- </iso-standard>
683
- OUTPUT
684
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
685
- .to be_equivalent_to xmlpp(output)
686
- end
687
-
688
- it "moves table notes inside table" do
689
- input = <<~INPUT
690
- #{ASCIIDOC_BLANK_HDR}
691
- |===
692
- |a |b |c
693
- |===
694
-
695
- NOTE: Note 1
696
-
697
- NOTE: Note 2
698
- INPUT
699
- output = <<~OUTPUT
700
- #{BLANK_HDR}
701
- <sections>
702
- <table id="_">
703
- <tbody>
704
- <tr>
705
- <td align="left" valign="top">a</td>
706
- <td align="left" valign="top">b</td>
707
- <td align="left" valign="top">c</td>
708
- </tr>
709
- </tbody>
710
- <note id="_">
711
- <p id="_">Note 1</p>
712
- </note>
713
- <note id="_">
714
- <p id="_">Note 2</p>
715
- </note>
716
- </table>
717
- </sections>
718
- </iso-standard>
719
- OUTPUT
720
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
721
- .to be_equivalent_to xmlpp(output)
722
- end
723
-
724
- it "moves formula key inside formula" do
725
- input = <<~INPUT
726
- #{ASCIIDOC_BLANK_HDR}
727
- [stem]
728
- ++++
729
- Formula
730
- ++++
731
-
732
- where
733
-
734
- a:: b
735
- INPUT
736
- output = <<~OUTPUT
737
- #{BLANK_HDR}
738
- <sections>
739
- <formula id="_">
740
- <stem type="MathML">
741
- <math xmlns="http://www.w3.org/1998/Math/MathML">
742
- <mi>F</mi>
743
- <mi>or</mi>
744
- <mi>μ</mi>
745
- <mi>l</mi>
746
- <mi>a</mi>
747
- </math>
748
- </stem>
749
- <dl id="_" key="true">
750
- <dt>a</dt>
751
- <dd>
752
- <p id="_">b</p>
753
- </dd>
754
- </dl>
755
- </formula>
756
- </sections>
757
- </iso-standard>
758
- OUTPUT
759
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
760
- .to be_equivalent_to xmlpp(output)
761
- end
762
-
763
- it "moves footnotes inside figures" do
764
- input = <<~INPUT
765
- #{ASCIIDOC_BLANK_HDR}
766
- image::spec/examples/rice_images/rice_image1.png[]
767
-
768
- footnote:[This is a footnote to a figure]
769
-
770
- footnote:[This is another footnote to a figure]
771
- INPUT
772
- output = <<~OUTPUT
773
- #{BLANK_HDR}
774
- <sections>
775
- <figure id="_">
776
- <image height="auto" id="_" mimetype="image/png" src="spec/examples/rice_images/rice_image1.png" width="auto"/>
777
- <fn reference="a">
778
- <p id="_">This is a footnote to a figure</p>
779
- </fn>
780
- <fn reference="b">
781
- <p id="_">This is another footnote to a figure</p>
782
- </fn>
783
- </figure>
784
- </sections>
785
- </iso-standard>
786
- OUTPUT
787
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
788
- .to be_equivalent_to xmlpp(output)
789
- end
790
-
791
- it "moves figure key inside figure" do
792
- input = <<~INPUT
793
- #{ASCIIDOC_BLANK_HDR}
794
- image::spec/examples/rice_images/rice_image1.png[]
795
-
796
- Key
797
-
798
- a:: b
799
- INPUT
800
- output = <<~OUTPUT
801
- #{BLANK_HDR}
802
- <sections>
803
- <figure id="_">
804
- <image height="auto" id="_" mimetype="image/png" src="spec/examples/rice_images/rice_image1.png" width="auto"/>
805
- <dl id="_" key="true">
806
- <dt>a</dt>
807
- <dd>
808
- <p id="_">b</p>
809
- </dd>
810
- </dl>
811
- </figure>
812
- </sections>
813
- </iso-standard>
814
- OUTPUT
815
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
816
- .to be_equivalent_to xmlpp(output)
817
- end
818
-
819
- it "numbers bibliographic notes and footnotes sequentially" do
820
- input = <<~INPUT
821
- #{ASCIIDOC_BLANK_HDR}
822
- footnote:[Footnote]
823
-
824
- [bibliography]
825
- == Normative References
826
-
827
- * [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_
828
-
829
- == Clause
830
- footnote:[Footnote2]
831
- INPUT
832
- output = <<~OUTPUT
833
- #{BLANK_HDR}
834
- <preface>
835
- <foreword id="_" obligation="informative">
836
- <title>Foreword</title>
837
- <p id="_">
838
- <fn reference="1">
839
- <p id="_">Footnote</p>
840
- </fn>
841
- </p>
842
- </foreword>
843
- </preface>
844
- <sections>
845
- <clause id="_" inline-header="false" obligation="normative">
846
- <title>Clause</title>
847
- <p id="_">
848
- <fn reference="2">
849
- <p id="_">Footnote2</p>
850
- </fn>
851
- </p>
852
- </clause>
853
- </sections>
854
- <bibliography>
855
- <references id="_" normative="true" obligation="informative">
856
- <title>Normative references</title>
857
- <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
858
- <bibitem id="iso123" type="standard">
859
- <title format="text/plain">Standard</title>
860
- <docidentifier>ISO 123:—</docidentifier>
861
- <docnumber>123</docnumber>
862
- <date type="published">
863
- <on>–</on>
864
- </date>
865
- <contributor>
866
- <role type="publisher"/>
867
- <organization>
868
- <name>International Organization for Standardization</name>
869
- <abbreviation>ISO</abbreviation>
870
- </organization>
871
- </contributor>
872
- <note format="text/plain" type="Unpublished-Status">The standard is in press</note>
873
- </bibitem>
874
- </references>
875
- </bibliography>
876
- </iso-standard>
877
- OUTPUT
878
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
879
- .to be_equivalent_to xmlpp(output)
880
- end
881
-
882
- it "defaults section obligations" do
883
- input = <<~INPUT
884
- #{ASCIIDOC_BLANK_HDR}
885
-
886
- == Clause
887
- Text
888
-
889
- [appendix]
890
- == Clause
891
-
892
- Text
893
- INPUT
894
- output = <<~OUTPUT
895
- #{BLANK_HDR}
896
- <sections>
897
- <clause id="_" inline-header="false" obligation="normative">
898
- <title>Clause</title>
899
- <p id="_">Text</p>
900
- </clause>
901
- </sections>
902
- <annex id="_" inline-header="false" obligation="normative">
903
- <title>Clause</title>
904
- <p id="_">Text</p>
905
- </annex>
906
- </iso-standard>
907
- OUTPUT
908
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
909
- .to be_equivalent_to xmlpp(output)
910
- end
911
-
912
- it "extends clause levels past 5" do
913
- input = <<~INPUT
914
- #{ASCIIDOC_BLANK_HDR}
915
-
916
- == Clause1
917
-
918
- === Clause2
919
-
920
- ==== Clause3
921
-
922
- ===== Clause4
923
-
924
- ====== Clause 5
925
-
926
- [level=6]
927
- ====== Clause 6
928
-
929
- [level=7]
930
- ====== Clause 7A
931
-
932
- [level=7]
933
- ====== Clause 7B
934
-
935
- [level=6]
936
- ====== Clause 6B
937
-
938
- ====== Clause 5B
939
-
940
- INPUT
941
- output = <<~OUTPUT
942
- #{BLANK_HDR}
943
- <sections>
944
- <clause id="_" inline-header="false" obligation="normative">
945
- <title>Clause1</title>
946
- <clause id="_" inline-header="false" obligation="normative">
947
- <title>Clause2</title>
948
- <clause id="_" inline-header="false" obligation="normative">
949
- <title>Clause3</title>
950
- <clause id="_" inline-header="false" obligation="normative">
951
- <title>Clause4</title>
952
- <clause id="_" inline-header="false" obligation="normative">
953
- <title>Clause 5</title>
954
- <clause id="_" inline-header="false" obligation="normative">
955
- <title>Clause 6</title>
956
- <clause id="_" inline-header="false" obligation="normative">
957
- <title>Clause 7A</title>
958
- </clause>
959
- <clause id="_" inline-header="false" obligation="normative">
960
- <title>Clause 7B</title>
961
- </clause>
962
- </clause>
963
- <clause id="_" inline-header="false" obligation="normative">
964
- <title>Clause 6B</title>
965
- </clause>
966
- </clause>
967
- <clause id="_" inline-header="false" obligation="normative">
968
- <title>Clause 5B</title>
969
- </clause>
970
- </clause>
971
- </clause>
972
- </clause>
973
- </clause>
974
- </sections>
975
- </iso-standard>
976
- OUTPUT
977
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
978
- .to be_equivalent_to xmlpp(output)
979
- end
980
-
981
- it "reorders references in bibliography, and renumbers citations accordingly" do
982
- input = <<~INPUT
983
- #{ASCIIDOC_BLANK_HDR}
984
-
985
- == Clause 1
986
- <<ref1>>
987
- <<ref1a>>
988
- <<ref1b>>
989
- <<ref2>>
990
- <<ref3>>
991
- <<ref4>>
992
- <<ref5>>
993
- <<ref6>>
994
- <<ref7>>
995
- <<ref8>>
996
- <<ref9>>
997
- <<ref10>>
998
-
999
- [bibliography]
1000
- == Bibliography
1001
-
1002
- [bibliography]
1003
- === Clause 1
1004
- * [[[ref3,IEC 123]]], _Standard IEC 123_
1005
- * [[[ref5,20]]], _Standard 10_
1006
- * [[[ref1,ISO 123]]], _Standard ISO 123_
1007
- * [[[ref1a,ISO 123-100]]], _Standard ISO 123_
1008
- * [[[ref1b,ISO/TS 123-1]]], _Standard ISO 123_
1009
- * [[[ref4,GB 123]]], _Standard GB 123_
1010
- * [[[ref2,ISO/IEC 123]]], _Standard ISO/IEC 123_
1011
- * [[[ref6,(B)]]], _Standard 20_
1012
- * [[[ref7,(A)]]], _Standard 30_
1013
-
1014
- [bibliography]
1015
- === {blank}
1016
- * [[[ref15,20]]], _Standard 10_
1017
- * [[[ref14,GB 123]]], _Standard GB 123_
1018
- * [[[ref13,IEC 123]]], _Standard IEC 123_
1019
- * [[[ref11,ISO 123]]], _Standard ISO 123_
1020
- * [[[ref10,ISO/IEC 123]]], _Standard ISO/IEC 123_
1021
- * [[[ref16,(B)]]], _Standard 20_
1022
- * [[[ref17,(A)]]], _Standard 30_
1023
- INPUT
1024
- output = <<~OUTPUT
1025
- #{BLANK_HDR}
1026
- <sections>
1027
- <clause id='_' inline-header='false' obligation='normative'>
1028
- <title>Clause 1</title>
1029
- <p id='_'>
1030
- <eref type='inline' bibitemid='ref1' citeas='ISO 123'/>
1031
- <eref type='inline' bibitemid='ref1a' citeas='ISO 123-100'/>
1032
- <eref type='inline' bibitemid='ref1b' citeas='ISO/TS 123-1'/>
1033
- <eref type='inline' bibitemid='ref2' citeas='ISO/IEC 123'/>
1034
- <eref type='inline' bibitemid='ref3' citeas='IEC 123'/>
1035
- <eref type='inline' bibitemid='ref4' citeas='GB 123'/>
1036
- <eref type='inline' bibitemid='ref5' citeas='[7]'/>
1037
- <eref type='inline' bibitemid='ref6' citeas='[B]'/>
1038
- <eref type='inline' bibitemid='ref7' citeas='[A]'/>
1039
- <xref target='ref8'/>
1040
- <xref target='ref9'/>
1041
- <eref type='inline' bibitemid='ref10' citeas='ISO/IEC 123'/>
1042
- </p>
1043
- </clause>
1044
- </sections>
1045
- <bibliography>
1046
- <clause id='_' obligation='informative'>
1047
- <title>Bibliography</title>
1048
- <references id='_' normative='false' obligation='informative'>
1049
- <title>Clause 1</title>
1050
- <bibitem id='ref1' type='standard'>
1051
- <title format='text/plain'>Standard ISO 123</title>
1052
- <docidentifier>ISO 123</docidentifier>
1053
- <docnumber>123</docnumber>
1054
- <contributor>
1055
- <role type='publisher'/>
1056
- <organization>
1057
- <name>International Organization for Standardization</name>
1058
- <abbreviation>ISO</abbreviation>
1059
- </organization>
1060
- </contributor>
1061
- </bibitem>
1062
- <bibitem id='ref2' type='standard'>
1063
- <title format='text/plain'>Standard ISO/IEC 123</title>
1064
- <docidentifier>ISO/IEC 123</docidentifier>
1065
- <docnumber>123</docnumber>
1066
- <contributor>
1067
- <role type='publisher'/>
1068
- <organization>
1069
- <name>International Organization for Standardization</name>
1070
- <abbreviation>ISO</abbreviation>
1071
- </organization>
1072
- </contributor>
1073
- <contributor>
1074
- <role type='publisher'/>
1075
- <organization>
1076
- <name>International Electrotechnical Commission</name>
1077
- <abbreviation>IEC</abbreviation>
1078
- </organization>
1079
- </contributor>
1080
- </bibitem>
1081
- <bibitem id='ref1b' type='standard'>
1082
- <title format='text/plain'>Standard ISO 123</title>
1083
- <docidentifier>ISO/TS 123-1</docidentifier>
1084
- <docnumber>123-1</docnumber>
1085
- <contributor>
1086
- <role type='publisher'/>
1087
- <organization>
1088
- <name>International Organization for Standardization</name>
1089
- <abbreviation>ISO</abbreviation>
1090
- </organization>
1091
- </contributor>
1092
- <contributor>
1093
- <role type='publisher'/>
1094
- <organization>
1095
- <name>TS</name>
1096
- </organization>
1097
- </contributor>
1098
- </bibitem>
1099
- <bibitem id='ref1a' type='standard'>
1100
- <title format='text/plain'>Standard ISO 123</title>
1101
- <docidentifier>ISO 123-100</docidentifier>
1102
- <docnumber>123-100</docnumber>
1103
- <contributor>
1104
- <role type='publisher'/>
1105
- <organization>
1106
- <name>International Organization for Standardization</name>
1107
- <abbreviation>ISO</abbreviation>
1108
- </organization>
1109
- </contributor>
1110
- </bibitem>
1111
- <bibitem id='ref3' type='standard'>
1112
- <title format='text/plain'>Standard IEC 123</title>
1113
- <docidentifier>IEC 123</docidentifier>
1114
- <docnumber>123</docnumber>
1115
- <contributor>
1116
- <role type='publisher'/>
1117
- <organization>
1118
- <name>International Electrotechnical Commission</name>
1119
- <abbreviation>IEC</abbreviation>
1120
- </organization>
1121
- </contributor>
1122
- </bibitem>
1123
- <bibitem id='ref4'>
1124
- <formattedref format='application/x-isodoc+xml'>
1125
- <em>Standard GB 123</em>
1126
- </formattedref>
1127
- <docidentifier>GB 123</docidentifier>
1128
- <docnumber>123</docnumber>
1129
- </bibitem>
1130
- <bibitem id='ref5'>
1131
- <formattedref format='application/x-isodoc+xml'>
1132
- <em>Standard 10</em>
1133
- </formattedref>
1134
- <docidentifier type='metanorma'>[7]</docidentifier>
1135
- </bibitem>
1136
- <bibitem id='ref7'>
1137
- <formattedref format='application/x-isodoc+xml'>
1138
- <em>Standard 30</em>
1139
- </formattedref>
1140
- <docidentifier type='metanorma'>[A]</docidentifier>
1141
- </bibitem>
1142
- <bibitem id='ref6'>
1143
- <formattedref format='application/x-isodoc+xml'>
1144
- <em>Standard 20</em>
1145
- </formattedref>
1146
- <docidentifier type='metanorma'>[B]</docidentifier>
1147
- </bibitem>
1148
- </references>
1149
- <references id='_' normative='false' obligation='informative'>
1150
- <bibitem id='ref11' type='standard'>
1151
- <title format='text/plain'>Standard ISO 123</title>
1152
- <docidentifier>ISO 123</docidentifier>
1153
- <docnumber>123</docnumber>
1154
- <contributor>
1155
- <role type='publisher'/>
1156
- <organization>
1157
- <name>International Organization for Standardization</name>
1158
- <abbreviation>ISO</abbreviation>
1159
- </organization>
1160
- </contributor>
1161
- </bibitem>
1162
- <bibitem id='ref10' type='standard'>
1163
- <title format='text/plain'>Standard ISO/IEC 123</title>
1164
- <docidentifier>ISO/IEC 123</docidentifier>
1165
- <docnumber>123</docnumber>
1166
- <contributor>
1167
- <role type='publisher'/>
1168
- <organization>
1169
- <name>International Organization for Standardization</name>
1170
- <abbreviation>ISO</abbreviation>
1171
- </organization>
1172
- </contributor>
1173
- <contributor>
1174
- <role type='publisher'/>
1175
- <organization>
1176
- <name>International Electrotechnical Commission</name>
1177
- <abbreviation>IEC</abbreviation>
1178
- </organization>
1179
- </contributor>
1180
- </bibitem>
1181
- <bibitem id='ref13' type='standard'>
1182
- <title format='text/plain'>Standard IEC 123</title>
1183
- <docidentifier>IEC 123</docidentifier>
1184
- <docnumber>123</docnumber>
1185
- <contributor>
1186
- <role type='publisher'/>
1187
- <organization>
1188
- <name>International Electrotechnical Commission</name>
1189
- <abbreviation>IEC</abbreviation>
1190
- </organization>
1191
- </contributor>
1192
- </bibitem>
1193
- <bibitem id='ref14'>
1194
- <formattedref format='application/x-isodoc+xml'>
1195
- <em>Standard GB 123</em>
1196
- </formattedref>
1197
- <docidentifier>GB 123</docidentifier>
1198
- <docnumber>123</docnumber>
1199
- </bibitem>
1200
- <bibitem id='ref15'>
1201
- <formattedref format='application/x-isodoc+xml'>
1202
- <em>Standard 10</em>
1203
- </formattedref>
1204
- <docidentifier type='metanorma'>[14]</docidentifier>
1205
- </bibitem>
1206
- <bibitem id='ref17'>
1207
- <formattedref format='application/x-isodoc+xml'>
1208
- <em>Standard 30</em>
1209
- </formattedref>
1210
- <docidentifier type='metanorma'>[A]</docidentifier>
1211
- </bibitem>
1212
- <bibitem id='ref16'>
1213
- <formattedref format='application/x-isodoc+xml'>
1214
- <em>Standard 20</em>
1215
- </formattedref>
1216
- <docidentifier type='metanorma'>[B]</docidentifier>
1217
- </bibitem>
1218
- </references>
1219
- </clause>
1220
- </bibliography>
1221
- </iso-standard>
1222
- OUTPUT
1223
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1224
- .to be_equivalent_to xmlpp(output)
1225
- end
1226
-
1227
- context "terms & definitions boilerplate" do
1228
- it "places normal terms & definitions boilerplate in flat clause" do
1229
- input = <<~INPUT
1230
- #{ASCIIDOC_BLANK_HDR}
1231
-
1232
- == Terms and definitions
1233
-
1234
- === Term1
1235
- INPUT
1236
- output = <<~OUTPUT
1237
- #{BLANK_HDR}
1238
- <sections>
1239
- <terms id='_' obligation='normative'>
1240
- <title>Terms and definitions</title>
1241
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1242
- <p id='_'>
1243
- ISO and IEC maintain terminology databases for use in standardization
1244
- at the following addresses:
1245
- </p>
1246
- <ul id='_'>
1247
- <li>
1248
- <p id='_'>
1249
- ISO Online browsing platform: available at
1250
- <link target='https://www.iso.org/obp'/>
1251
- </p>
1252
- </li>
1253
- <li>
1254
- <p id='_'>
1255
- IEC Electropedia: available at
1256
- <link target='https://www.electropedia.org'/>
1257
- </p>
1258
- </li>
1259
- </ul>
1260
- <term id='term-Term1'>
1261
- <preferred><expression><name>Term1</name></expression></preferred>
1262
- </term>
1263
- </terms>
1264
- </sections>
1265
- </iso-standard>
1266
- OUTPUT
1267
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1268
- .to be_equivalent_to xmlpp(output)
1269
- end
1270
-
1271
- it "places normal terms & definitions boilerplate in multi-clause" do
1272
- input = <<~INPUT
1273
- #{ASCIIDOC_BLANK_HDR}
1274
-
1275
- == Terms and definitions
1276
-
1277
- === Normal Terms
1278
-
1279
- ==== Term1
1280
-
1281
- === Abnormal terms
1282
-
1283
- ==== Term 2
1284
- INPUT
1285
- output = <<~OUTPUT
1286
- #{BLANK_HDR}
1287
- <sections>
1288
- <clause id='_' obligation='normative'>
1289
- <title>Terms and definitions</title>
1290
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1291
- <p id='_'>
1292
- ISO and IEC maintain terminology databases for use in standardization
1293
- at the following addresses:
1294
- </p>
1295
- <ul id='_'>
1296
- <li>
1297
- <p id='_'>
1298
- ISO Online browsing platform: available at
1299
- <link target='https://www.iso.org/obp'/>
1300
- </p>
1301
- </li>
1302
- <li>
1303
- <p id='_'>
1304
- IEC Electropedia: available at
1305
- <link target='https://www.electropedia.org'/>
1306
- </p>
1307
- </li>
1308
- </ul>
1309
- <terms id='_' obligation='normative'>
1310
- <title>Normal Terms</title>
1311
- <term id='term-Term1'>
1312
- <preferred><expression><name>Term1</name></expression></preferred>
1313
- </term>
1314
- </terms>
1315
- <terms id='_' obligation='normative'>
1316
- <title>Abnormal terms</title>
1317
- <term id='term-Term-2'>
1318
- <preferred><expression><name>Term 2</name></expression></preferred>
1319
- </term>
1320
- </terms>
1321
- </clause>
1322
- </sections>
1323
- </iso-standard>
1324
- OUTPUT
1325
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1326
- .to be_equivalent_to xmlpp(output)
1327
- end
1328
-
1329
- it "places normal terms & definitions boilerplate in single clause that excludes symbols" do
1330
- input = <<~INPUT
1331
- #{ASCIIDOC_BLANK_HDR}
1332
-
1333
- == Terms, definitions, symbols and abbreviated terms
1334
-
1335
- === Terms and definitions
1336
-
1337
- ==== Normal Terms
1338
-
1339
- ===== Term1
1340
-
1341
- ==== Abnormal terms
1342
-
1343
- ===== Term 2
1344
-
1345
- === Symbols and abbreviated terms
1346
- INPUT
1347
- output = <<~OUTPUT
1348
- #{BLANK_HDR}
1349
- <sections>
1350
- <clause id='_' obligation='normative'>
1351
- <title>Terms, definitions, symbols and abbreviated terms</title>
1352
- <clause id='_' obligation='normative'>
1353
- <title>Terms and definitions</title>
1354
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1355
- <p id='_'>
1356
- ISO and IEC maintain terminology databases for use in
1357
- standardization at the following addresses:
1358
- </p>
1359
- <ul id='_'>
1360
- <li>
1361
- <p id='_'>
1362
- ISO Online browsing platform: available at
1363
- <link target='https://www.iso.org/obp'/>
1364
- </p>
1365
- </li>
1366
- <li>
1367
- <p id='_'>
1368
- IEC Electropedia: available at
1369
- <link target='https://www.electropedia.org'/>
1370
- </p>
1371
- </li>
1372
- </ul>
1373
- <terms id='_' obligation='normative'>
1374
- <title>Normal Terms</title>
1375
- <term id='term-Term1'>
1376
- <preferred><expression><name>Term1</name></expression></preferred>
1377
- </term>
1378
- </terms>
1379
- <terms id='_' obligation='normative'>
1380
- <title>Abnormal terms</title>
1381
- <term id='term-Term-2'>
1382
- <preferred><expression><name>Term 2</name></expression></preferred>
1383
- </term>
1384
- </terms>
1385
- </clause>
1386
- <definitions id='_' obligation='normative'>
1387
- <title>Symbols and abbreviated terms</title>
1388
- </definitions>
1389
- </clause>
1390
- </sections>
1391
- </iso-standard>
1392
- OUTPUT
1393
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1394
- .to be_equivalent_to xmlpp(output)
1395
- end
1396
-
1397
- it "places normal terms & definitions boilerplate in first of multiple clauses that excludes symbols" do
1398
- input = <<~INPUT
1399
- #{ASCIIDOC_BLANK_HDR}
1400
-
1401
- == Terms, definitions, symbols and abbreviated terms
1402
-
1403
- === Terms and definitions
1404
-
1405
- ==== Term1
1406
-
1407
- [heading=terms]
1408
- === Other Terms
1409
-
1410
- ==== Term 2
1411
-
1412
- === Symbols and abbreviated terms
1413
- INPUT
1414
- output = <<~OUTPUT
1415
- #{BLANK_HDR}
1416
- <sections>
1417
- <clause id='_' obligation='normative'>
1418
- <title>Terms, definitions, symbols and abbreviated terms</title>
1419
- <terms id='_' obligation='normative'>
1420
- <title>Terms and definitions</title>
1421
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1422
- <p id='_'>
1423
- ISO and IEC maintain terminology databases for use in
1424
- standardization at the following addresses:
1425
- </p>
1426
- <ul id='_'>
1427
- <li>
1428
- <p id='_'>
1429
- ISO Online browsing platform: available at
1430
- <link target='https://www.iso.org/obp'/>
1431
- </p>
1432
- </li>
1433
- <li>
1434
- <p id='_'>
1435
- IEC Electropedia: available at
1436
- <link target='https://www.electropedia.org'/>
1437
- </p>
1438
- </li>
1439
- </ul>
1440
- <term id='term-Term1'>
1441
- <preferred><expression><name>Term1</name></expression></preferred>
1442
- </term>
1443
- </terms>
1444
- <terms id='_' obligation='normative'>
1445
- <title>Other Terms</title>
1446
- <term id='term-Term-2'>
1447
- <preferred><expression><name>Term 2</name></expression></preferred>
1448
- </term>
1449
- </terms>
1450
- <definitions id='_' obligation='normative'>
1451
- <title>Symbols and abbreviated terms</title>
1452
- </definitions>
1453
- </clause>
1454
- </sections>
1455
- </iso-standard>
1456
- OUTPUT
1457
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1458
- .to be_equivalent_to xmlpp(output)
1459
- end
1460
-
1461
- it "modifies normal terms & definitions boilerplate in vocabulary document" do
1462
- input = <<~INPUT
1463
- = Document title
1464
- Author
1465
- :docfile: test.adoc
1466
- :nodoc:
1467
- :novalid:
1468
- :no-isobib:
1469
- :docsubtype: vocabulary
1470
-
1471
- == Terms and definitions
1472
-
1473
- === Term1
1474
- INPUT
1475
- output = <<~OUTPUT
1476
- #{BLANK_HDR.sub(%r{</doctype>}, '</doctype><subdoctype>vocabulary</subdoctype>')}
1477
- <sections>
1478
- <terms id='_' obligation='normative'>
1479
- <title>Terms and definitions</title>
1480
- <p id='_'>
1481
- ISO and IEC maintain terminology databases for use in standardization
1482
- at the following addresses:
1483
- </p>
1484
- <ul id='_'>
1485
- <li>
1486
- <p id='_'>
1487
- ISO Online browsing platform: available at
1488
- <link target='https://www.iso.org/obp'/>
1489
- </p>
1490
- </li>
1491
- <li>
1492
- <p id='_'>
1493
- IEC Electropedia: available at
1494
- <link target='https://www.electropedia.org'/>
1495
- </p>
1496
- </li>
1497
- </ul>
1498
- <term id='term-Term1'>
1499
- <preferred><expression><name>Term1</name></expression></preferred>
1500
- </term>
1501
- </terms>
1502
- </sections>
1503
- </iso-standard>
1504
- OUTPUT
1505
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1506
- .to be_equivalent_to xmlpp(output)
1507
- end
1508
-
1509
- it "does not allows subterms outside of vocabulary document" do
1510
- input = <<~INPUT
1511
- = Document title
1512
- Author
1513
- :docfile: test.adoc
1514
- :nodoc:
1515
- :novalid:
1516
- :no-isobib:
1517
-
1518
- == Terms and definitions
1519
-
1520
- === Term1
1521
-
1522
- === Term2
1523
-
1524
- ==== Term2a
1525
- INPUT
1526
- output = <<~OUTPUT
1527
- #{BLANK_HDR}
1528
- <sections>
1529
- <clause id='_' obligation='normative'>
1530
- <title>Terms and definitions</title>
1531
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1532
- <p id='_'>
1533
- ISO and IEC maintain terminology databases for use in standardization at
1534
- the following addresses:
1535
- </p>
1536
- <ul id='_'>
1537
- <li>
1538
- <p id='_'>
1539
- ISO Online browsing platform: available at
1540
- <link target='https://www.iso.org/obp'/>
1541
- </p>
1542
- </li>
1543
- <li>
1544
- <p id='_'>
1545
- IEC Electropedia: available at
1546
- <link target='https://www.electropedia.org'/>
1547
- </p>
1548
- </li>
1549
- </ul>
1550
- <term id='term-Term1'>
1551
- <preferred>
1552
- <expression>
1553
- <name>Term1</name>
1554
- </expression>
1555
- </preferred>
1556
- </term>
1557
- <terms id='_' obligation='normative'>
1558
- <title>Term2</title>
1559
- <term id='term-Term2a'>
1560
- <preferred>
1561
- <expression>
1562
- <name>Term2a</name>
1563
- </expression>
1564
- </preferred>
1565
- </term>
1566
- </terms>
1567
- </clause>
1568
- </sections>
1569
- </iso-standard>
1570
- OUTPUT
1571
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1572
- .to be_equivalent_to xmlpp(output)
1573
- end
1574
-
1575
- it "allows subterms in vocabulary document" do
1576
- input = <<~INPUT
1577
- = Document title
1578
- Author
1579
- :docfile: test.adoc
1580
- :nodoc:
1581
- :novalid:
1582
- :no-isobib:
1583
- :docsubtype: vocabulary
1584
-
1585
- == Terms and definitions
1586
-
1587
- === Term1
1588
-
1589
- === Term2
1590
-
1591
- ==== Term2a
1592
- INPUT
1593
- output = <<~OUTPUT
1594
- #{BLANK_HDR.sub(%r{</doctype>}, '</doctype><subdoctype>vocabulary</subdoctype>')}
1595
- <sections>
1596
- <terms id='_' obligation='normative'>
1597
- <title>Terms and definitions</title>
1598
- <p id='_'>
1599
- ISO and IEC maintain terminology databases for use in standardization at
1600
- the following addresses:
1601
- </p>
1602
- <ul id='_'>
1603
- <li>
1604
- <p id='_'>
1605
- ISO Online browsing platform: available at
1606
- <link target='https://www.iso.org/obp'/>
1607
- </p>
1608
- </li>
1609
- <li>
1610
- <p id='_'>
1611
- IEC Electropedia: available at
1612
- <link target='https://www.electropedia.org'/>
1613
- </p>
1614
- </li>
1615
- </ul>
1616
- <term id='term-Term1'>
1617
- <preferred>
1618
- <expression>
1619
- <name>Term1</name>
1620
- </expression>
1621
- </preferred>
1622
- </term>
1623
- <term id='term-Term2'>
1624
- <preferred>
1625
- <expression>
1626
- <name>Term2</name>
1627
- </expression>
1628
- </preferred>
1629
- <term id='term-Term2a'>
1630
- <preferred>
1631
- <expression>
1632
- <name>Term2a</name>
1633
- </expression>
1634
- </preferred>
1635
- </term>
1636
- </term>
1637
- </terms>
1638
- </sections>
1639
- </iso-standard>
1640
- OUTPUT
1641
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1642
- .to be_equivalent_to xmlpp(output)
1643
- end
1644
- end
1645
- end