metanorma-iso 1.3.23 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -0
  3. data/.github/workflows/ubuntu.yml +8 -0
  4. data/.github/workflows/windows.yml +8 -0
  5. data/lib/asciidoctor/iso/base.rb +26 -13
  6. data/lib/asciidoctor/iso/biblio.rng +36 -6
  7. data/lib/asciidoctor/iso/cleanup.rb +20 -3
  8. data/lib/asciidoctor/iso/front.rb +16 -107
  9. data/lib/asciidoctor/iso/front_id.rb +196 -0
  10. data/lib/asciidoctor/iso/isodoc.rng +450 -4
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +98 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +12 -1
  13. data/lib/asciidoctor/iso/macros.rb +21 -0
  14. data/lib/asciidoctor/iso/reqt.rng +23 -0
  15. data/lib/asciidoctor/iso/section.rb +18 -32
  16. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +87 -0
  17. data/lib/asciidoctor/iso/validate.rb +41 -25
  18. data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
  19. data/lib/asciidoctor/iso/validate_section.rb +2 -2
  20. data/lib/asciidoctor/iso/validate_style.rb +6 -5
  21. data/lib/asciidoctor/iso/validate_title.rb +1 -1
  22. data/lib/isodoc/iso/base_convert.rb +67 -99
  23. data/lib/isodoc/iso/html/header.html +10 -6
  24. data/lib/isodoc/iso/html/html_iso_titlepage.html +25 -16
  25. data/lib/isodoc/iso/html/isodoc.scss +25 -0
  26. data/lib/isodoc/iso/html/scripts.html +18 -0
  27. data/lib/isodoc/iso/html/style-human.scss +23 -0
  28. data/lib/isodoc/iso/html/style-iso.scss +18 -0
  29. data/lib/isodoc/iso/html/word_iso_intro.html +4 -0
  30. data/lib/isodoc/iso/html/word_iso_titlepage.html +21 -0
  31. data/lib/isodoc/iso/html/wordstyle.scss +45 -4
  32. data/lib/isodoc/iso/html_convert.rb +7 -0
  33. data/lib/isodoc/iso/iso.amendment.xsl +5082 -0
  34. data/lib/isodoc/iso/iso.international-standard.xsl +1899 -796
  35. data/lib/isodoc/iso/metadata.rb +69 -23
  36. data/lib/isodoc/iso/pdf_convert.rb +5 -11
  37. data/lib/isodoc/iso/presentation_xml_convert.rb +13 -0
  38. data/lib/isodoc/iso/sections.rb +66 -0
  39. data/lib/isodoc/iso/sts_convert.rb +31 -0
  40. data/lib/isodoc/iso/xref.rb +111 -0
  41. data/lib/metanorma-iso.rb +2 -0
  42. data/lib/metanorma/iso/processor.rb +23 -8
  43. data/lib/metanorma/iso/version.rb +1 -1
  44. data/metanorma-iso.gemspec +5 -2
  45. data/spec/asciidoctor-iso/amd_spec.rb +726 -0
  46. data/spec/asciidoctor-iso/base_spec.rb +31 -21
  47. data/spec/asciidoctor-iso/blocks_spec.rb +6 -6
  48. data/spec/asciidoctor-iso/cleanup_spec.rb +15 -15
  49. data/spec/asciidoctor-iso/inline_spec.rb +1 -1
  50. data/spec/asciidoctor-iso/macros_spec.rb +289 -0
  51. data/spec/asciidoctor-iso/refs_spec.rb +5 -5
  52. data/spec/asciidoctor-iso/section_spec.rb +8 -8
  53. data/spec/asciidoctor-iso/table_spec.rb +1 -1
  54. data/spec/isodoc/amd_spec.rb +652 -0
  55. data/spec/isodoc/blocks_spec.rb +112 -27
  56. data/spec/isodoc/i18n_spec.rb +8 -8
  57. data/spec/isodoc/inline_spec.rb +4 -4
  58. data/spec/isodoc/iso_spec.rb +1 -1
  59. data/spec/isodoc/metadata_spec.rb +90 -4
  60. data/spec/isodoc/postproc_spec.rb +11 -116
  61. data/spec/isodoc/ref_spec.rb +9 -9
  62. data/spec/isodoc/section_spec.rb +33 -6
  63. data/spec/isodoc/table_spec.rb +29 -29
  64. data/spec/isodoc/terms_spec.rb +4 -4
  65. data/spec/isodoc/xref_spec.rb +34 -28
  66. data/spec/metanorma/processor_spec.rb +2 -2
  67. data/spec/spec_helper.rb +11 -0
  68. metadata +63 -12
  69. data/asciidoctor-iso.gemspec.old +0 -50
@@ -77,7 +77,7 @@ RSpec.describe Asciidoctor::ISO do
77
77
  :workgroup-number_2: 31
78
78
  :workgroup-type_2: C1
79
79
  :secretariat: SECRETARIAT
80
- :docstage: 10
80
+ :docstage: 20
81
81
  :docsubstage: 20
82
82
  :iteration: 3
83
83
  :language: en
@@ -88,6 +88,7 @@ RSpec.describe Asciidoctor::ISO do
88
88
  :title-main-fr: Titre Principal
89
89
  :title-part-fr: Part du Titre
90
90
  :library-ics: 1,2,3
91
+ :copyright-year: 2000
91
92
  INPUT
92
93
  <?xml version="1.0" encoding="UTF-8"?>
93
94
  <iso-standard xmlns="https://www.metanorma.org/ns/iso">
@@ -100,9 +101,10 @@ RSpec.describe Asciidoctor::ISO do
100
101
  <title language="fr" format="text/plain" type="title-intro">Introduction Française</title>
101
102
  <title language="fr" format="text/plain" type="title-main">Titre Principal</title>
102
103
  <title language="fr" format="text/plain" type="title-part">Part du Titre</title>
103
- <docidentifier type="iso">ISO/PreNWIP3 1000-1</docidentifier>
104
- <docidentifier type='iso-with-lang'>ISO/PreNWIP3 1000-1 (E)</docidentifier>
105
- <docnumber>1000</docnumber>
104
+ <docidentifier type="ISO">ISO/PreWD3 1000-1</docidentifier>
105
+ <docidentifier type='iso-with-lang'>ISO/PreWD3 1000-1(E)</docidentifier>
106
+ <docidentifier type='iso-reference'>ISO/PreWD3 1000-1:2000(E)</docidentifier>
107
+ <docnumber>1000</docnumber>
106
108
  <contributor>
107
109
  <role type="author"/>
108
110
  <organization>
@@ -125,12 +127,12 @@ RSpec.describe Asciidoctor::ISO do
125
127
  <language>en</language>
126
128
  <script>Latn</script>
127
129
  <status>
128
- <stage abbreviation="NWIP">10</stage>
130
+ <stage abbreviation="WD">20</stage>
129
131
  <substage>20</substage>
130
132
  <iteration>3</iteration>
131
133
  </status>
132
134
  <copyright>
133
- <from>#{Date.today.year}</from>
135
+ <from>2000</from>
134
136
  <owner>
135
137
  <organization>
136
138
  <name>International Organization for Standardization</name>
@@ -161,7 +163,7 @@ RSpec.describe Asciidoctor::ISO do
161
163
  <structuredidentifier>
162
164
  <project-number part="1">ISO 1000</project-number>
163
165
  </structuredidentifier>
164
- <stagename>New work item proposal</stagename>
166
+ <stagename>Third working draft</stagename>
165
167
  </ext>
166
168
  </bibdata>
167
169
  <sections/>
@@ -171,7 +173,7 @@ RSpec.describe Asciidoctor::ISO do
171
173
 
172
174
 
173
175
  it "processes complex metadata" do
174
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to <<~'OUTPUT'
176
+ expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~'OUTPUT')
175
177
  = Document title
176
178
  Author
177
179
  :docfile: test.adoc
@@ -185,12 +187,14 @@ RSpec.describe Asciidoctor::ISO do
185
187
  :script: Grek
186
188
  :publisher: IEC,IETF,ISO
187
189
  :copyright-year: 2001
190
+ :doctype: technical-report
188
191
  INPUT
189
192
  <?xml version="1.0" encoding="UTF-8"?>
190
193
  <iso-standard xmlns="https://www.metanorma.org/ns/iso">
191
194
  <bibdata type="standard">
192
- <docidentifier type="iso">ISO/IEC/IETF 1000-1-1:2001</docidentifier>
193
- <docidentifier type='iso-with-lang'>ISO/IEC/IETF 1000-1-1:2001 (X)</docidentifier>
195
+ <docidentifier type="ISO">ISO/IEC/IETF/TR 1000-1-1:2001</docidentifier>
196
+ <docidentifier type='iso-with-lang'>ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
197
+ <docidentifier type='iso-reference'>ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
194
198
  <docidentifier type="iso-tc">2000</docidentifier>
195
199
  <docidentifier type="iso-tc">2003</docidentifier>
196
200
  <docnumber>1000</docnumber>
@@ -267,7 +271,7 @@ RSpec.describe Asciidoctor::ISO do
267
271
  </owner>
268
272
  </copyright>
269
273
  <ext>
270
- <doctype>article</doctype>
274
+ <doctype>technical-report</doctype>
271
275
  <editorialgroup>
272
276
  <technical-committee/>
273
277
  <subcommittee/>
@@ -284,7 +288,7 @@ RSpec.describe Asciidoctor::ISO do
284
288
  OUTPUT
285
289
  end
286
290
 
287
- it "defaults substage" do
291
+ it "defaults substage, defines iteration on stage 50, gives stage 50 on technical specification" do
288
292
  expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
289
293
  = Document title
290
294
  Author
@@ -295,11 +299,14 @@ RSpec.describe Asciidoctor::ISO do
295
299
  :docnumber: 1000
296
300
  :docstage: 50
297
301
  :language: fr
302
+ :doctype: technical-specification
303
+ :iteration: 2
298
304
  INPUT
299
305
  <iso-standard xmlns="https://www.metanorma.org/ns/iso">
300
306
  <bibdata type="standard">
301
- <docidentifier type="iso">ISO/FDIS 1000</docidentifier>
302
- <docidentifier type='iso-with-lang'>ISO/FDIS 1000 (F)</docidentifier>
307
+ <docidentifier type="ISO">ISO/DTS 1000.2</docidentifier>
308
+ <docidentifier type='iso-with-lang'>ISO/DTS 1000.2(F)</docidentifier>
309
+ <docidentifier type='iso-reference'>ISO/DTS 1000.2(F)</docidentifier>
303
310
  <docnumber>1000</docnumber>
304
311
  <contributor>
305
312
  <role type="author"/>
@@ -319,8 +326,9 @@ RSpec.describe Asciidoctor::ISO do
319
326
  <language>fr</language>
320
327
  <script>Latn</script>
321
328
  <status>
322
- <stage abbreviation="FDIS">50</stage>
329
+ <stage abbreviation="D">50</stage>
323
330
  <substage>00</substage>
331
+ <iteration>2</iteration>
324
332
  </status>
325
333
  <copyright>
326
334
  <from>#{Date.today.year}</from>
@@ -332,7 +340,7 @@ RSpec.describe Asciidoctor::ISO do
332
340
  </owner>
333
341
  </copyright>
334
342
  <ext>
335
- <doctype>article</doctype>
343
+ <doctype>technical-specification</doctype>
336
344
  <editorialgroup>
337
345
  <technical-committee/>
338
346
  <subcommittee/>
@@ -341,7 +349,7 @@ RSpec.describe Asciidoctor::ISO do
341
349
  <structuredidentifier>
342
350
  <project-number>ISO 1000</project-number>
343
351
  </structuredidentifier>
344
- <stagename>Final draft international standard</stagename>
352
+ <stagename>Final draft</stagename>
345
353
  </ext>
346
354
  </bibdata>
347
355
  <sections/>
@@ -362,8 +370,9 @@ OUTPUT
362
370
  INPUT
363
371
  <iso-standard xmlns="https://www.metanorma.org/ns/iso">
364
372
  <bibdata type="standard">
365
- <docidentifier type="iso">ISO 1000</docidentifier>
366
- <docidentifier type='iso-with-lang'>ISO 1000 (E)</docidentifier>
373
+ <docidentifier type="ISO">ISO 1000</docidentifier>
374
+ <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
375
+ <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
367
376
  <docnumber>1000</docnumber>
368
377
  <contributor>
369
378
  <role type="author"/>
@@ -427,8 +436,9 @@ OUTPUT
427
436
  INPUT
428
437
  <iso-standard xmlns="https://www.metanorma.org/ns/iso">
429
438
  <bibdata type="standard">
430
- <docidentifier type="iso">ISO 1000</docidentifier>
431
- <docidentifier type='iso-with-lang'>ISO 1000 (E)</docidentifier>
439
+ <docidentifier type="ISO">ISO 1000</docidentifier>
440
+ <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
441
+ <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
432
442
  <docnumber>1000</docnumber>
433
443
  <contributor>
434
444
  <role type="author"/>
@@ -25,8 +25,8 @@ RSpec.describe Asciidoctor::ISO do
25
25
  #{ASCIIDOC_BLANK_HDR}
26
26
  [stem]
27
27
  ++++
28
- r = 1 %
29
- r = 1 %
28
+ r = 1 %
29
+ r = 1 %
30
30
  ++++
31
31
 
32
32
  [stem]
@@ -113,7 +113,7 @@ RSpec.describe Asciidoctor::ISO do
113
113
  <terms id="_" obligation="normative">
114
114
  <title>Terms and definitions</title>
115
115
  #{TERM_BOILERPLATE}
116
- <term id="_">
116
+ <term id="term-term1">
117
117
  <preferred>Term1</preferred>
118
118
  <termnote id="_">
119
119
  <p id="_">This is a note</p>
@@ -223,7 +223,7 @@ RSpec.describe Asciidoctor::ISO do
223
223
  <terms id="_" obligation="normative">
224
224
  <title>Terms and definitions</title>
225
225
  #{TERM_BOILERPLATE}
226
- <term id="_">
226
+ <term id="term-term1">
227
227
  <preferred>Term1</preferred>
228
228
  <termexample id="_">
229
229
  <p id="_">This is an example</p>
@@ -428,7 +428,7 @@ RSpec.describe Asciidoctor::ISO do
428
428
  <terms id="_" obligation="normative">
429
429
  <title>Terms and definitions</title>
430
430
  #{TERM_BOILERPLATE}
431
- <term id="_">
431
+ <term id="term-term1">
432
432
  <preferred>Term1</preferred>
433
433
  <termsource status="identical">
434
434
  <origin bibitemid="ISO2191" type="inline" citeas="">
@@ -459,7 +459,7 @@ RSpec.describe Asciidoctor::ISO do
459
459
  <terms id="_" obligation="normative">
460
460
  <title>Terms and definitions</title>
461
461
  #{TERM_BOILERPLATE}
462
- <term id="_">
462
+ <term id="term-term1">
463
463
  <preferred>Term1</preferred>
464
464
  <termsource status="modified">
465
465
  <origin bibitemid="ISO2191" type="inline" citeas="">
@@ -32,7 +32,7 @@ RSpec.describe Asciidoctor::ISO do
32
32
  <terms id="_" obligation="normative">
33
33
  <title>Terms and definitions</title>
34
34
  #{TERM_BOILERPLATE}
35
- <term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>91</mn></msub></math></stem></admitted>
35
+ <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>91</mn></msub></math></stem></admitted>
36
36
  <definition><p id="_">Time</p></definition></term>
37
37
  </terms>
38
38
  </sections>
@@ -54,7 +54,7 @@ RSpec.describe Asciidoctor::ISO do
54
54
  <terms id="_" obligation="normative">
55
55
  <title>Terms and definitions</title>
56
56
  #{TERM_BOILERPLATE}
57
- <term id="_">
57
+ <term id="term-tempus">
58
58
  <preferred>Tempus</preferred>
59
59
  <domain>relativity</domain><definition><p id="_"> Time</p></definition>
60
60
  </term>
@@ -90,7 +90,7 @@ RSpec.describe Asciidoctor::ISO do
90
90
  <terms id="_" obligation="normative">
91
91
  <title>Terms and definitions</title>
92
92
  #{TERM_BOILERPLATE}
93
- <term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><definition><formula id="_">
93
+ <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><definition><formula id="_">
94
94
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mi>A</mi></msub></math></stem>
95
95
  </formula><p id="_">This paragraph is extraneous</p></definition>
96
96
  </term>
@@ -118,7 +118,7 @@ RSpec.describe Asciidoctor::ISO do
118
118
  <terms id="_" obligation="normative"><title>Terms and definitions</title>
119
119
 
120
120
  #{TERM_BOILERPLATE}
121
- <term id="_">
121
+ <term id="term-time">
122
122
  <preferred>Time</preferred>
123
123
  <definition><p id="_">This paragraph is extraneous</p></definition>
124
124
  </term></terms>
@@ -189,7 +189,7 @@ RSpec.describe Asciidoctor::ISO do
189
189
  <eref type="inline" bibitemid="iso216" citeas="ISO 216:2001"/>
190
190
  </p>
191
191
  </foreword></preface><sections>
192
- </sections><bibliography><references id="_" obligation="informative">
192
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
193
193
  <title>Normative References</title>
194
194
  <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>
195
195
  <bibitem id="iso216" type="standard">
@@ -232,7 +232,7 @@ RSpec.describe Asciidoctor::ISO do
232
232
  </localityStack>the reference</eref>
233
233
  </p>
234
234
  </foreword></preface><sections>
235
- </sections><bibliography><references id="_" obligation="informative">
235
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
236
236
  <title>Normative References</title>
237
237
  <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>
238
238
  <bibitem id="iso216" type="standard">
@@ -271,7 +271,7 @@ RSpec.describe Asciidoctor::ISO do
271
271
  <eref type="inline" bibitemid="iso216" citeas="ISO 216"/>
272
272
  </p>
273
273
  </foreword></preface><sections>
274
- </sections><bibliography><references id="_" obligation="informative">
274
+ </sections><bibliography><references id="_" obligation="informative" normative="false">
275
275
  <title>Bibliography</title>
276
276
  <bibitem id="iso216" type="standard">
277
277
  <title format="text/plain">Reference</title>
@@ -305,7 +305,7 @@ RSpec.describe Asciidoctor::ISO do
305
305
  <terms id="_" obligation="normative">
306
306
  <title>Terms and definitions</title>
307
307
  #{TERM_BOILERPLATE}
308
- <term id="_">
308
+ <term id="term-term1">
309
309
  <preferred>Term1</preferred>
310
310
  <termsource status="identical">
311
311
  <origin bibitemid="ISO2191" type="inline" citeas="">
@@ -333,7 +333,7 @@ RSpec.describe Asciidoctor::ISO do
333
333
  INPUT
334
334
  #{BLANK_HDR}
335
335
  <sections></sections>
336
- <bibliography><references id="_" obligation="informative"><title>Normative References</title>
336
+ <bibliography><references id="_" obligation="informative" normative="true"><title>Normative References</title>
337
337
  <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>
338
338
  <bibitem id="iso216" type="standard">
339
339
  <title format="text/plain">Reference</title>
@@ -547,7 +547,7 @@ RSpec.describe Asciidoctor::ISO do
547
547
  INPUT
548
548
  #{BLANK_HDR}
549
549
  <sections><formula id="_">
550
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>F</mi><mtext>or</mtext><mi>μ</mi><mi>l</mi><mi>a</mi></math></stem>
550
+ <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>
551
551
  <dl id="_">
552
552
  <dt>a</dt>
553
553
  <dd>
@@ -637,7 +637,7 @@ RSpec.describe Asciidoctor::ISO do
637
637
  <p id="_">Footnote2</p>
638
638
  </fn>
639
639
  </p>
640
- </clause></sections><bibliography><references id="_" obligation="informative">
640
+ </clause></sections><bibliography><references id="_" obligation="informative" normative="true">
641
641
  <title>Normative References</title>
642
642
  <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>
643
643
  <bibitem id="iso123" type="standard">
@@ -654,7 +654,7 @@ RSpec.describe Asciidoctor::ISO do
654
654
  <abbreviation>ISO</abbreviation>
655
655
  </organization>
656
656
  </contributor>
657
- <note format="text/plain">ISO DATE: The standard is in press</note>
657
+ <note format="text/plain" type="ISO DATE">The standard is in press</note>
658
658
  </bibitem>
659
659
  </references>
660
660
  </bibliography>
@@ -753,7 +753,7 @@ RSpec.describe Asciidoctor::ISO do
753
753
  it "reorders references in bibliography, and renumbers citations accordingly" do
754
754
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
755
755
  #{ASCIIDOC_BLANK_HDR}
756
-
756
+
757
757
  == Clause 1
758
758
  <<ref1>>
759
759
  <<ref1a>>
@@ -816,7 +816,7 @@ RSpec.describe Asciidoctor::ISO do
816
816
  <bibliography>
817
817
  <clause id='_' obligation='informative'>
818
818
  <title>Bibliography</title>
819
- <references id='_' obligation='informative'>
819
+ <references id='_' obligation='informative' normative="false">
820
820
  <title>Clause 1</title>
821
821
  <bibitem id='ref1' type='standard'>
822
822
  <title format='text/plain'>Standard ISO 123</title>
@@ -917,7 +917,7 @@ RSpec.describe Asciidoctor::ISO do
917
917
  <docnumber>123</docnumber>
918
918
  </bibitem>
919
919
  </references>
920
- <references id='_' obligation='informative'>
920
+ <references id='_' obligation='informative' normative="false">
921
921
  <bibitem id='ref11' type='standard'>
922
922
  <title format='text/plain'>Standard ISO 123</title>
923
923
  <docidentifier>ISO 123</docidentifier>
@@ -127,7 +127,7 @@ RSpec.describe Asciidoctor::ISO do
127
127
  #{BLANK_HDR}
128
128
  <sections>
129
129
 
130
- </sections><bibliography><references id="_" obligation="informative">
130
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
131
131
  <title>Normative References</title>
132
132
  <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>
133
133
  <bibitem id="ISO712">
@@ -18,4 +18,293 @@ RSpec.describe Asciidoctor::ISO do
18
18
  OUTPUT
19
19
  end
20
20
 
21
+ describe 'term inline macros' do
22
+ subject(:convert) do
23
+ xmlpp(
24
+ strip_guid(
25
+ Asciidoctor.convert(
26
+ input, backend: :iso, header_footer: true)))
27
+ end
28
+ let(:input) do
29
+ <<~XML
30
+ #{ASCIIDOC_BLANK_HDR}
31
+ == Terms and Definitions
32
+
33
+ === name2
34
+
35
+ == Main
36
+
37
+ term:[name,name2] is a term
38
+ XML
39
+ end
40
+ let(:output) do
41
+ <<~XML
42
+ #{BLANK_HDR}
43
+ <sections>
44
+ <terms id='_' obligation='normative'>
45
+ <title>Terms and definitions</title>
46
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
47
+ <p id='_'>
48
+ ISO and IEC maintain terminological databases for use in standardization
49
+ at the following addresses:
50
+ </p>
51
+ <ul id='_'>
52
+ <li>
53
+ <p id='_'>
54
+ ISO Online browsing platform: available at
55
+ <link target='http://www.iso.org/obp'/>
56
+ </p>
57
+ </li>
58
+ <li>
59
+ <p id='_'>
60
+ IEC Electropedia: available at
61
+ <link target='http://www.electropedia.org'/>
62
+ </p>
63
+ </li>
64
+ </ul>
65
+ <term id='term-name2'>
66
+ <preferred>name2</preferred>
67
+ </term>
68
+ </terms>
69
+ <clause id='_' inline-header='false' obligation='normative'>
70
+ <title>Main</title>
71
+ <p id='_'>
72
+ <em>name</em>
73
+ (
74
+ <xref target='term-name2'/>
75
+ ) is a term
76
+ </p>
77
+ </clause>
78
+ </sections>
79
+ </iso-standard>
80
+ XML
81
+ end
82
+
83
+ it 'converts macro into the correct xml' do
84
+ expect(convert).to(be_equivalent_to(xmlpp(output)))
85
+ end
86
+
87
+ context 'default params' do
88
+ let(:input) do
89
+ <<~XML
90
+ #{ASCIIDOC_BLANK_HDR}
91
+
92
+ == Terms and Definitions
93
+
94
+ === name
95
+
96
+ == Main
97
+
98
+ term:[name] is a term
99
+ XML
100
+ end
101
+ let(:output) do
102
+ <<~XML
103
+ #{BLANK_HDR}
104
+ <sections>
105
+ <terms id='_' obligation='normative'>
106
+ <title>Terms and definitions</title>
107
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
108
+ <p id='_'>
109
+ ISO and IEC maintain terminological databases for use in standardization
110
+ at the following addresses:
111
+ </p>
112
+ <ul id='_'>
113
+ <li>
114
+ <p id='_'>
115
+ ISO Online browsing platform: available at
116
+ <link target='http://www.iso.org/obp' />
117
+ </p>
118
+ </li>
119
+ <li>
120
+ <p id='_'>
121
+ IEC Electropedia: available at
122
+ <link target='http://www.electropedia.org' />
123
+ </p>
124
+ </li>
125
+ </ul>
126
+ <term id='term-name'>
127
+ <preferred>name</preferred>
128
+ </term>
129
+ </terms>
130
+ <clause id='_' inline-header='false' obligation='normative'>
131
+ <title>Main</title>
132
+ <p id='_'>
133
+ <em>name</em>
134
+ (
135
+ <xref target='term-name' />
136
+ ) is a term
137
+ </p>
138
+ </clause>
139
+ </sections>
140
+ </iso-standard>
141
+ XML
142
+ end
143
+
144
+ it 'uses `name` as termref name' do
145
+ expect(convert).to(be_equivalent_to(xmlpp(output)))
146
+ end
147
+ end
148
+
149
+ context 'multiply exising ids in document' do
150
+ let(:input) do
151
+ <<~XML
152
+ #{ASCIIDOC_BLANK_HDR}
153
+
154
+ == Terms and Definitions
155
+
156
+ === name
157
+ === name2
158
+
159
+ [[term-name]]
160
+ == Main
161
+
162
+ paragraph
163
+
164
+ [[term-name2]]
165
+ == Second
166
+
167
+ term:[name] is a term
168
+ term:[name2] is a term
169
+ XML
170
+ end
171
+ let(:output) do
172
+ <<~XML
173
+ #{BLANK_HDR}
174
+ <sections>
175
+ <terms id='_' obligation='normative'>
176
+ <title>Terms and definitions</title>
177
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
178
+ <p id='_'>
179
+ ISO and IEC maintain terminological databases for use in standardization
180
+ at the following addresses:
181
+ </p>
182
+ <ul id='_'>
183
+ <li>
184
+ <p id='_'>
185
+ ISO Online browsing platform: available at
186
+ <link target='http://www.iso.org/obp' />
187
+ </p>
188
+ </li>
189
+ <li>
190
+ <p id='_'>
191
+ IEC Electropedia: available at
192
+ <link target='http://www.electropedia.org' />
193
+ </p>
194
+ </li>
195
+ </ul>
196
+ <term id='term-name-1'>
197
+ <preferred>name</preferred>
198
+ </term>
199
+ <term id='term-name2-1'>
200
+ <preferred>name2</preferred>
201
+ </term>
202
+ </terms>
203
+ <clause id='term-name' inline-header='false' obligation='normative'>
204
+ <title>Main</title>
205
+ <p id='_'>paragraph</p>
206
+ </clause>
207
+ <clause id='term-name2' inline-header='false' obligation='normative'>
208
+ <title>Second</title>
209
+ <p id='_'>
210
+ <em>name</em>
211
+ (
212
+ <xref target='term-name-1' />
213
+ ) is a term
214
+ <em>name2</em>
215
+ (
216
+ <xref target='term-name2-1' />
217
+ ) is a term
218
+ </p>
219
+ </clause>
220
+ </sections>
221
+ </iso-standard>
222
+ XML
223
+ end
224
+
225
+ it 'generates unique ids which dont match existing ids' do
226
+ expect(convert).to(be_equivalent_to(xmlpp(output)))
227
+ end
228
+ end
229
+
230
+ context 'when missing actual ref' do
231
+ let(:input) do
232
+ <<~XML
233
+ #{ASCIIDOC_BLANK_HDR}
234
+
235
+ == Terms and Definitions
236
+
237
+ === name identity
238
+
239
+ [[name-check]]
240
+ === name check
241
+
242
+ paragraph
243
+
244
+ term:[name check] is a term
245
+
246
+ term:[name identity] is a term
247
+
248
+ Moreover, term:[missing] is a term
249
+ XML
250
+ end
251
+ let(:output) do
252
+ <<~XML
253
+ #{BLANK_HDR}
254
+ <sections>
255
+ <terms id='_' obligation='normative'>
256
+ <title>Terms and definitions</title>
257
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
258
+ <p id='_'>
259
+ ISO and IEC maintain terminological databases for use in standardization
260
+ at the following addresses:
261
+ </p>
262
+ <ul id='_'>
263
+ <li>
264
+ <p id='_'>
265
+ ISO Online browsing platform: available at
266
+ <link target='http://www.iso.org/obp'/>
267
+ </p>
268
+ </li>
269
+ <li>
270
+ <p id='_'>
271
+ IEC Electropedia: available at
272
+ <link target='http://www.electropedia.org'/>
273
+ </p>
274
+ </li>
275
+ </ul>
276
+ <term id='term-name-identity'>
277
+ <preferred>name identity</preferred>
278
+ </term>
279
+ <term id='name-check'>
280
+ <preferred>name check</preferred>
281
+ <definition>
282
+ <p id='_'>paragraph</p>
283
+ <p id='_'>
284
+ <em>name check</em>
285
+ (
286
+ <xref target='name-check'/>
287
+ ) is a term
288
+ </p>
289
+ <p id='_'>
290
+ <em>name identity</em>
291
+ (
292
+ <xref target='term-name-identity'/>
293
+ ) is a term
294
+ </p>
295
+ <p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term
296
+ </p>
297
+ </definition>
298
+ </term>
299
+ </terms>
300
+ </sections>
301
+ </iso-standard>
302
+ XML
303
+ end
304
+
305
+ it 'generates unique ids which dont match existing ids' do
306
+ expect(convert).to(be_equivalent_to(xmlpp(output)))
307
+ end
308
+ end
309
+ end
21
310
  end