metanorma-iec 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/bin/rspec +18 -0
- data/lib/asciidoctor/iec/biblio.rng +949 -0
- data/lib/asciidoctor/iec/converter.rb +68 -0
- data/lib/asciidoctor/iec/iec_intro_en.xml +15 -0
- data/lib/asciidoctor/iec/iec_intro_fr.xml +15 -0
- data/lib/asciidoctor/iec/isodoc.rng +1132 -0
- data/lib/asciidoctor/iec/isostandard.rng +789 -0
- data/lib/asciidoctor/iec/reqt.rng +162 -0
- data/lib/isodoc/iec/base_convert.rb +69 -0
- data/lib/isodoc/iec/html/header.html +160 -0
- data/lib/isodoc/iec/html/html_iec_intro.html +34 -0
- data/lib/isodoc/iec/html/html_iec_titlepage.html +62 -0
- data/lib/isodoc/iec/html/htmlstyle.scss +840 -0
- data/lib/isodoc/iec/html/isodoc.scss +785 -0
- data/lib/isodoc/iec/html/scripts.html +176 -0
- data/lib/isodoc/iec/html/word_iec_intro.html +72 -0
- data/lib/isodoc/iec/html/word_iec_titlepage.html +92 -0
- data/lib/isodoc/iec/html/wordstyle.scss +1849 -0
- data/lib/isodoc/iec/html_convert.rb +33 -0
- data/lib/isodoc/iec/i18n-en.yaml +3 -0
- data/lib/isodoc/iec/i18n-fr.yaml +3 -0
- data/lib/isodoc/iec/i18n-zh-Hans.yaml +3 -0
- data/lib/isodoc/iec/metadata.rb +20 -0
- data/lib/isodoc/iec/word_convert.rb +165 -0
- data/lib/metanorma-iec.rb +12 -0
- data/lib/metanorma/iec.rb +8 -0
- data/lib/metanorma/iec/processor.rb +40 -0
- data/lib/metanorma/iec/version.rb +6 -0
- data/metanorma-iec.gemspec +47 -0
- data/spec/asciidoctor-iec/base_spec.rb +609 -0
- data/spec/asciidoctor-iec/blocks_spec.rb +467 -0
- data/spec/asciidoctor-iec/cleanup_spec.rb +766 -0
- data/spec/asciidoctor-iec/inline_spec.rb +162 -0
- data/spec/asciidoctor-iec/lists_spec.rb +190 -0
- data/spec/asciidoctor-iec/macros_spec.rb +21 -0
- data/spec/asciidoctor-iec/refs_spec.rb +268 -0
- data/spec/asciidoctor-iec/section_spec.rb +341 -0
- data/spec/asciidoctor-iec/table_spec.rb +307 -0
- data/spec/asciidoctor-iec/validate_spec.rb +132 -0
- data/spec/examples/rice.adoc +723 -0
- data/spec/examples/rice.doc +19162 -0
- data/spec/examples/rice.html +1787 -0
- data/spec/examples/rice.xml +1951 -0
- data/spec/isodoc/i18n_spec.rb +642 -0
- data/spec/isodoc/inline_spec.rb +265 -0
- data/spec/isodoc/iso_spec.rb +319 -0
- data/spec/isodoc/metadata_spec.rb +153 -0
- data/spec/isodoc/postproc_spec.rb +569 -0
- data/spec/isodoc/section_spec.rb +686 -0
- data/spec/isodoc/terms_spec.rb +206 -0
- data/spec/isodoc/xref_spec.rb +1323 -0
- data/spec/metanorma/processor_spec.rb +88 -0
- data/spec/spec_helper.rb +253 -0
- metadata +325 -0
@@ -0,0 +1,162 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Asciidoctor::Iec do
|
4
|
+
it "processes inline_quoted formatting" do
|
5
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
6
|
+
#{ASCIIDOC_BLANK_HDR}
|
7
|
+
_emphasis_
|
8
|
+
*strong*
|
9
|
+
`monospace`
|
10
|
+
"double quote"
|
11
|
+
'single quote'
|
12
|
+
super^script^
|
13
|
+
sub~script~
|
14
|
+
stem:[a_90]
|
15
|
+
stem:[<mml:math><mml:msub xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">F</mml:mi> </mml:mrow> </mml:mrow> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">Α</mml:mi> </mml:mrow> </mml:mrow> </mml:msub> </mml:math>]
|
16
|
+
[alt]#alt#
|
17
|
+
[deprecated]#deprecated#
|
18
|
+
[domain]#domain#
|
19
|
+
[strike]#strike#
|
20
|
+
[smallcap]#smallcap#
|
21
|
+
INPUT
|
22
|
+
#{BLANK_HDR}
|
23
|
+
<sections>
|
24
|
+
<em>emphasis</em>
|
25
|
+
<strong>strong</strong>
|
26
|
+
<tt>monospace</tt>
|
27
|
+
“double quote”
|
28
|
+
‘single quote’
|
29
|
+
super<sup>script</sup>
|
30
|
+
sub<sub>script</sub>
|
31
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>a</mi><mn>90</mn></msub></math></stem>
|
32
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
|
33
|
+
<admitted>alt</admitted>
|
34
|
+
<deprecates>deprecated</deprecates>
|
35
|
+
<domain>domain</domain>
|
36
|
+
<strike>strike</strike>
|
37
|
+
<smallcap>smallcap</smallcap>
|
38
|
+
</sections>
|
39
|
+
</iso-standard>
|
40
|
+
OUTPUT
|
41
|
+
end
|
42
|
+
|
43
|
+
it "processes breaks" do
|
44
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
45
|
+
#{ASCIIDOC_BLANK_HDR}
|
46
|
+
Line break +
|
47
|
+
line break
|
48
|
+
|
49
|
+
'''
|
50
|
+
|
51
|
+
<<<
|
52
|
+
INPUT
|
53
|
+
#{BLANK_HDR}
|
54
|
+
<sections><p id="_">Line break<br/>
|
55
|
+
line break</p>
|
56
|
+
<hr/>
|
57
|
+
<pagebreak/></sections>
|
58
|
+
</iso-standard>
|
59
|
+
OUTPUT
|
60
|
+
end
|
61
|
+
|
62
|
+
it "processes links" do
|
63
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
64
|
+
#{ASCIIDOC_BLANK_HDR}
|
65
|
+
mailto:fred@example.com
|
66
|
+
http://example.com[]
|
67
|
+
http://example.com[Link]
|
68
|
+
INPUT
|
69
|
+
#{BLANK_HDR}
|
70
|
+
<sections>
|
71
|
+
<p id="_">mailto:fred@example.com
|
72
|
+
<link target="http://example.com"/>
|
73
|
+
<link target="http://example.com">Link</link></p>
|
74
|
+
</sections>
|
75
|
+
</iso-standard>
|
76
|
+
OUTPUT
|
77
|
+
end
|
78
|
+
|
79
|
+
it "processes bookmarks" do
|
80
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
81
|
+
#{ASCIIDOC_BLANK_HDR}
|
82
|
+
Text [[bookmark]] Text
|
83
|
+
INPUT
|
84
|
+
#{BLANK_HDR}
|
85
|
+
<sections>
|
86
|
+
<p id="_">Text <bookmark id="bookmark"/> Text</p>
|
87
|
+
</sections>
|
88
|
+
</iso-standard>
|
89
|
+
OUTPUT
|
90
|
+
end
|
91
|
+
|
92
|
+
it "processes crossreferences" do
|
93
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
94
|
+
#{ASCIIDOC_BLANK_HDR}
|
95
|
+
[[reference]]
|
96
|
+
== Section
|
97
|
+
|
98
|
+
Inline Reference to <<reference>>
|
99
|
+
Footnoted Reference to <<reference,fn>>
|
100
|
+
Inline Reference with Text to <<reference,text>>
|
101
|
+
Footnoted Reference with Text to <<reference,fn: text>>
|
102
|
+
INPUT
|
103
|
+
#{BLANK_HDR}
|
104
|
+
<sections>
|
105
|
+
<clause id="reference" inline-header="false" obligation="normative">
|
106
|
+
<title>Section</title>
|
107
|
+
<p id="_">Inline Reference to <xref target="reference"/>
|
108
|
+
Footnoted Reference to <xref target="reference"/>
|
109
|
+
Inline Reference with Text to <xref target="reference">text</xref>
|
110
|
+
Footnoted Reference with Text to <xref target="reference">text</xref></p>
|
111
|
+
</clause>
|
112
|
+
</sections>
|
113
|
+
</iso-standard>
|
114
|
+
OUTPUT
|
115
|
+
end
|
116
|
+
|
117
|
+
it "processes bibliographic anchors" do
|
118
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
119
|
+
#{ASCIIDOC_BLANK_HDR}
|
120
|
+
[bibliography]
|
121
|
+
== Normative References
|
122
|
+
|
123
|
+
* [[[ISO712,x]]] Reference
|
124
|
+
* [[[ISO713]]] Reference
|
125
|
+
|
126
|
+
INPUT
|
127
|
+
#{BLANK_HDR}
|
128
|
+
<sections>
|
129
|
+
|
130
|
+
</sections><bibliography><references id="_" obligation="informative">
|
131
|
+
<title>Normative References</title>
|
132
|
+
<bibitem id="ISO712">
|
133
|
+
<formattedref format="application/x-isodoc+xml">Reference</formattedref>
|
134
|
+
<docidentifier>x</docidentifier>
|
135
|
+
</bibitem>
|
136
|
+
<bibitem id="ISO713">
|
137
|
+
<formattedref format="application/x-isodoc+xml">Reference</formattedref>
|
138
|
+
<docidentifier>ISO713</docidentifier>
|
139
|
+
</bibitem>
|
140
|
+
</references>
|
141
|
+
</bibliography>
|
142
|
+
</iso-standard>
|
143
|
+
OUTPUT
|
144
|
+
end
|
145
|
+
|
146
|
+
it "processes footnotes" do
|
147
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
148
|
+
#{ASCIIDOC_BLANK_HDR}
|
149
|
+
Hello!footnote:[Footnote text]
|
150
|
+
INPUT
|
151
|
+
#{BLANK_HDR}
|
152
|
+
<sections>
|
153
|
+
<p id="_">Hello!<fn reference="1">
|
154
|
+
<p id="_">Footnote text</p>
|
155
|
+
</fn></p>
|
156
|
+
</sections>
|
157
|
+
</iso-standard>
|
158
|
+
OUTPUT
|
159
|
+
end
|
160
|
+
|
161
|
+
|
162
|
+
end
|
@@ -0,0 +1,190 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Asciidoctor::Iec do
|
4
|
+
it "processes simple lists" do
|
5
|
+
output = Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)
|
6
|
+
#{ASCIIDOC_BLANK_HDR}
|
7
|
+
* List 1
|
8
|
+
* List 2
|
9
|
+
* List 3
|
10
|
+
|
11
|
+
. List A
|
12
|
+
. List B
|
13
|
+
. List C
|
14
|
+
|
15
|
+
List D:: List E
|
16
|
+
List F:: List G
|
17
|
+
|
18
|
+
INPUT
|
19
|
+
expect(strip_guid(output)).to be_equivalent_to <<~"OUTPUT"
|
20
|
+
#{BLANK_HDR}
|
21
|
+
<sections>
|
22
|
+
<ul id="_">
|
23
|
+
<li>
|
24
|
+
<p id="_">List 1</p>
|
25
|
+
</li>
|
26
|
+
<li>
|
27
|
+
<p id="_">List 2</p>
|
28
|
+
</li>
|
29
|
+
<li>
|
30
|
+
<p id="_">List 3</p>
|
31
|
+
<ol id="_" type="arabic">
|
32
|
+
<li>
|
33
|
+
<p id="_">List A</p>
|
34
|
+
</li>
|
35
|
+
<li>
|
36
|
+
<p id="_">List B</p>
|
37
|
+
</li>
|
38
|
+
<li>
|
39
|
+
<p id="_">List C</p>
|
40
|
+
<dl id="_">
|
41
|
+
<dt>List D</dt>
|
42
|
+
<dd>
|
43
|
+
<p id="_">List E</p>
|
44
|
+
</dd>
|
45
|
+
<dt>List F</dt>
|
46
|
+
<dd>
|
47
|
+
<p id="_">List G</p>
|
48
|
+
</dd>
|
49
|
+
</dl>
|
50
|
+
</li>
|
51
|
+
</ol>
|
52
|
+
</li>
|
53
|
+
</ul>
|
54
|
+
</sections>
|
55
|
+
</iso-standard>
|
56
|
+
OUTPUT
|
57
|
+
end
|
58
|
+
|
59
|
+
it "processes complex lists" do
|
60
|
+
output = Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)
|
61
|
+
#{ASCIIDOC_BLANK_HDR}
|
62
|
+
[[id]]
|
63
|
+
* First
|
64
|
+
* Second
|
65
|
+
+
|
66
|
+
--
|
67
|
+
entry1
|
68
|
+
|
69
|
+
entry2
|
70
|
+
--
|
71
|
+
|
72
|
+
[[id1]]
|
73
|
+
[loweralpha]
|
74
|
+
. First
|
75
|
+
. Second
|
76
|
+
[upperalpha]
|
77
|
+
.. Third
|
78
|
+
.. Fourth
|
79
|
+
. Fifth
|
80
|
+
. Sixth
|
81
|
+
|
82
|
+
[lowerroman]
|
83
|
+
. A
|
84
|
+
. B
|
85
|
+
[upperroman]
|
86
|
+
.. C
|
87
|
+
.. D
|
88
|
+
[arabic]
|
89
|
+
... E
|
90
|
+
... F
|
91
|
+
|
92
|
+
|
93
|
+
Notes1::
|
94
|
+
Notes:: Note 1.
|
95
|
+
+
|
96
|
+
Note 2.
|
97
|
+
+
|
98
|
+
Note 3.
|
99
|
+
|
100
|
+
INPUT
|
101
|
+
expect(strip_guid(output)).to be_equivalent_to <<~"OUTPUT"
|
102
|
+
#{BLANK_HDR}
|
103
|
+
<sections><ul id="id">
|
104
|
+
<li>
|
105
|
+
<p id="_">First</p>
|
106
|
+
</li>
|
107
|
+
<li><p id="_">Second</p><p id="_">entry1</p>
|
108
|
+
<p id="_">entry2</p></li>
|
109
|
+
</ul>
|
110
|
+
<ol id="id1" type="alphabet">
|
111
|
+
<li>
|
112
|
+
<p id="_">First</p>
|
113
|
+
</li>
|
114
|
+
<li>
|
115
|
+
<p id="_">Second</p>
|
116
|
+
<ol id="_" type="alphabet_upper">
|
117
|
+
<li>
|
118
|
+
<p id="_">Third</p>
|
119
|
+
</li>
|
120
|
+
<li>
|
121
|
+
<p id="_">Fourth</p>
|
122
|
+
</li>
|
123
|
+
</ol>
|
124
|
+
</li>
|
125
|
+
<li>
|
126
|
+
<p id="_">Fifth</p>
|
127
|
+
</li>
|
128
|
+
<li>
|
129
|
+
<p id="_">Sixth</p>
|
130
|
+
</li>
|
131
|
+
</ol>
|
132
|
+
<ol id="_" type="roman">
|
133
|
+
<li>
|
134
|
+
<p id="_">A</p>
|
135
|
+
</li>
|
136
|
+
<li>
|
137
|
+
<p id="_">B</p>
|
138
|
+
<ol id="_" type="roman_upper">
|
139
|
+
<li>
|
140
|
+
<p id="_">C</p>
|
141
|
+
</li>
|
142
|
+
<li>
|
143
|
+
<p id="_">D</p>
|
144
|
+
<ol id="_" type="arabic">
|
145
|
+
<li>
|
146
|
+
<p id="_">E</p>
|
147
|
+
</li>
|
148
|
+
<li>
|
149
|
+
<p id="_">F</p>
|
150
|
+
<dl id="_">
|
151
|
+
<dt>Notes1</dt>
|
152
|
+
<dd/>
|
153
|
+
<dt>Notes</dt>
|
154
|
+
<dd><p id="_">Note 1.</p><p id="_">Note 2.</p>
|
155
|
+
<p id="_">Note 3.</p></dd>
|
156
|
+
</dl>
|
157
|
+
</li>
|
158
|
+
</ol>
|
159
|
+
</li>
|
160
|
+
</ol>
|
161
|
+
</li>
|
162
|
+
</ol></sections>
|
163
|
+
</iso-standard>
|
164
|
+
OUTPUT
|
165
|
+
end
|
166
|
+
|
167
|
+
it "anchors lists and list items" do
|
168
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
169
|
+
#{ASCIIDOC_BLANK_HDR}
|
170
|
+
[[id1]]
|
171
|
+
* [[id2]] List item
|
172
|
+
* Hello [[id3]] List item
|
173
|
+
|
174
|
+
INPUT
|
175
|
+
#{BLANK_HDR}
|
176
|
+
<sections>
|
177
|
+
<ul id="id1">
|
178
|
+
<li id="id2">
|
179
|
+
<p id="_">List item</p>
|
180
|
+
</li>
|
181
|
+
<li>
|
182
|
+
<p id="_">Hello <bookmark id="id3"/> List item</p>
|
183
|
+
</li>
|
184
|
+
</ul>
|
185
|
+
</sections>
|
186
|
+
</iso-standard>
|
187
|
+
OUTPUT
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Asciidoctor::Iec do
|
4
|
+
it "processes the Asciidoctor::ISO inline macros" do
|
5
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
6
|
+
#{ASCIIDOC_BLANK_HDR}
|
7
|
+
alt:[term1]
|
8
|
+
deprecated:[term1]
|
9
|
+
domain:[term1]
|
10
|
+
INPUT
|
11
|
+
#{BLANK_HDR}
|
12
|
+
<sections>
|
13
|
+
<admitted>term1</admitted>
|
14
|
+
<deprecates>term1</deprecates>
|
15
|
+
<domain>term1</domain>
|
16
|
+
</sections>
|
17
|
+
</iso-standard>
|
18
|
+
OUTPUT
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,268 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "relaton_iso"
|
3
|
+
require "relaton_ietf"
|
4
|
+
|
5
|
+
RSpec.describe Asciidoctor::Iec do
|
6
|
+
it "processes draft ISO reference" do
|
7
|
+
#stub_fetch_ref no_year: true, note: "The standard is in press"
|
8
|
+
|
9
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
10
|
+
#{ASCIIDOC_BLANK_HDR}
|
11
|
+
[bibliography]
|
12
|
+
== Normative References
|
13
|
+
|
14
|
+
* [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_
|
15
|
+
INPUT
|
16
|
+
#{BLANK_HDR}
|
17
|
+
<sections>
|
18
|
+
</sections><bibliography><references id="_" obligation="informative">
|
19
|
+
<title>Normative References</title>
|
20
|
+
<bibitem id="iso123" type="standard">
|
21
|
+
<title format="text/plain">Standard</title>
|
22
|
+
<docidentifier>ISO 123:—</docidentifier>
|
23
|
+
<date type="published">
|
24
|
+
<on>--</on>
|
25
|
+
</date>
|
26
|
+
<contributor>
|
27
|
+
<role type="publisher"/>
|
28
|
+
<organization>
|
29
|
+
<name>International Organization for Standardization</name>
|
30
|
+
<abbreviation>ISO</abbreviation>
|
31
|
+
</organization>
|
32
|
+
</contributor>
|
33
|
+
<note format="text/plain" reference="1">ISO DATE: The standard is in press</note>
|
34
|
+
</bibitem>
|
35
|
+
</references>
|
36
|
+
</bibliography>
|
37
|
+
</iso-standard>
|
38
|
+
OUTPUT
|
39
|
+
end
|
40
|
+
|
41
|
+
it "processes all-parts ISO reference" do
|
42
|
+
#stub_fetch_ref(all_parts: true)
|
43
|
+
|
44
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
45
|
+
#{ASCIIDOC_BLANK_HDR}
|
46
|
+
[bibliography]
|
47
|
+
== Normative References
|
48
|
+
|
49
|
+
* [[[iso123,ISO 123:1066 (all parts)]]] _Standard_
|
50
|
+
INPUT
|
51
|
+
#{BLANK_HDR}
|
52
|
+
<sections>
|
53
|
+
</sections><bibliography><references id="_" obligation="informative">
|
54
|
+
<title>Normative References</title>
|
55
|
+
<bibitem id="iso123" type="standard">
|
56
|
+
<title format="text/plain">Standard</title>
|
57
|
+
<docidentifier>ISO 123:1066 (all parts)</docidentifier>
|
58
|
+
<date type="published">
|
59
|
+
<on>1066</on>
|
60
|
+
</date>
|
61
|
+
<contributor>
|
62
|
+
<role type="publisher"/>
|
63
|
+
<organization>
|
64
|
+
<name>International Organization for Standardization</name>
|
65
|
+
<abbreviation>ISO</abbreviation>
|
66
|
+
</organization>
|
67
|
+
</contributor>
|
68
|
+
<extent type="part"><referenceFrom>all</referenceFrom></extent>
|
69
|
+
</bibitem>
|
70
|
+
</references>
|
71
|
+
</bibliography>
|
72
|
+
</iso-standard>
|
73
|
+
OUTPUT
|
74
|
+
end
|
75
|
+
|
76
|
+
it "processes non-ISO reference in Normative References" do
|
77
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
78
|
+
#{ASCIIDOC_BLANK_HDR}
|
79
|
+
[bibliography]
|
80
|
+
== Normative References
|
81
|
+
|
82
|
+
* [[[iso123,XYZ 123:1066 (all parts)]]] _Standard_
|
83
|
+
INPUT
|
84
|
+
#{BLANK_HDR}
|
85
|
+
<sections>
|
86
|
+
|
87
|
+
</sections><bibliography><references id="_" obligation="informative">
|
88
|
+
<title>Normative References</title>
|
89
|
+
<bibitem id="iso123">
|
90
|
+
<formattedref format="application/x-isodoc+xml">
|
91
|
+
<em>Standard</em>
|
92
|
+
</formattedref>
|
93
|
+
<docidentifier>XYZ 123:1066 (all parts)</docidentifier>
|
94
|
+
</bibitem>
|
95
|
+
</references>
|
96
|
+
</bibliography>
|
97
|
+
</iso-standard>
|
98
|
+
OUTPUT
|
99
|
+
end
|
100
|
+
|
101
|
+
it "processes non-ISO reference in Bibliography" do
|
102
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
103
|
+
#{ASCIIDOC_BLANK_HDR}
|
104
|
+
[bibliography]
|
105
|
+
== Bibliography
|
106
|
+
|
107
|
+
* [[[iso123,1]]] _Standard_
|
108
|
+
INPUT
|
109
|
+
#{BLANK_HDR}
|
110
|
+
<sections>
|
111
|
+
|
112
|
+
</sections><bibliography><references id="_" obligation="informative">
|
113
|
+
<title>Bibliography</title>
|
114
|
+
<bibitem id="iso123">
|
115
|
+
<formattedref format="application/x-isodoc+xml">
|
116
|
+
<em>Standard</em>
|
117
|
+
</formattedref>
|
118
|
+
<docidentifier>[1]</docidentifier>
|
119
|
+
</bibitem>
|
120
|
+
</references>
|
121
|
+
</bibliography>
|
122
|
+
</iso-standard>
|
123
|
+
OUTPUT
|
124
|
+
end
|
125
|
+
|
126
|
+
private
|
127
|
+
|
128
|
+
private
|
129
|
+
|
130
|
+
def mock_isobib_get_123
|
131
|
+
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 123", nil, {}) do
|
132
|
+
IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
|
133
|
+
<bibitem type=\"international-standard\" id=\"ISO123\">\n <fetched>#{Date.today}</fetched>\n<title format=\"text/plain\" language=\"en\" script=\"Latn\">Rubber latex -- Sampling</title>\n <title format=\"text/plain\" language=\"fr\" script=\"Latn\">Latex de caoutchouc -- ?chantillonnage</title>\n <uri type=\"src\">https://www.iso.org/standard/23281.html</uri>\n <uri type=\"obp\">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>\n <uri type=\"rss\">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>\n <docidentifier type="ISO">ISO 123:2001</docidentifier>\n <date type=\"published\">\n <on>2001</on>\n </date>\n <contributor>\n <role type=\"publisher\"/>\n <organization>\n <name>International Organization for Standardization</name>\n <abbreviation>ISO</abbreviation>\n <uri>www.iso.org</uri>\n </organization>\n </contributor>\n <edition>3</edition>\n <language>en</language>\n <language>fr</language>\n <script>Latn</script>\n <status>Published</status>\n <copyright>\n <from>2001</from>\n <owner>\n <organization>\n <name>ISO</name>\n <abbreviation></abbreviation>\n </organization>\n </owner>\n </copyright>\n <relation type=\"obsoletes\">\n <bibitem>\n <formattedref>ISO 123:1985</formattedref>\n </bibitem>\n </relation>\n <relation type=\"updates\">\n <bibitem>\n <formattedref>ISO 123:2001</formattedref>\n </bibitem>\n </relation>\n</bibitem>
|
134
|
+
OUTPUT
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def mock_isobib_get_124
|
139
|
+
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 124", "2014", {}) do
|
140
|
+
IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
|
141
|
+
<bibitem type="international-standard" id="iso124">
|
142
|
+
<fetched>#{Date.today}</fetched>
|
143
|
+
<title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title>
|
144
|
+
<title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Détermination des matières solides totales</title>
|
145
|
+
<uri type="src">https://www.iso.org/standard/61884.html</uri>
|
146
|
+
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
|
147
|
+
<uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
|
148
|
+
<docidentifier type="ISO">ISO 124:2014</docidentifier>
|
149
|
+
<date type="published">
|
150
|
+
<on>2014</on>
|
151
|
+
</date>
|
152
|
+
<contributor>
|
153
|
+
<role type="publisher"/>
|
154
|
+
<organization>
|
155
|
+
<name>International Organization for Standardization</name>
|
156
|
+
<abbreviation>ISO</abbreviation>
|
157
|
+
<uri>www.iso.org</uri>
|
158
|
+
</organization>
|
159
|
+
</contributor>
|
160
|
+
<edition>7</edition>
|
161
|
+
<language>en</language>
|
162
|
+
<language>fr</language>
|
163
|
+
<script>Latn</script>
|
164
|
+
<abstract format="plain" language="en" script="Latn">ISO 124:2014 specifies methods for the determination of the total solids content of natural rubber field and concentrated latices and synthetic rubber latex. These methods are not necessarily suitable for latex from natural sources other than the Hevea brasiliensis, for vulcanized latex, for compounded latex, or for artificial dispersions of rubber.</abstract>
|
165
|
+
<status>Published</status>
|
166
|
+
<copyright>
|
167
|
+
<from>2014</from>
|
168
|
+
<owner>
|
169
|
+
<organization>
|
170
|
+
<name>ISO</name>
|
171
|
+
<abbreviation/>
|
172
|
+
</organization>
|
173
|
+
</owner>
|
174
|
+
</copyright>
|
175
|
+
<relation type="obsoletes">
|
176
|
+
<bibitem>
|
177
|
+
<formattedref>ISO 124:2011</formattedref>
|
178
|
+
</bibitem>
|
179
|
+
</relation>
|
180
|
+
<ics>
|
181
|
+
<code>83.040.10</code>
|
182
|
+
<text>Latex and raw rubber</text>
|
183
|
+
</ics>
|
184
|
+
</bibitem>
|
185
|
+
OUTPUT
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
def mock_isobib_get_iec12382
|
190
|
+
expect(Isobib::IsoBibliography).to receive(:get).with("ISO/IEC TR 12382", "1992", {}) do
|
191
|
+
IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
|
192
|
+
<bibitem type="international-standard" id="iso123">
|
193
|
+
<fetched>#{Date.today}</fetched>
|
194
|
+
<title format="text/plain" language="en" script="Latn">Permuted index of the vocabulary of information technology</title>
|
195
|
+
<title format="text/plain" language="fr" script="Latn">Index permuté du vocabulaire des technologies de l'information</title>
|
196
|
+
<uri type="src">https://www.iso.org/standard/21071.html</uri>
|
197
|
+
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:21071:en</uri>
|
198
|
+
<uri type="rss">https://www.iso.org/contents/data/standard/02/10/21071.detail.rss</uri>
|
199
|
+
<docidentifier type="ISO">ISO/IEC 12382:1992</docidentifier>
|
200
|
+
<date type="published">
|
201
|
+
<on>1992</on>
|
202
|
+
</date>
|
203
|
+
<contributor>
|
204
|
+
<role type="publisher"/>
|
205
|
+
<organization>
|
206
|
+
<name>International Organization for Standardization</name>
|
207
|
+
<abbreviation>ISO</abbreviation>
|
208
|
+
<uri>www.iso.org</uri>
|
209
|
+
</organization>
|
210
|
+
</contributor>
|
211
|
+
<contributor>
|
212
|
+
<role type="publisher"/>
|
213
|
+
<organization>
|
214
|
+
<name>International Electrotechnical Commission</name>
|
215
|
+
<abbreviation>IEC</abbreviation>
|
216
|
+
<uri>www.iec.ch</uri>
|
217
|
+
</organization>
|
218
|
+
</contributor>
|
219
|
+
<edition>2</edition>
|
220
|
+
<language>en</language>
|
221
|
+
<language>fr</language>
|
222
|
+
<script>Latn</script>
|
223
|
+
<abstract format="plain" language="en" script="Latn">Contains a permuted index of all terms included in the parts 1 - 28 of ISO 2382. If any of these parts has been revised, the present TR refers to the revision.</abstract>
|
224
|
+
<status>Published</status>
|
225
|
+
<copyright>
|
226
|
+
<from>1992</from>
|
227
|
+
<owner>
|
228
|
+
<organization>
|
229
|
+
<name>ISO/IEC</name>
|
230
|
+
<abbreviation/>
|
231
|
+
</organization>
|
232
|
+
</owner>
|
233
|
+
</copyright>
|
234
|
+
<relation type="updates">
|
235
|
+
<bibitem>
|
236
|
+
<formattedref>ISO/IEC TR 12382:1992</formattedref>
|
237
|
+
</bibitem>
|
238
|
+
</relation>
|
239
|
+
<ics>
|
240
|
+
<code>35.020</code>
|
241
|
+
<text>Information technology (IT) in general</text>
|
242
|
+
</ics>
|
243
|
+
<ics>
|
244
|
+
<code>01.040.35</code>
|
245
|
+
<text>Information technology (Vocabularies)</text>
|
246
|
+
</ics>
|
247
|
+
</bibitem>
|
248
|
+
OUTPUT
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
def mock_rfcbib_get_rfc8341
|
253
|
+
expect(IETFBib::RfcBibliography).to receive(:get).with("RFC 8341", nil, {}) do
|
254
|
+
IETFBib::XMLParser.from_xml(<<~"OUTPUT")
|
255
|
+
<bibitem id="RFC8341">
|
256
|
+
<fetched>#{Date.today}</fetched>
|
257
|
+
<title format="text/plain" language="en" script="Latn">Network Configuration Access Control Model</title>
|
258
|
+
<docidentifier type="IETF">RFC 8341</docidentifier>
|
259
|
+
<date type="published">
|
260
|
+
<on>2018</on>
|
261
|
+
</date>
|
262
|
+
<status>published</status>
|
263
|
+
</bibitem>
|
264
|
+
OUTPUT
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
end
|