metanorma-iso 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +11 -41
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +6 -2
  5. data/lib/asciidoctor/iso/base.rb +12 -12
  6. data/lib/asciidoctor/iso/biblio.rng +4 -6
  7. data/lib/asciidoctor/iso/cleanup.rb +1 -1
  8. data/lib/asciidoctor/iso/front.rb +1 -1
  9. data/lib/asciidoctor/iso/front_id.rb +30 -25
  10. data/lib/asciidoctor/iso/isodoc.rng +235 -3
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +17 -97
  13. data/lib/asciidoctor/iso/validate.rb +1 -0
  14. data/lib/asciidoctor/iso/validate_title.rb +21 -13
  15. data/lib/isodoc/iso/base_convert.rb +11 -0
  16. data/lib/isodoc/iso/html/style-human.css +7 -0
  17. data/lib/isodoc/iso/html/style-iso.css +7 -0
  18. data/lib/isodoc/iso/html_convert.rb +0 -1
  19. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  20. data/lib/isodoc/iso/i18n-fr.yaml +4 -0
  21. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  22. data/lib/isodoc/iso/index.rb +140 -0
  23. data/lib/isodoc/iso/iso.amendment.xsl +1010 -324
  24. data/lib/isodoc/iso/iso.international-standard.xsl +1010 -324
  25. data/lib/isodoc/iso/presentation_xml_convert.rb +32 -25
  26. data/lib/isodoc/iso/word_convert.rb +0 -1
  27. data/lib/isodoc/iso/xref.rb +13 -5
  28. data/lib/metanorma/iso/version.rb +1 -1
  29. data/metanorma-iso.gemspec +8 -8
  30. data/spec/asciidoctor/amd_spec.rb +696 -0
  31. data/spec/asciidoctor/base_spec.rb +704 -0
  32. data/spec/asciidoctor/blocks_spec.rb +527 -0
  33. data/spec/asciidoctor/cleanup_spec.rb +1134 -0
  34. data/spec/asciidoctor/inline_spec.rb +195 -0
  35. data/spec/asciidoctor/lists_spec.rb +197 -0
  36. data/spec/asciidoctor/refs_spec.rb +375 -0
  37. data/spec/asciidoctor/section_spec.rb +393 -0
  38. data/spec/asciidoctor/table_spec.rb +329 -0
  39. data/spec/asciidoctor/validate_spec.rb +1572 -0
  40. data/spec/isodoc/amd_spec.rb +967 -946
  41. data/spec/isodoc/blocks_spec.rb +530 -507
  42. data/spec/isodoc/i18n_spec.rb +953 -911
  43. data/spec/isodoc/inline_spec.rb +355 -293
  44. data/spec/isodoc/iso_spec.rb +338 -314
  45. data/spec/isodoc/metadata_spec.rb +392 -382
  46. data/spec/isodoc/postproc_spec.rb +837 -657
  47. data/spec/isodoc/ref_spec.rb +374 -331
  48. data/spec/isodoc/section_spec.rb +821 -519
  49. data/spec/isodoc/table_spec.rb +472 -411
  50. data/spec/isodoc/terms_spec.rb +209 -185
  51. data/spec/isodoc/xref_spec.rb +1370 -1236
  52. data/spec/metanorma/processor_spec.rb +28 -26
  53. data/spec/spec_helper.rb +186 -189
  54. metadata +65 -67
  55. data/.rubocop.ribose.yml +0 -66
  56. data/lib/isodoc/iso/html/scripts.html +0 -178
  57. data/spec/asciidoctor-iso/amd_spec.rb +0 -694
  58. data/spec/asciidoctor-iso/base_spec.rb +0 -713
  59. data/spec/asciidoctor-iso/blocks_spec.rb +0 -482
  60. data/spec/asciidoctor-iso/cleanup_spec.rb +0 -1025
  61. data/spec/asciidoctor-iso/inline_spec.rb +0 -170
  62. data/spec/asciidoctor-iso/lists_spec.rb +0 -190
  63. data/spec/asciidoctor-iso/refs_spec.rb +0 -317
  64. data/spec/asciidoctor-iso/section_spec.rb +0 -362
  65. data/spec/asciidoctor-iso/table_spec.rb +0 -313
  66. data/spec/asciidoctor-iso/validate_spec.rb +0 -1619
  67. data/spec/assets/xref_error.adoc +0 -7
@@ -1,1025 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe Asciidoctor::ISO do
4
- it "removes empty text elements" do
5
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
- #{ASCIIDOC_BLANK_HDR}
7
- == {blank}
8
- INPUT
9
- #{BLANK_HDR}
10
- <sections>
11
- <clause id="_" inline-header="false" obligation="normative">
12
-
13
- </clause>
14
- </sections>
15
- </iso-standard>
16
- OUTPUT
17
- end
18
-
19
- it "processes stem-only terms as admitted" do
20
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
21
- #{ASCIIDOC_BLANK_HDR}
22
- == Terms and Definitions
23
-
24
- === stem:[t_90]
25
-
26
- stem:[t_91]
27
-
28
- Time
29
- INPUT
30
- #{BLANK_HDR}
31
- <sections>
32
- <terms id="_" obligation="normative">
33
- <title>Terms and definitions</title>
34
- #{TERM_BOILERPLATE}
35
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
36
- <mi>t</mi>
37
- </mrow>
38
- <mrow>
39
- <mn>90</mn>
40
- </mrow>
41
- </msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
42
- <mi>t</mi>
43
- </mrow>
44
- <mrow>
45
- <mn>91</mn>
46
- </mrow>
47
- </msub></math></stem></admitted>
48
- <definition><p id="_">Time</p></definition></term>
49
- </terms>
50
- </sections>
51
- </iso-standard>
52
- OUTPUT
53
- end
54
-
55
- it "moves term domains out of the term definition paragraph" do
56
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
57
- #{ASCIIDOC_BLANK_HDR}
58
- == Terms and Definitions
59
-
60
- === Tempus
61
-
62
- domain:[relativity] Time
63
- INPUT
64
- #{BLANK_HDR}
65
- <sections>
66
- <terms id="_" obligation="normative">
67
- <title>Terms and definitions</title>
68
- #{TERM_BOILERPLATE}
69
- <term id="term-tempus">
70
- <preferred>Tempus</preferred>
71
- <domain>relativity</domain><definition><p id="_"> Time</p></definition>
72
- </term>
73
- </terms>
74
- </sections>
75
- </iso-standard>
76
- OUTPUT
77
- end
78
-
79
- it "permits multiple blocks in term definition paragraph" do
80
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
81
- = Document title
82
- Author
83
- :docfile: test.adoc
84
- :nodoc:
85
- :novalid:
86
- :stem:
87
- :no-isobib:
88
-
89
- == Terms and Definitions
90
-
91
- === stem:[t_90]
92
-
93
- [stem]
94
- ++++
95
- t_A
96
- ++++
97
-
98
- This paragraph is extraneous
99
- INPUT
100
- #{BLANK_HDR}
101
- <sections>
102
- <terms id="_" obligation="normative">
103
- <title>Terms and definitions</title>
104
- #{TERM_BOILERPLATE}
105
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
106
- <mi>t</mi>
107
- </mrow>
108
- <mrow>
109
- <mn>90</mn>
110
- </mrow>
111
- </msub></math></stem></preferred><definition><formula id="_">
112
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
113
- <mi>t</mi>
114
- </mrow>
115
- <mrow>
116
- <mi>A</mi>
117
- </mrow>
118
- </msub></math></stem>
119
- </formula><p id="_">This paragraph is extraneous</p></definition>
120
- </term>
121
- </terms>
122
- </sections>
123
- </iso-standard>
124
- OUTPUT
125
- end
126
-
127
- it "keeps any initial boilerplate from terms and definitions" do
128
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
129
- #{ASCIIDOC_BLANK_HDR}
130
- == Terms and Definitions
131
-
132
- I am boilerplate
133
-
134
- * So am I
135
-
136
- === Time
137
-
138
- This paragraph is extraneous
139
- INPUT
140
- #{BLANK_HDR}
141
- <sections>
142
- <terms id="_" obligation="normative"><title>Terms and definitions</title>
143
-
144
- #{TERM_BOILERPLATE}
145
- <p id='_'>I am boilerplate</p>
146
- <ul id='_'>
147
- <li>
148
- <p id='_'>So am I</p>
149
- </li>
150
- </ul>
151
- <term id="term-time">
152
- <preferred>Time</preferred>
153
- <definition><p id="_">This paragraph is extraneous</p></definition>
154
- </term></terms>
155
- </sections>
156
- </iso-standard>
157
- OUTPUT
158
- end
159
-
160
- it "moves notes inside preceding blocks, if they are not at clause end, and the blocks are not delimited" do
161
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
162
- #{ASCIIDOC_BLANK_HDR}
163
- [stem]
164
- ++++
165
- r = 1 %
166
- r = 1 %
167
- ++++
168
-
169
- NOTE: That formula does not do much
170
-
171
- Indeed.
172
- INPUT
173
- #{BLANK_HDR}
174
- <sections><formula id="_">
175
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi></math></stem>
176
- <note id="_">
177
- <p id="_">That formula does not do much</p>
178
- </note></formula>
179
-
180
- <p id="_">Indeed.</p></sections>
181
- </iso-standard>
182
- OUTPUT
183
- end
184
-
185
- it "does not move notes inside preceding blocks, if they are at clause end" do
186
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
187
- #{ASCIIDOC_BLANK_HDR}
188
- [source,ruby]
189
- [1...x].each do |y|
190
- puts y
191
- end
192
-
193
- NOTE: That loop does not do much
194
- INPUT
195
- #{BLANK_HDR}
196
- <sections><sourcecode lang="ruby" id="_">[1...x].each do |y|
197
- puts y
198
- end</sourcecode>
199
- <note id="_">
200
- <p id="_">That loop does not do much</p>
201
- </note></sections>
202
- </iso-standard>
203
- OUTPUT
204
- end
205
-
206
- it "converts xrefs to references into erefs" do
207
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
208
- #{ASCIIDOC_BLANK_HDR}
209
- <<iso216>>
210
-
211
- [bibliography]
212
- == Normative References
213
- * [[[iso216,ISO 216:2001]]], _Reference_
214
- INPUT
215
- #{BLANK_HDR}
216
- <preface><foreword id='_' obligation="informative">
217
- <title>Foreword</title>
218
- <p id="_">
219
- <eref type="inline" bibitemid="iso216" citeas="ISO 216:2001"/>
220
- </p>
221
- </foreword></preface><sections>
222
- </sections><bibliography><references id="_" obligation="informative" normative="true">
223
- <title>Normative references</title>
224
- <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>
225
- <bibitem id="iso216" type="standard">
226
- <title format="text/plain">Reference</title>
227
- <docidentifier>ISO 216:2001</docidentifier>
228
- <docnumber>216</docnumber>
229
- <date type="published">
230
- <on>2001</on>
231
- </date>
232
- <contributor>
233
- <role type="publisher"/>
234
- <organization>
235
- <name>International Organization for Standardization</name>
236
- <abbreviation>ISO</abbreviation>
237
- </organization>
238
- </contributor>
239
- </bibitem>
240
- </references>
241
- </bibliography>
242
- </iso-standard>
243
- OUTPUT
244
- end
245
-
246
- it "extracts localities from erefs" do
247
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
248
- #{ASCIIDOC_BLANK_HDR}
249
- <<iso216,whole,clause=3,example=9-11,locality:prelude=33,locality:entirety:the reference>>
250
-
251
- [bibliography]
252
- == Normative References
253
- * [[[iso216,ISO 216]]], _Reference_
254
- INPUT
255
- #{BLANK_HDR}
256
- <preface><foreword id='_' obligation="informative">
257
- <title>Foreword</title>
258
- <p id="_">
259
- <eref type="inline" bibitemid="iso216" citeas="ISO 216">
260
- <localityStack>
261
- <locality type="whole"/><locality type="clause"><referenceFrom>3</referenceFrom></locality><locality type="example"><referenceFrom>9</referenceFrom><referenceTo>11</referenceTo></locality><locality type="locality:prelude"><referenceFrom>33</referenceFrom></locality><locality type="locality:entirety"/>
262
- </localityStack>the reference</eref>
263
- </p>
264
- </foreword></preface><sections>
265
- </sections><bibliography><references id="_" obligation="informative" normative="true">
266
- <title>Normative references</title>
267
- <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>
268
- <bibitem id="iso216" type="standard">
269
- <title format="text/plain">Reference</title>
270
- <docidentifier>ISO 216</docidentifier>
271
- <docnumber>216</docnumber>
272
- <contributor>
273
- <role type="publisher"/>
274
- <organization>
275
- <name>International Organization for Standardization</name>
276
- <abbreviation>ISO</abbreviation>
277
- </organization>
278
- </contributor>
279
- </bibitem>
280
- </references>
281
- </bibliography>
282
- </iso-standard>
283
- OUTPUT
284
- end
285
-
286
-
287
- it "strips type from xrefs" do
288
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
289
- #{ASCIIDOC_BLANK_HDR}
290
- <<iso216>>
291
-
292
- [bibliography]
293
- == Clause
294
- * [[[iso216,ISO 216]]], _Reference_
295
- INPUT
296
- #{BLANK_HDR}
297
- <preface>
298
- <foreword id='_' obligation="informative">
299
- <title>Foreword</title>
300
- <p id="_">
301
- <eref type="inline" bibitemid="iso216" citeas="ISO 216"/>
302
- </p>
303
- </foreword></preface><sections>
304
- </sections><bibliography><references id="_" obligation="informative" normative="false">
305
- <title>Bibliography</title>
306
- <bibitem id="iso216" type="standard">
307
- <title format="text/plain">Reference</title>
308
- <docidentifier>ISO 216</docidentifier>
309
- <docnumber>216</docnumber>
310
- <contributor>
311
- <role type="publisher"/>
312
- <organization>
313
- <name>International Organization for Standardization</name>
314
- <abbreviation>ISO</abbreviation>
315
- </organization>
316
- </contributor>
317
- </bibitem>
318
- </references></bibliography>
319
- </iso-standard>
320
- OUTPUT
321
- end
322
-
323
- it "processes localities in term sources" do
324
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
325
- #{ASCIIDOC_BLANK_HDR}
326
- == Terms and Definitions
327
-
328
- === Term1
329
-
330
- [.source]
331
- <<ISO2191,section=1>>
332
- INPUT
333
- #{BLANK_HDR}
334
- <sections>
335
- <terms id="_" obligation="normative">
336
- <title>Terms and definitions</title>
337
- #{TERM_BOILERPLATE}
338
- <term id="term-term1">
339
- <preferred>Term1</preferred>
340
- <termsource status="identical">
341
- <origin bibitemid="ISO2191" type="inline" citeas="">
342
- <localityStack>
343
- <locality type="section"><referenceFrom>1</referenceFrom></locality>
344
- </localityStack>
345
- </origin>
346
- </termsource>
347
- </term>
348
- </terms>
349
- </sections>
350
- </iso-standard>
351
- OUTPUT
352
- end
353
-
354
- it "removes extraneous material from Normative References" do
355
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
356
- #{ASCIIDOC_BLANK_HDR}
357
- [bibliography]
358
- == Normative References
359
-
360
- This is extraneous information
361
-
362
- * [[[iso216,ISO 216]]], _Reference_
363
- INPUT
364
- #{BLANK_HDR}
365
- <sections></sections>
366
- <bibliography><references id="_" obligation="informative" normative="true"><title>Normative references</title>
367
- <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>
368
- <bibitem id="iso216" type="standard">
369
- <title format="text/plain">Reference</title>
370
- <docidentifier>ISO 216</docidentifier>
371
- <docnumber>216</docnumber>
372
- <contributor>
373
- <role type="publisher"/>
374
- <organization>
375
- <name>International Organization for Standardization</name>
376
- <abbreviation>ISO</abbreviation>
377
- </organization>
378
- </contributor>
379
- </bibitem>
380
- </references>
381
- </bibliography>
382
- </iso-standard>
383
- OUTPUT
384
- end
385
-
386
- it "inserts IDs into paragraphs" do
387
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
388
- #{ASCIIDOC_BLANK_HDR}
389
- Paragraph
390
- INPUT
391
- #{BLANK_HDR}
392
- <sections>
393
- <p id="_">Paragraph</p>
394
- </sections>
395
- </iso-standard>
396
- OUTPUT
397
- end
398
-
399
- it "inserts IDs into notes" do
400
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
401
- #{ASCIIDOC_BLANK_HDR}
402
- [example]
403
- ====
404
- NOTE: This note has no ID
405
- ====
406
- INPUT
407
- #{BLANK_HDR}
408
- <sections>
409
- <example id="_">
410
- <note id="_">
411
- <p id="_">This note has no ID</p>
412
- </note>
413
- </example>
414
- </sections>
415
- </iso-standard>
416
- OUTPUT
417
- end
418
-
419
- it "moves table key inside table" do
420
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
421
- #{ASCIIDOC_BLANK_HDR}
422
- |===
423
- |a |b |c
424
- |===
425
-
426
- Key
427
-
428
- a:: b
429
- INPUT
430
- #{BLANK_HDR}
431
- <sections><table id="_">
432
- <tbody>
433
- <tr>
434
- <td valign="top" align="left">a</td>
435
- <td valign="top" align="left">b</td>
436
- <td valign="top" align="left">c</td>
437
- </tr>
438
- </tbody>
439
- <dl id="_" key="true">
440
- <dt>a</dt>
441
- <dd>
442
- <p id="_">b</p>
443
- </dd>
444
- </dl></table>
445
-
446
- </sections>
447
- </iso-standard>
448
- OUTPUT
449
- end
450
-
451
- it "processes headerrows attribute for table without header rows" do
452
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
453
- #{ASCIIDOC_BLANK_HDR}
454
- [headerrows=3]
455
- |===
456
- |a |b |c
457
- |a |b |c
458
- |a |b |c
459
- |a |b |c
460
- |===
461
- INPUT
462
- #{BLANK_HDR}
463
- <sections>
464
- <table id="_"><thead><tr>
465
- <th valign="top" align="left">a</th>
466
- <th valign="top" align="left">b</th>
467
- <th valign="top" align="left">c</th>
468
- </tr><tr>
469
- <th valign="top" align="left">a</th>
470
- <th valign="top" align="left">b</th>
471
- <th valign="top" align="left">c</th>
472
- </tr><tr>
473
- <th valign="top" align="left">a</th>
474
- <th valign="top" align="left">b</th>
475
- <th valign="top" align="left">c</th>
476
- </tr></thead>
477
- <tbody>
478
- <tr>
479
- <td valign="top" align="left">a</td>
480
- <td valign="top" align="left">b</td>
481
- <td valign="top" align="left">c</td>
482
- </tr>
483
- </tbody>
484
- </table>
485
- </sections>
486
- </iso-standard>
487
- OUTPUT
488
- end
489
-
490
- it "processes headerrows attribute for table with header rows" do
491
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
492
- #{ASCIIDOC_BLANK_HDR}
493
- [headerrows=3]
494
- |===
495
- |a |b |c
496
-
497
- |a |b |c
498
- |a |b |c
499
- |a |b |c
500
- |===
501
- INPUT
502
- #{BLANK_HDR}
503
- <sections>
504
- <table id="_">
505
- <thead>
506
- <tr>
507
- <th valign="top" align="left">a</th>
508
- <th valign="top" align="left">b</th>
509
- <th valign="top" align="left">c</th>
510
- </tr>
511
- <tr>
512
- <th valign="top" align="left">a</th>
513
- <th valign="top" align="left">b</th>
514
- <th valign="top" align="left">c</th>
515
- </tr><tr>
516
- <th valign="top" align="left">a</th>
517
- <th valign="top" align="left">b</th>
518
- <th valign="top" align="left">c</th>
519
- </tr></thead>
520
- <tbody>
521
-
522
-
523
- <tr>
524
- <td valign="top" align="left">a</td>
525
- <td valign="top" align="left">b</td>
526
- <td valign="top" align="left">c</td>
527
- </tr>
528
- </tbody>
529
- </table>
530
- </sections>
531
- </iso-standard>
532
- OUTPUT
533
- end
534
-
535
- it "moves table notes inside table" do
536
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
537
- #{ASCIIDOC_BLANK_HDR}
538
- |===
539
- |a |b |c
540
- |===
541
-
542
- NOTE: Note 1
543
-
544
- NOTE: Note 2
545
- INPUT
546
- #{BLANK_HDR}
547
- <sections><table id="_">
548
- <tbody>
549
- <tr>
550
- <td valign="top" align="left">a</td>
551
- <td valign="top" align="left">b</td>
552
- <td valign="top" align="left">c</td>
553
- </tr>
554
- </tbody>
555
- <note id="_">
556
- <p id="_">Note 1</p>
557
- </note><note id="_">
558
- <p id="_">Note 2</p>
559
- </note></table>
560
-
561
- </sections>
562
- </iso-standard>
563
- OUTPUT
564
- end
565
-
566
- it "moves formula key inside formula" do
567
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
568
- #{ASCIIDOC_BLANK_HDR}
569
- [stem]
570
- ++++
571
- Formula
572
- ++++
573
-
574
- where
575
-
576
- a:: b
577
- INPUT
578
- #{BLANK_HDR}
579
- <sections><formula id="_">
580
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>F</mi><mi>or</mi><mi>μ</mi><mi>l</mi><mi>a</mi></math></stem>
581
- <dl id="_" key="true">
582
- <dt>a</dt>
583
- <dd>
584
- <p id="_">b</p>
585
- </dd>
586
- </dl></formula>
587
-
588
- </sections>
589
- </iso-standard>
590
- OUTPUT
591
- end
592
-
593
- it "moves footnotes inside figures" do
594
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
595
- #{ASCIIDOC_BLANK_HDR}
596
- image::spec/examples/rice_images/rice_image1.png[]
597
-
598
- footnote:[This is a footnote to a figure]
599
-
600
- footnote:[This is another footnote to a figure]
601
- INPUT
602
- #{BLANK_HDR}
603
- <sections><figure id="_">
604
- <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
605
- <fn reference="a">
606
- <p id="_">This is a footnote to a figure</p>
607
- </fn><fn reference="b">
608
- <p id="_">This is another footnote to a figure</p>
609
- </fn></figure>
610
-
611
- </sections>
612
-
613
- </iso-standard>
614
- OUTPUT
615
- end
616
-
617
- it "moves figure key inside figure" do
618
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
619
- #{ASCIIDOC_BLANK_HDR}
620
- image::spec/examples/rice_images/rice_image1.png[]
621
-
622
- Key
623
-
624
- a:: b
625
- INPUT
626
- #{BLANK_HDR}
627
- <sections><figure id="_">
628
- <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
629
- <dl id="_" key="true">
630
- <dt>a</dt>
631
- <dd>
632
- <p id="_">b</p>
633
- </dd>
634
- </dl></figure>
635
-
636
- </sections>
637
-
638
- </iso-standard>
639
- OUTPUT
640
- end
641
-
642
- it "numbers bibliographic notes and footnotes sequentially" do
643
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
644
- #{ASCIIDOC_BLANK_HDR}
645
- footnote:[Footnote]
646
-
647
- [bibliography]
648
- == Normative References
649
-
650
- * [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_
651
-
652
- == Clause
653
- footnote:[Footnote2]
654
- INPUT
655
- #{BLANK_HDR}
656
- <preface><foreword id='_' obligation="informative">
657
- <title>Foreword</title>
658
- <p id="_"><fn reference="1">
659
- <p id="_">Footnote</p>
660
- </fn>
661
- </p>
662
- </foreword></preface><sections>
663
-
664
- <clause id="_" inline-header="false" obligation="normative">
665
- <title>Clause</title>
666
- <p id="_"><fn reference="2">
667
- <p id="_">Footnote2</p>
668
- </fn>
669
- </p>
670
- </clause></sections><bibliography><references id="_" obligation="informative" normative="true">
671
- <title>Normative references</title>
672
- <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>
673
- <bibitem id="iso123" type="standard">
674
- <title format="text/plain">Standard</title>
675
- <docidentifier>ISO 123:—</docidentifier>
676
- <docnumber>123</docnumber>
677
- <date type="published">
678
- <on>–</on>
679
- </date>
680
- <contributor>
681
- <role type="publisher"/>
682
- <organization>
683
- <name>International Organization for Standardization</name>
684
- <abbreviation>ISO</abbreviation>
685
- </organization>
686
- </contributor>
687
- <note format="text/plain" type="Unpublished-Status">The standard is in press</note>
688
- </bibitem>
689
- </references>
690
- </bibliography>
691
- </iso-standard>
692
- OUTPUT
693
- end
694
-
695
- it "defaults section obligations" do
696
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
697
- #{ASCIIDOC_BLANK_HDR}
698
-
699
- == Clause
700
- Text
701
-
702
- [appendix]
703
- == Clause
704
-
705
- Text
706
- INPUT
707
- #{BLANK_HDR}
708
- <sections><clause id="_" inline-header="false" obligation="normative">
709
- <title>Clause</title>
710
- <p id="_">Text</p>
711
- </clause>
712
- </sections><annex id="_" inline-header="false" obligation="normative">
713
- <title>Clause</title>
714
- <p id="_">Text</p>
715
- </annex>
716
- </iso-standard>
717
- OUTPUT
718
- end
719
-
720
- it "extends clause levels past 5" do
721
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
722
- #{ASCIIDOC_BLANK_HDR}
723
-
724
- == Clause1
725
-
726
- === Clause2
727
-
728
- ==== Clause3
729
-
730
- ===== Clause4
731
-
732
- ====== Clause 5
733
-
734
- [level=6]
735
- ====== Clause 6
736
-
737
- [level=7]
738
- ====== Clause 7A
739
-
740
- [level=7]
741
- ====== Clause 7B
742
-
743
- [level=6]
744
- ====== Clause 6B
745
-
746
- ====== Clause 5B
747
-
748
- INPUT
749
- #{BLANK_HDR}
750
- <sections>
751
- <clause id="_" inline-header="false" obligation="normative">
752
- <title>Clause1</title>
753
- <clause id="_" inline-header="false" obligation="normative">
754
- <title>Clause2</title>
755
- <clause id="_" inline-header="false" obligation="normative">
756
- <title>Clause3</title>
757
- <clause id="_" inline-header="false" obligation="normative"><title>Clause4</title><clause id="_" inline-header="false" obligation="normative">
758
- <title>Clause 5</title>
759
- <clause id="_" inline-header="false" obligation="normative">
760
- <title>Clause 6</title>
761
- <clause id="_" inline-header="false" obligation="normative">
762
- <title>Clause 7A</title>
763
- </clause><clause id="_" inline-header="false" obligation="normative">
764
- <title>Clause 7B</title>
765
- </clause></clause><clause id="_" inline-header="false" obligation="normative">
766
- <title>Clause 6B</title>
767
- </clause></clause>
768
-
769
-
770
-
771
-
772
- <clause id="_" inline-header="false" obligation="normative">
773
- <title>Clause 5B</title>
774
- </clause></clause>
775
- </clause>
776
- </clause>
777
- </clause>
778
- </sections>
779
- </iso-standard>
780
- OUTPUT
781
- end
782
-
783
- it "reorders references in bibliography, and renumbers citations accordingly" do
784
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
785
- #{ASCIIDOC_BLANK_HDR}
786
-
787
- == Clause 1
788
- <<ref1>>
789
- <<ref1a>>
790
- <<ref1b>>
791
- <<ref2>>
792
- <<ref3>>
793
- <<ref4>>
794
- <<ref5>>
795
- <<ref6>>
796
- <<ref7>>
797
- <<ref8>>
798
- <<ref9>>
799
- <<ref10>>
800
-
801
- [bibliography]
802
- == Bibliography
803
-
804
- [bibliography]
805
- === Clause 1
806
- * [[[ref3,IEC 123]]], _Standard IEC 123_
807
- * [[[ref5,20]]], _Standard 10_
808
- * [[[ref1,ISO 123]]], _Standard ISO 123_
809
- * [[[ref1a,ISO 123-100]]], _Standard ISO 123_
810
- * [[[ref1b,ISO/TS 123-1]]], _Standard ISO 123_
811
- * [[[ref4,GB 123]]], _Standard GB 123_
812
- * [[[ref2,ISO/IEC 123]]], _Standard ISO/IEC 123_
813
- * [[[ref6,(B)]]], _Standard 20_
814
- * [[[ref7,(A)]]], _Standard 30_
815
-
816
- [bibliography]
817
- === {blank}
818
- * [[[ref15,20]]], _Standard 10_
819
- * [[[ref14,GB 123]]], _Standard GB 123_
820
- * [[[ref13,IEC 123]]], _Standard IEC 123_
821
- * [[[ref11,ISO 123]]], _Standard ISO 123_
822
- * [[[ref10,ISO/IEC 123]]], _Standard ISO/IEC 123_
823
- * [[[ref16,(B)]]], _Standard 20_
824
- * [[[ref17,(A)]]], _Standard 30_
825
- INPUT
826
- #{BLANK_HDR}
827
- <sections>
828
- <clause id='_' inline-header='false' obligation='normative'>
829
- <title>Clause 1</title>
830
- <p id='_'>
831
- <eref type='inline' bibitemid='ref1' citeas='ISO 123'/>
832
- <eref type='inline' bibitemid='ref1a' citeas='ISO 123-100'/>
833
- <eref type='inline' bibitemid='ref1b' citeas='ISO/TS 123-1'/>
834
- <eref type='inline' bibitemid='ref2' citeas='ISO/IEC 123'/>
835
- <eref type='inline' bibitemid='ref3' citeas='IEC 123'/>
836
- <eref type='inline' bibitemid='ref4' citeas='GB 123'/>
837
- <eref type='inline' bibitemid='ref5' citeas='[6]'/>
838
- <eref type='inline' bibitemid='ref6' citeas='[B]'/>
839
- <eref type='inline' bibitemid='ref7' citeas='[A]'/>
840
- <xref target='ref8'/>
841
- <xref target='ref9'/>
842
- <eref type='inline' bibitemid='ref10' citeas='ISO/IEC 123'/>
843
- </p>
844
- </clause>
845
- </sections>
846
- <bibliography>
847
- <clause id='_' obligation='informative'>
848
- <title>Bibliography</title>
849
- <references id='_' obligation='informative' normative="false">
850
- <title>Clause 1</title>
851
- <bibitem id='ref1' type='standard'>
852
- <title format='text/plain'>Standard ISO 123</title>
853
- <docidentifier>ISO 123</docidentifier>
854
- <docnumber>123</docnumber>
855
- <contributor>
856
- <role type='publisher'/>
857
- <organization>
858
- <name>International Organization for Standardization</name>
859
- <abbreviation>ISO</abbreviation>
860
- </organization>
861
- </contributor>
862
- </bibitem>
863
- <bibitem id='ref2' type='standard'>
864
- <title format='text/plain'>Standard ISO/IEC 123</title>
865
- <docidentifier>ISO/IEC 123</docidentifier>
866
- <docnumber>123</docnumber>
867
- <contributor>
868
- <role type='publisher'/>
869
- <organization>
870
- <name>International Organization for Standardization</name>
871
- <abbreviation>ISO</abbreviation>
872
- </organization>
873
- </contributor>
874
- <contributor>
875
- <role type='publisher'/>
876
- <organization>
877
- <name>International Electrotechnical Commission</name>
878
- <abbreviation>IEC</abbreviation>
879
- </organization>
880
- </contributor>
881
- </bibitem>
882
- <bibitem id='ref1b' type='standard'>
883
- <title format='text/plain'>Standard ISO 123</title>
884
- <docidentifier>ISO/TS 123-1</docidentifier>
885
- <docnumber>123-1</docnumber>
886
- <contributor>
887
- <role type='publisher'/>
888
- <organization>
889
- <name>International Organization for Standardization</name>
890
- <abbreviation>ISO</abbreviation>
891
- </organization>
892
- </contributor>
893
- <contributor>
894
- <role type='publisher'/>
895
- <organization>
896
- <name>TS</name>
897
- </organization>
898
- </contributor>
899
- </bibitem>
900
- <bibitem id='ref1a' type='standard'>
901
- <title format='text/plain'>Standard ISO 123</title>
902
- <docidentifier>ISO 123-100</docidentifier>
903
- <docnumber>123-100</docnumber>
904
- <contributor>
905
- <role type='publisher'/>
906
- <organization>
907
- <name>International Organization for Standardization</name>
908
- <abbreviation>ISO</abbreviation>
909
- </organization>
910
- </contributor>
911
- </bibitem>
912
- <bibitem id='ref3' type='standard'>
913
- <title format='text/plain'>Standard IEC 123</title>
914
- <docidentifier>IEC 123</docidentifier>
915
- <docnumber>123</docnumber>
916
- <contributor>
917
- <role type='publisher'/>
918
- <organization>
919
- <name>International Electrotechnical Commission</name>
920
- <abbreviation>IEC</abbreviation>
921
- </organization>
922
- </contributor>
923
- </bibitem>
924
- <bibitem id='ref5'>
925
- <formattedref format='application/x-isodoc+xml'>
926
- <em>Standard 10</em>
927
- </formattedref>
928
- <docidentifier type='metanorma'>[6]</docidentifier>
929
- </bibitem>
930
- <bibitem id='ref6'>
931
- <formattedref format='application/x-isodoc+xml'>
932
- <em>Standard 20</em>
933
- </formattedref>
934
- <docidentifier type='metanorma'>[B]</docidentifier>
935
- </bibitem>
936
- <bibitem id='ref7'>
937
- <formattedref format='application/x-isodoc+xml'>
938
- <em>Standard 30</em>
939
- </formattedref>
940
- <docidentifier type='metanorma'>[A]</docidentifier>
941
- </bibitem>
942
- <bibitem id='ref4'>
943
- <formattedref format='application/x-isodoc+xml'>
944
- <em>Standard GB 123</em>
945
- </formattedref>
946
- <docidentifier>GB 123</docidentifier>
947
- <docnumber>123</docnumber>
948
- </bibitem>
949
- </references>
950
- <references id='_' obligation='informative' normative="false">
951
- <bibitem id='ref11' type='standard'>
952
- <title format='text/plain'>Standard ISO 123</title>
953
- <docidentifier>ISO 123</docidentifier>
954
- <docnumber>123</docnumber>
955
- <contributor>
956
- <role type='publisher'/>
957
- <organization>
958
- <name>International Organization for Standardization</name>
959
- <abbreviation>ISO</abbreviation>
960
- </organization>
961
- </contributor>
962
- </bibitem>
963
- <bibitem id='ref10' type='standard'>
964
- <title format='text/plain'>Standard ISO/IEC 123</title>
965
- <docidentifier>ISO/IEC 123</docidentifier>
966
- <docnumber>123</docnumber>
967
- <contributor>
968
- <role type='publisher'/>
969
- <organization>
970
- <name>International Organization for Standardization</name>
971
- <abbreviation>ISO</abbreviation>
972
- </organization>
973
- </contributor>
974
- <contributor>
975
- <role type='publisher'/>
976
- <organization>
977
- <name>International Electrotechnical Commission</name>
978
- <abbreviation>IEC</abbreviation>
979
- </organization>
980
- </contributor>
981
- </bibitem>
982
- <bibitem id='ref13' type='standard'>
983
- <title format='text/plain'>Standard IEC 123</title>
984
- <docidentifier>IEC 123</docidentifier>
985
- <docnumber>123</docnumber>
986
- <contributor>
987
- <role type='publisher'/>
988
- <organization>
989
- <name>International Electrotechnical Commission</name>
990
- <abbreviation>IEC</abbreviation>
991
- </organization>
992
- </contributor>
993
- </bibitem>
994
- <bibitem id='ref15'>
995
- <formattedref format='application/x-isodoc+xml'>
996
- <em>Standard 10</em>
997
- </formattedref>
998
- <docidentifier type='metanorma'>[13]</docidentifier>
999
- </bibitem>
1000
- <bibitem id='ref16'>
1001
- <formattedref format='application/x-isodoc+xml'>
1002
- <em>Standard 20</em>
1003
- </formattedref>
1004
- <docidentifier type='metanorma'>[B]</docidentifier>
1005
- </bibitem>
1006
- <bibitem id='ref17'>
1007
- <formattedref format='application/x-isodoc+xml'>
1008
- <em>Standard 30</em>
1009
- </formattedref>
1010
- <docidentifier type='metanorma'>[A]</docidentifier>
1011
- </bibitem>
1012
- <bibitem id='ref14'>
1013
- <formattedref format='application/x-isodoc+xml'>
1014
- <em>Standard GB 123</em>
1015
- </formattedref>
1016
- <docidentifier>GB 123</docidentifier>
1017
- <docnumber>123</docnumber>
1018
- </bibitem>
1019
- </references>
1020
- </clause>
1021
- </bibliography>
1022
- </iso-standard>
1023
- OUTPUT
1024
- end
1025
- end