metanorma-iec 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/asciidoctor/iec/converter.rb +42 -25
- data/lib/asciidoctor/iec/front.rb +2 -3
- data/lib/asciidoctor/iec/isodoc.rng +42 -17
- data/lib/isodoc/iec/base_convert.rb +0 -33
- data/lib/isodoc/iec/html/htmlstyle.css +3 -1
- data/lib/isodoc/iec/html/htmlstyle.scss +4 -1
- data/lib/isodoc/iec/html/isodoc.css +1 -2
- data/lib/isodoc/iec/html/isodoc.scss +1 -2
- data/lib/isodoc/iec/iec.international-standard.xsl +23 -10
- data/lib/isodoc/iec/presentation_xml_convert.rb +32 -5
- data/lib/metanorma/iec/processor.rb +15 -8
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +2 -2
- data/spec/asciidoctor/base_spec.rb +0 -4
- data/spec/asciidoctor/cleanup_spec.rb +231 -202
- data/spec/asciidoctor/iev_spec.rb +195 -190
- data/spec/isodoc/iev_spec.rb +136 -28
- data/spec/isodoc/terms_spec.rb +190 -181
- data/spec/metanorma/processor_spec.rb +139 -44
- data/spec/spec_helper.rb +10 -12
- metadata +5 -5
data/spec/isodoc/terms_spec.rb
CHANGED
@@ -3,191 +3,200 @@ require "spec_helper"
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes IsoXML terms" do
|
5
5
|
input = <<~INPUT
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<term id="paddy1"><preferred>paddy</preferred>
|
11
|
-
<domain>rice</domain>
|
12
|
-
<definition><
|
13
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
</termexample>
|
19
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
</termexample>
|
24
|
-
|
25
|
-
<termsource status="modified">
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
</termsource></term>
|
31
|
-
|
32
|
-
<term id="paddy">
|
33
|
-
<preferred>paddy</preferred><admitted>paddy rice</admitted>
|
34
|
-
<admitted>rough rice</admitted>
|
35
|
-
<deprecates>cargo rice</deprecates>
|
36
|
-
<definition><
|
37
|
-
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
38
|
-
|
39
|
-
</termnote>
|
40
|
-
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
41
|
-
<ul><li>A</li></ul>
|
42
|
-
|
43
|
-
</termnote>
|
44
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
</termexample>
|
49
|
-
<termsource status="identical">
|
50
|
-
|
51
|
-
</termsource></term>
|
52
|
-
</terms>
|
53
|
-
</sections>
|
54
|
-
</iso-standard>
|
6
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
|
+
<sections>
|
8
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title>
|
9
|
+
|
10
|
+
<term id="paddy1"><preferred>paddy</preferred>
|
11
|
+
<domain>rice</domain>
|
12
|
+
<definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbal-definition></definition>
|
13
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
14
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
15
|
+
<ul>
|
16
|
+
<li>A</li>
|
17
|
+
</ul>
|
18
|
+
</termexample>
|
19
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
20
|
+
<ul>
|
21
|
+
<li>A</li>
|
22
|
+
</ul>
|
23
|
+
</termexample>
|
24
|
+
|
25
|
+
<termsource status="modified">
|
26
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
27
|
+
<modification>
|
28
|
+
<p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
|
29
|
+
</modification>
|
30
|
+
</termsource></term>
|
31
|
+
|
32
|
+
<term id="paddy">
|
33
|
+
<preferred>paddy</preferred><admitted>paddy rice</admitted>
|
34
|
+
<admitted>rough rice</admitted>
|
35
|
+
<deprecates>cargo rice</deprecates>
|
36
|
+
<definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbal-definition></definition>
|
37
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
38
|
+
<p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
39
|
+
</termnote>
|
40
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
41
|
+
<ul><li>A</li></ul>
|
42
|
+
<p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
43
|
+
</termnote>
|
44
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
45
|
+
<ul>
|
46
|
+
<li>A</li>
|
47
|
+
</ul>
|
48
|
+
</termexample>
|
49
|
+
<termsource status="identical">
|
50
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
51
|
+
</termsource></term>
|
52
|
+
</terms>
|
53
|
+
</sections>
|
54
|
+
</iso-standard>
|
55
55
|
INPUT
|
56
56
|
presxml = <<~INPUT
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
<
|
63
|
-
<
|
64
|
-
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"
|
65
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
66
|
-
<name>EXAMPLE 1</name>
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
</termexample>
|
72
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
73
|
-
<name>EXAMPLE 2</name>
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
</termexample>
|
78
|
-
|
79
|
-
<termsource status="modified">
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
</termsource></term>
|
85
|
-
|
86
|
-
<term id="paddy">
|
87
|
-
<name>1.2</name>
|
88
|
-
<preferred>paddy</preferred><admitted>paddy rice</admitted>
|
89
|
-
<admitted>rough rice</admitted>
|
90
|
-
<deprecates>cargo rice</deprecates>
|
91
|
-
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
92
|
-
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
93
|
-
<name>Note 1 to entry</name>
|
94
|
-
|
95
|
-
</termnote>
|
96
|
-
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
97
|
-
<name>Note 2 to entry</name>
|
98
|
-
<ul><li>A</li></ul>
|
99
|
-
|
100
|
-
</termnote>
|
101
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
102
|
-
<name>EXAMPLE</name>
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
</termexample>
|
107
|
-
<termsource status="identical">
|
108
|
-
|
109
|
-
</termsource></term>
|
110
|
-
</terms>
|
111
|
-
</sections>
|
112
|
-
</iso-standard>
|
57
|
+
<?xml version='1.0'?>
|
58
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
59
|
+
<sections>
|
60
|
+
<terms id="_terms_and_definitions" obligation="normative" displayorder="1"><title depth="1">1<tab/>Terms and definitions</title>
|
61
|
+
|
62
|
+
<term id="paddy1">
|
63
|
+
<name>1.1</name><preferred>paddy</preferred>
|
64
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"><rice> rice retaining its husk after threshing</p></definition>
|
65
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
66
|
+
<name>EXAMPLE 1</name>
|
67
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
68
|
+
<ul>
|
69
|
+
<li>A</li>
|
70
|
+
</ul>
|
71
|
+
</termexample>
|
72
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
73
|
+
<name>EXAMPLE 2</name>
|
74
|
+
<ul>
|
75
|
+
<li>A</li>
|
76
|
+
</ul>
|
77
|
+
</termexample>
|
78
|
+
|
79
|
+
<termsource status="modified">
|
80
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
81
|
+
<modification>
|
82
|
+
<p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
|
83
|
+
</modification>
|
84
|
+
</termsource></term>
|
85
|
+
|
86
|
+
<term id="paddy">
|
87
|
+
<name>1.2</name>
|
88
|
+
<preferred>paddy</preferred><admitted>paddy rice</admitted>
|
89
|
+
<admitted>rough rice</admitted>
|
90
|
+
<deprecates>cargo rice</deprecates>
|
91
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
92
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
93
|
+
<name>Note 1 to entry</name>
|
94
|
+
<p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
95
|
+
</termnote>
|
96
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
97
|
+
<name>Note 2 to entry</name>
|
98
|
+
<ul><li>A</li></ul>
|
99
|
+
<p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
100
|
+
</termnote>
|
101
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
102
|
+
<name>EXAMPLE</name>
|
103
|
+
<ul>
|
104
|
+
<li>A</li>
|
105
|
+
</ul>
|
106
|
+
</termexample>
|
107
|
+
<termsource status="identical">
|
108
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
109
|
+
</termsource></term>
|
110
|
+
</terms>
|
111
|
+
</sections>
|
112
|
+
</iso-standard>
|
113
113
|
INPUT
|
114
114
|
html = <<~OUTPUT
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
OUTPUT
|
155
|
-
|
115
|
+
#{HTML_HDR}
|
116
|
+
<div id="">
|
117
|
+
<h1 class="ForewordTitle">FOREWORD</h1>
|
118
|
+
<div class="boilerplate_legal"/>
|
119
|
+
</div>
|
120
|
+
#{IEC_TITLE1}
|
121
|
+
<div id="_terms_and_definitions"><h1>1  Terms and definitions</h1>
|
122
|
+
<p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
|
123
|
+
|
124
|
+
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"><rice> rice retaining its husk after threshing</p>
|
125
|
+
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p><span class="example_label">EXAMPLE 1</span>  Foreign seeds, husks, bran, sand, dust.</p><ul>
|
126
|
+
<li>A</li>
|
127
|
+
</ul></div>
|
128
|
+
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p><span class="example_label">EXAMPLE 2</span>  </p>
|
129
|
+
<ul>
|
130
|
+
<li>A</li>
|
131
|
+
</ul>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
<p>[TERMREF]
|
135
|
+
<a href="#ISO7301">ISO 7301:2011, 3.1</a>
|
136
|
+
[MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
|
137
|
+
[/TERMREF]</p><p class="TermNum" id="paddy">1.2</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
|
138
|
+
<p class="AltTerms" style="text-align:left;">rough rice</p>
|
139
|
+
<p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
|
140
|
+
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
|
141
|
+
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p><span class="example_label">EXAMPLE</span>  </p>
|
142
|
+
<ul>
|
143
|
+
<li>A</li>
|
144
|
+
</ul>
|
145
|
+
</div>
|
146
|
+
<div id="_671a1994-4783-40d0-bc81-987d06ffb74e" class="Note"><p>Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
|
147
|
+
<div id='_671a1994-4783-40d0-bc81-987d06ffb74f' class="Note"><p>Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
|
148
|
+
<p>[TERMREF]
|
149
|
+
<a href="#ISO7301">ISO 7301:2011, 3.1</a>
|
150
|
+
[/TERMREF]</p></div>
|
151
|
+
</div>
|
152
|
+
</body>
|
153
|
+
</html>
|
154
|
+
OUTPUT
|
155
|
+
|
156
156
|
word = <<~OUTPUT
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
OUTPUT
|
189
|
-
expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({})
|
190
|
-
|
191
|
-
|
157
|
+
<div id="_terms_and_definitions"><h1>1<span style="mso-tab-count:1">  </span>Terms and definitions</h1><p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
|
158
|
+
|
159
|
+
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"><rice> rice retaining its husk after threshing</p>
|
160
|
+
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">  </span>Foreign seeds, husks, bran, sand, dust.</p><ul>
|
161
|
+
<li>A</li>
|
162
|
+
</ul></div>
|
163
|
+
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p><span class="example_label">EXAMPLE 2</span><span style="mso-tab-count:1">  </span></p>
|
164
|
+
|
165
|
+
<ul>
|
166
|
+
<li>A</li>
|
167
|
+
</ul>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<p>[TERMREF]
|
171
|
+
<a href="#ISO7301">ISO 7301:2011, 3.1</a>
|
172
|
+
[MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
|
173
|
+
[/TERMREF]</p><p class="TermNum" id="paddy">1.2</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
|
174
|
+
<p class="AltTerms" style="text-align:left;">rough rice</p>
|
175
|
+
<p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
|
176
|
+
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p><div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p><span class="example_label">EXAMPLE</span><span style="mso-tab-count:1">  </span></p>
|
177
|
+
|
178
|
+
<ul>
|
179
|
+
<li>A</li>
|
180
|
+
</ul>
|
181
|
+
</div><div id="_671a1994-4783-40d0-bc81-987d06ffb74e" class="Note"><p class="Note">Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div><div id="_671a1994-4783-40d0-bc81-987d06ffb74f" class="Note"><p class="Note">Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
<p>[TERMREF]
|
186
|
+
<a href="#ISO7301">ISO 7301:2011, 3.1</a>
|
187
|
+
[/TERMREF]</p></div>
|
188
|
+
OUTPUT
|
189
|
+
expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({})
|
190
|
+
.convert("test", input, true)))
|
191
|
+
.to be_equivalent_to xmlpp(presxml)
|
192
|
+
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({})
|
193
|
+
.convert("test", presxml, true)))
|
194
|
+
.to be_equivalent_to xmlpp(html)
|
195
|
+
expect(xmlpp(IsoDoc::Iec::WordConvert.new({})
|
196
|
+
.convert("test", presxml, true)
|
197
|
+
.sub(%r{^.*<div id="_terms_and_definitions">}m,
|
198
|
+
'<div id="_terms_and_definitions">')
|
199
|
+
.sub(%r{</div>\s*<br[^>]*>\s*<div class="colophon"/>.*$}m, "")))
|
200
|
+
.to be_equivalent_to xmlpp(word)
|
192
201
|
end
|
193
202
|
end
|
@@ -2,20 +2,112 @@ require "spec_helper"
|
|
2
2
|
require "metanorma"
|
3
3
|
require "fileutils"
|
4
4
|
|
5
|
-
#RSpec.describe Asciidoctor::Gb do
|
6
5
|
RSpec.describe Metanorma::Iec::Processor do
|
7
|
-
|
8
6
|
registry = Metanorma::Registry.instance
|
9
7
|
registry.register(Metanorma::Iec::Processor)
|
10
8
|
processor = registry.find_processor(:iec)
|
11
9
|
|
10
|
+
inputxml = <<~INPUT
|
11
|
+
<iec-standard xmlns="http://riboseinc.com/isoxml">
|
12
|
+
<bibdata type="standard">
|
13
|
+
<title language="en" format="text/plain" type="main">English</title>
|
14
|
+
<title language="en" format="text/plain" type="title-main">English</title>
|
15
|
+
<title language="fr" format="text/plain" type="main">French</title>
|
16
|
+
<title language="fr" format="text/plain" type="title-main">French</title>
|
17
|
+
<docidentifier type="ISO">ISO DIR 1</docidentifier><docidentifier type="iso-with-lang">ISO DIR 1(F)</docidentifier><docidentifier type="iso-reference">ISO DIR 1(F)</docidentifier>
|
18
|
+
<docnumber>1</docnumber>
|
19
|
+
<contributor>
|
20
|
+
<role type="author"/>
|
21
|
+
<organization>
|
22
|
+
<name>International Organization for Standardization</name>
|
23
|
+
<abbreviation>ISO</abbreviation>
|
24
|
+
</organization>
|
25
|
+
</contributor>
|
26
|
+
<contributor>
|
27
|
+
<role type="publisher"/>
|
28
|
+
<organization>
|
29
|
+
<name>International Organization for Standardization</name>
|
30
|
+
<abbreviation>ISO</abbreviation>
|
31
|
+
</organization>
|
32
|
+
</contributor>
|
33
|
+
<language>fr</language>
|
34
|
+
<script>Latn</script>
|
35
|
+
<status>
|
36
|
+
<stage abbreviation="IS">60</stage>
|
37
|
+
<substage>60</substage>
|
38
|
+
</status>
|
39
|
+
<copyright>
|
40
|
+
<from>2021</from>
|
41
|
+
<owner>
|
42
|
+
<organization>
|
43
|
+
<name>International Organization for Standardization</name>
|
44
|
+
<abbreviation>ISO</abbreviation>
|
45
|
+
</organization>
|
46
|
+
</owner>
|
47
|
+
</copyright>
|
48
|
+
<ext>
|
49
|
+
<doctype>directive</doctype>
|
50
|
+
<subdoctype>vocabulary</subdoctype>
|
51
|
+
<editorialgroup>
|
52
|
+
<technical-committee/>
|
53
|
+
<subcommittee/>
|
54
|
+
<workgroup/>
|
55
|
+
</editorialgroup>
|
56
|
+
<structuredidentifier>
|
57
|
+
<project-number>ISO 1</project-number>
|
58
|
+
</structuredidentifier>
|
59
|
+
<stagename>International standard</stagename>
|
60
|
+
</ext>
|
61
|
+
</bibdata>
|
62
|
+
<boilerplate>
|
63
|
+
<copyright-statement>
|
64
|
+
<clause>
|
65
|
+
<title>DOCUMENT PROTÉGÉ PAR COPYRIGHT</title>
|
66
|
+
<p id="boilerplate-year">© ISO 2021</p>
|
67
|
+
|
68
|
+
<p id="boilerplate-message">
|
69
|
+
Droits de reproduction réservés. Sauf indication contraire, aucune partie de cette publication ne
|
70
|
+
peut être reproduite ni utilisée sous quelque forme que ce soit et par aucun procédé, électronique
|
71
|
+
ou mécanique, y compris la photocopie, l’affichage sur l’internet ou sur un Intranet, sans
|
72
|
+
autorisation écrite préalable. Les demandes d’autorisation peuvent être adressées à l’ISO à
|
73
|
+
l’adresse ci-après ou au comité membre de l’ISO dans le pays du demandeur.
|
74
|
+
</p>
|
75
|
+
|
76
|
+
<p id="boilerplate-address" align="left">
|
77
|
+
ISO copyright office<br/>
|
78
|
+
Ch. de Blandonnet 8 • CP 401<br/>
|
79
|
+
CH-1214 Vernier, Geneva, Switzerland<br/>
|
80
|
+
Tel.  + 41 22 749 01 11<br/>
|
81
|
+
Fax  + 41 22 749 09 47<br/>
|
82
|
+
Email: copyright@iso.org<br/>
|
83
|
+
Website: www.iso.org
|
84
|
+
</p>
|
85
|
+
<p id="boilerplate-place">
|
86
|
+
Publié en Suisse
|
87
|
+
</p>
|
88
|
+
</clause>
|
89
|
+
</copyright-statement>
|
90
|
+
|
91
|
+
|
92
|
+
</boilerplate>
|
93
|
+
<sections>
|
94
|
+
<terms id="H" obligation="normative"><title>1  Terms, Definitions, Symbols and Abbreviated Terms</title>
|
95
|
+
<term id="J">
|
96
|
+
<name>1.1</name>
|
97
|
+
<preferred>Term2</preferred>
|
98
|
+
</term>
|
99
|
+
</terms>
|
100
|
+
</sections>
|
101
|
+
</iec-standard>
|
102
|
+
INPUT
|
103
|
+
|
12
104
|
it "registers against metanorma" do
|
13
105
|
expect(processor).not_to be nil
|
14
106
|
end
|
15
107
|
|
16
108
|
it "registers output formats against metanorma" do
|
17
109
|
expect(processor.output_formats.sort.to_s).to be_equivalent_to <<~"OUTPUT"
|
18
|
-
|
110
|
+
[[:doc, "doc"], [:html, "html"], [:pdf, "pdf"], [:presentation, "presentation.xml"], [:rxl, "rxl"], [:sts, "sts.xml"], [:xml, "xml"]]
|
19
111
|
OUTPUT
|
20
112
|
end
|
21
113
|
|
@@ -24,53 +116,56 @@ RSpec.describe Metanorma::Iec::Processor do
|
|
24
116
|
end
|
25
117
|
|
26
118
|
it "generates IsoDoc XML from a blank document" do
|
27
|
-
|
28
|
-
|
119
|
+
input = <<~INPUT
|
120
|
+
#{ASCIIDOC_BLANK_HDR}
|
29
121
|
INPUT
|
30
|
-
|
31
|
-
|
32
|
-
|
122
|
+
output = <<~OUTPUT
|
123
|
+
#{blank_hdr_gen}
|
124
|
+
<sections/>
|
125
|
+
</iec-standard>
|
33
126
|
OUTPUT
|
127
|
+
expect(xmlpp(strip_guid(processor.input_to_isodoc(input, nil))))
|
128
|
+
.to be_equivalent_to xmlpp(output)
|
34
129
|
end
|
35
130
|
|
36
131
|
it "generates HTML from IsoDoc XML" do
|
37
132
|
FileUtils.rm_f "test.xml"
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
</
|
47
|
-
</
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
</
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
<p class="zzSTDTitle1"> </p>
|
68
|
-
<div id="H"><h1 id="toc1">1  Terms, Definitions, Symbols and Abbreviated Terms</h1>
|
69
|
-
<h2 class="TermNum" id="J">1.1</h2>
|
70
|
-
<p class="Terms" style="text-align:left;">Term2</p>
|
71
|
-
</div>
|
72
|
-
</main>
|
73
|
-
OUTPUT
|
133
|
+
FileUtils.rm_f "test.html"
|
134
|
+
processor.output(inputxml, "test.xml", "test.html", :html)
|
135
|
+
expect(xmlpp(File.read("test.html", encoding: "utf-8")
|
136
|
+
.gsub(%r{^.*<main}m, "<main")
|
137
|
+
.gsub(%r{</main>.*}m, "</main>")))
|
138
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
139
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
140
|
+
<br />
|
141
|
+
<p class="zzSTDTitle1">COMMISSION ELECTROTECHNIQUE INTERNATIONALE</p>
|
142
|
+
<p class="zzSTDTitle1">____________</p>
|
143
|
+
<p class="zzSTDTitle1"> </p>
|
144
|
+
<p class="zzSTDTitle1">
|
145
|
+
<b>French</b>
|
146
|
+
</p>
|
147
|
+
<p class="zzSTDTitle1"> </p>
|
148
|
+
<div id="">
|
149
|
+
<h1 class="ForewordTitle" id="toc0">AVANT-PROPOS</h1>
|
150
|
+
<div class="boilerplate_legal"></div>
|
151
|
+
</div>
|
152
|
+
<p class="zzSTDTitle1">
|
153
|
+
<b>French</b>
|
154
|
+
</p>
|
155
|
+
<p class="zzSTDTitle1"> </p>
|
156
|
+
<div id="H"><h1 id="toc1">1  Terms, Definitions, Symbols and Abbreviated Terms</h1>
|
157
|
+
<h2 class="TermNum" id="J">1.1</h2>
|
158
|
+
<p class="Terms" style="text-align:left;">Term2</p>
|
159
|
+
</div>
|
160
|
+
</main>
|
161
|
+
OUTPUT
|
74
162
|
end
|
75
163
|
|
164
|
+
it "generates STS from Metanorma XML" do
|
165
|
+
FileUtils.rm_f "test.xml"
|
166
|
+
FileUtils.rm_f "test.sts.xml"
|
167
|
+
File.open("test.xml", "w") { |f| f.write inputxml }
|
168
|
+
processor.output(inputxml, "test.xml", "test.sts.xml", :sts)
|
169
|
+
expect(File.exist?("test.sts.xml")).to be true
|
170
|
+
end
|
76
171
|
end
|