metanorma-iso 1.3.23 → 1.3.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/iso/base.rb +5 -0
- data/lib/asciidoctor/iso/cleanup.rb +10 -2
- data/lib/asciidoctor/iso/front.rb +9 -6
- data/lib/asciidoctor/iso/isodoc.rng +6 -3
- data/lib/asciidoctor/iso/macros.rb +21 -0
- data/lib/asciidoctor/iso/section.rb +6 -32
- data/lib/asciidoctor/iso/term_lookup_cleanup.rb +90 -0
- data/lib/asciidoctor/iso/validate.rb +1 -2
- data/lib/asciidoctor/iso/validate_section.rb +2 -2
- data/lib/isodoc/iso/base_convert.rb +0 -13
- data/lib/isodoc/iso/html/header.html +5 -5
- data/lib/isodoc/iso/html_convert.rb +7 -0
- data/lib/isodoc/iso/iso.international-standard.xsl +694 -287
- data/lib/isodoc/iso/metadata.rb +2 -0
- data/lib/metanorma/iso/processor.rb +2 -2
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/asciidoctor-iso/base_spec.rb +13 -7
- data/spec/asciidoctor-iso/blocks_spec.rb +6 -6
- data/spec/asciidoctor-iso/cleanup_spec.rb +13 -13
- data/spec/asciidoctor-iso/inline_spec.rb +1 -1
- data/spec/asciidoctor-iso/macros_spec.rb +273 -0
- data/spec/asciidoctor-iso/refs_spec.rb +4 -4
- data/spec/asciidoctor-iso/section_spec.rb +8 -8
- data/spec/isodoc/i18n_spec.rb +8 -8
- data/spec/isodoc/inline_spec.rb +2 -2
- data/spec/isodoc/iso_spec.rb +1 -1
- data/spec/isodoc/metadata_spec.rb +4 -2
- data/spec/isodoc/postproc_spec.rb +0 -105
- data/spec/isodoc/ref_spec.rb +2 -2
- data/spec/isodoc/section_spec.rb +5 -5
- data/spec/isodoc/xref_spec.rb +2 -2
- metadata +4 -3
- data/asciidoctor-iso.gemspec.old +0 -50
data/lib/isodoc/iso/metadata.rb
CHANGED
@@ -52,6 +52,8 @@ module IsoDoc
|
|
52
52
|
set(:tc_docnumber, tcdn.map { |n| n.text })
|
53
53
|
dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso-with-lang']"))
|
54
54
|
set(:docnumber_lang, dn&.text)
|
55
|
+
dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso-reference']"))
|
56
|
+
set(:docnumber_reference, dn&.text)
|
55
57
|
end
|
56
58
|
|
57
59
|
# we don't leave this to i18n.rb, because we have both English and
|
@@ -2,8 +2,8 @@ require "metanorma/processor"
|
|
2
2
|
|
3
3
|
module Metanorma
|
4
4
|
module Iso
|
5
|
-
def self.
|
6
|
-
["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier"]
|
5
|
+
def self.fonts_used
|
6
|
+
["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier New"]
|
7
7
|
end
|
8
8
|
|
9
9
|
class Processor < Metanorma::Processor
|
@@ -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">
|
@@ -101,7 +102,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
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
104
|
<docidentifier type="iso">ISO/PreNWIP3 1000-1</docidentifier>
|
104
|
-
<docidentifier type='iso-with-lang'>ISO/PreNWIP3 1000-1
|
105
|
+
<docidentifier type='iso-with-lang'>ISO/PreNWIP3 1000-1(E)</docidentifier>
|
106
|
+
<docidentifier type='iso-reference'>ISO/PreNWIP3 1000-1:2000(E)</docidentifier>
|
105
107
|
<docnumber>1000</docnumber>
|
106
108
|
<contributor>
|
107
109
|
<role type="author"/>
|
@@ -130,7 +132,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
130
132
|
<iteration>3</iteration>
|
131
133
|
</status>
|
132
134
|
<copyright>
|
133
|
-
<from
|
135
|
+
<from>2000</from>
|
134
136
|
<owner>
|
135
137
|
<organization>
|
136
138
|
<name>International Organization for Standardization</name>
|
@@ -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
|
@@ -190,7 +192,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
190
192
|
<iso-standard xmlns="https://www.metanorma.org/ns/iso">
|
191
193
|
<bibdata type="standard">
|
192
194
|
<docidentifier type="iso">ISO/IEC/IETF 1000-1-1:2001</docidentifier>
|
193
|
-
<docidentifier type='iso-with-lang'>ISO/IEC/IETF 1000-1-1:2001
|
195
|
+
<docidentifier type='iso-with-lang'>ISO/IEC/IETF 1000-1-1:2001(X)</docidentifier>
|
196
|
+
<docidentifier type='iso-reference'>ISO/IEC/IETF 1000-1-1:2001(X)</docidentifier>
|
194
197
|
<docidentifier type="iso-tc">2000</docidentifier>
|
195
198
|
<docidentifier type="iso-tc">2003</docidentifier>
|
196
199
|
<docnumber>1000</docnumber>
|
@@ -299,7 +302,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
299
302
|
<iso-standard xmlns="https://www.metanorma.org/ns/iso">
|
300
303
|
<bibdata type="standard">
|
301
304
|
<docidentifier type="iso">ISO/FDIS 1000</docidentifier>
|
302
|
-
<docidentifier type='iso-with-lang'>ISO/FDIS 1000
|
305
|
+
<docidentifier type='iso-with-lang'>ISO/FDIS 1000(F)</docidentifier>
|
306
|
+
<docidentifier type='iso-reference'>ISO/FDIS 1000(F)</docidentifier>
|
303
307
|
<docnumber>1000</docnumber>
|
304
308
|
<contributor>
|
305
309
|
<role type="author"/>
|
@@ -363,7 +367,8 @@ OUTPUT
|
|
363
367
|
<iso-standard xmlns="https://www.metanorma.org/ns/iso">
|
364
368
|
<bibdata type="standard">
|
365
369
|
<docidentifier type="iso">ISO 1000</docidentifier>
|
366
|
-
<docidentifier type='iso-with-lang'>ISO 1000
|
370
|
+
<docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
|
371
|
+
<docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
|
367
372
|
<docnumber>1000</docnumber>
|
368
373
|
<contributor>
|
369
374
|
<role type="author"/>
|
@@ -428,7 +433,8 @@ OUTPUT
|
|
428
433
|
<iso-standard xmlns="https://www.metanorma.org/ns/iso">
|
429
434
|
<bibdata type="standard">
|
430
435
|
<docidentifier type="iso">ISO 1000</docidentifier>
|
431
|
-
<docidentifier type='iso-with-lang'>ISO 1000
|
436
|
+
<docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
|
437
|
+
<docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
|
432
438
|
<docnumber>1000</docnumber>
|
433
439
|
<contributor>
|
434
440
|
<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="
|
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="
|
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>
|
@@ -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">
|
@@ -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,277 @@ 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]
|
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
|
+
)
|
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]
|
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
|
+
)
|
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]
|
168
|
+
term:[name2]
|
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
|
+
)
|
214
|
+
<em>name2</em>
|
215
|
+
(
|
216
|
+
<xref target='term-name2-1' />
|
217
|
+
)
|
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
|
238
|
+
|
239
|
+
paragraph
|
240
|
+
|
241
|
+
term:[name]
|
242
|
+
term:[missing]
|
243
|
+
XML
|
244
|
+
end
|
245
|
+
let(:output) do
|
246
|
+
<<~XML
|
247
|
+
#{BLANK_HDR}
|
248
|
+
<sections>
|
249
|
+
<terms id='_' obligation='normative'>
|
250
|
+
<title>Terms and definitions</title>
|
251
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
252
|
+
<p id='_'>
|
253
|
+
ISO and IEC maintain terminological databases for use in standardization
|
254
|
+
at the following addresses:
|
255
|
+
</p>
|
256
|
+
<ul id='_'>
|
257
|
+
<li>
|
258
|
+
<p id='_'>
|
259
|
+
ISO Online browsing platform: available at
|
260
|
+
<link target='http://www.iso.org/obp'/>
|
261
|
+
</p>
|
262
|
+
</li>
|
263
|
+
<li>
|
264
|
+
<p id='_'>
|
265
|
+
IEC Electropedia: available at
|
266
|
+
<link target='http://www.electropedia.org'/>
|
267
|
+
</p>
|
268
|
+
</li>
|
269
|
+
</ul>
|
270
|
+
<term id='term-name'>
|
271
|
+
<preferred>name</preferred>
|
272
|
+
<definition>
|
273
|
+
<p id='_'>paragraph</p>
|
274
|
+
<p id='_'>
|
275
|
+
<em>name</em>
|
276
|
+
(
|
277
|
+
<xref target='term-name'/>
|
278
|
+
)
|
279
|
+
missing
|
280
|
+
</p>
|
281
|
+
</definition>
|
282
|
+
</term>
|
283
|
+
</terms>
|
284
|
+
</sections>
|
285
|
+
</iso-standard>
|
286
|
+
XML
|
287
|
+
end
|
288
|
+
|
289
|
+
it 'generates unique ids which dont match existing ids' do
|
290
|
+
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
291
|
+
end
|
292
|
+
end
|
293
|
+
end
|
21
294
|
end
|