metanorma-iec 1.4.1 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Rakefile +1 -1
- data/lib/asciidoctor/iec/converter.rb +43 -26
- data/lib/asciidoctor/iec/front.rb +2 -3
- data/lib/asciidoctor/iec/iec.rng +48 -0
- data/lib/asciidoctor/iec/isodoc.rng +61 -18
- data/lib/asciidoctor/iec/isostandard.rng +14 -0
- data/lib/isodoc/iec/base_convert.rb +23 -58
- data/lib/isodoc/iec/html/htmlstyle.css +37 -5
- data/lib/isodoc/iec/html/htmlstyle.scss +34 -5
- data/lib/isodoc/iec/html/isodoc.css +1 -2
- data/lib/isodoc/iec/html/isodoc.scss +1 -2
- data/lib/isodoc/iec/html/scripts.html +0 -1
- data/lib/isodoc/iec/html/wordstyle.css +13 -11
- data/lib/isodoc/iec/html/wordstyle.scss +13 -11
- data/lib/isodoc/iec/iec.international-standard.xsl +428 -111
- data/lib/isodoc/iec/presentation_xml_convert.rb +193 -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 +459 -118
- data/spec/isodoc/postproc_spec.rb +2 -5
- data/spec/isodoc/terms_spec.rb +183 -181
- data/spec/metanorma/processor_spec.rb +139 -44
- data/spec/spec_helper.rb +10 -12
- metadata +6 -6
@@ -127,11 +127,8 @@ RSpec.describe IsoDoc do
|
|
127
127
|
<name>1.1</name>
|
128
128
|
<preferred>paddy</preferred>
|
129
129
|
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
130
|
-
<termsource status="modified">
|
131
|
-
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin
|
132
|
-
<modification>
|
133
|
-
<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>
|
134
|
-
</modification>
|
130
|
+
<termsource status="modified">[SOURCE:
|
131
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]
|
135
132
|
</termsource></term>
|
136
133
|
</terms>
|
137
134
|
</sections>
|
data/spec/isodoc/terms_spec.rb
CHANGED
@@ -3,191 +3,193 @@ 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
|
-
</
|
85
|
-
|
86
|
-
<
|
87
|
-
<
|
88
|
-
<
|
89
|
-
<
|
90
|
-
<
|
91
|
-
<
|
92
|
-
|
93
|
-
<
|
94
|
-
|
95
|
-
</
|
96
|
-
<
|
97
|
-
|
98
|
-
<
|
99
|
-
|
100
|
-
|
101
|
-
<
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
</
|
107
|
-
|
108
|
-
|
109
|
-
</
|
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">[SOURCE:
|
80
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>, modified – The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]
|
81
|
+
</termsource></term>
|
82
|
+
|
83
|
+
<term id="paddy">
|
84
|
+
<name>1.2</name>
|
85
|
+
<preferred>paddy</preferred><admitted>paddy rice</admitted>
|
86
|
+
<admitted>rough rice</admitted>
|
87
|
+
<deprecates>cargo rice</deprecates>
|
88
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
89
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
90
|
+
<name>Note 1 to entry</name>
|
91
|
+
<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>
|
92
|
+
</termnote>
|
93
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
94
|
+
<name>Note 2 to entry</name>
|
95
|
+
<ul><li>A</li></ul>
|
96
|
+
<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>
|
97
|
+
</termnote>
|
98
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
99
|
+
<name>EXAMPLE</name>
|
100
|
+
<ul>
|
101
|
+
<li>A</li>
|
102
|
+
</ul>
|
103
|
+
</termexample>
|
104
|
+
<termsource status="identical">[SOURCE:
|
105
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>]
|
106
|
+
</termsource></term>
|
107
|
+
</terms>
|
108
|
+
</sections>
|
109
|
+
</iso-standard>
|
113
110
|
INPUT
|
114
111
|
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
|
-
|
112
|
+
#{HTML_HDR}
|
113
|
+
<div id="">
|
114
|
+
<h1 class="ForewordTitle">FOREWORD</h1>
|
115
|
+
<div class="boilerplate_legal"/>
|
116
|
+
</div>
|
117
|
+
#{IEC_TITLE1}
|
118
|
+
<div id="_terms_and_definitions"><h1>1  Terms and definitions</h1>
|
119
|
+
<p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
|
120
|
+
|
121
|
+
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"><rice> rice retaining its husk after threshing</p>
|
122
|
+
<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>
|
123
|
+
<li>A</li>
|
124
|
+
</ul></div>
|
125
|
+
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p><span class="example_label">EXAMPLE 2</span>  </p>
|
126
|
+
<ul>
|
127
|
+
<li>A</li>
|
128
|
+
</ul>
|
129
|
+
</div>
|
130
|
+
|
131
|
+
<p>[SOURCE:
|
132
|
+
<a href="#ISO7301">ISO 7301:2011, 3.1</a>, modified – The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]
|
133
|
+
</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>
|
134
|
+
<p class="AltTerms" style="text-align:left;">rough rice</p>
|
135
|
+
<p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
|
136
|
+
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
|
137
|
+
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p><span class="example_label">EXAMPLE</span>  </p>
|
138
|
+
<ul>
|
139
|
+
<li>A</li>
|
140
|
+
</ul>
|
141
|
+
</div>
|
142
|
+
<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>
|
143
|
+
<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>
|
144
|
+
<p>[SOURCE:
|
145
|
+
<a href="#ISO7301">ISO 7301:2011, 3.1</a>]</p></div>
|
146
|
+
</div>
|
147
|
+
</body>
|
148
|
+
</html>
|
149
|
+
OUTPUT
|
150
|
+
|
156
151
|
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
|
-
</ul>
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({})
|
191
|
-
|
152
|
+
<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>
|
153
|
+
|
154
|
+
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"><rice> rice retaining its husk after threshing</p>
|
155
|
+
<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>
|
156
|
+
<li>A</li>
|
157
|
+
</ul></div>
|
158
|
+
<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>
|
159
|
+
|
160
|
+
<ul>
|
161
|
+
<li>A</li>
|
162
|
+
</ul>
|
163
|
+
</div>
|
164
|
+
|
165
|
+
<p>[SOURCE:
|
166
|
+
<a href="#ISO7301">ISO 7301:2011, 3.1</a>, modified –
|
167
|
+
The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</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>
|
168
|
+
<p class="AltTerms" style="text-align:left;">rough rice</p>
|
169
|
+
<p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
|
170
|
+
<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>
|
171
|
+
|
172
|
+
<ul>
|
173
|
+
<li>A</li>
|
174
|
+
</ul>
|
175
|
+
</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>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
<p>[SOURCE:
|
180
|
+
<a href="#ISO7301">ISO 7301:2011, 3.1</a>]</p></div>
|
181
|
+
OUTPUT
|
182
|
+
expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({})
|
183
|
+
.convert("test", input, true)))
|
184
|
+
.to be_equivalent_to xmlpp(presxml)
|
185
|
+
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({})
|
186
|
+
.convert("test", presxml, true)))
|
187
|
+
.to be_equivalent_to xmlpp(html)
|
188
|
+
expect(xmlpp(IsoDoc::Iec::WordConvert.new({})
|
189
|
+
.convert("test", presxml, true)
|
190
|
+
.sub(%r{^.*<div id="_terms_and_definitions">}m,
|
191
|
+
'<div id="_terms_and_definitions">')
|
192
|
+
.sub(%r{</div>\s*<br[^>]*>\s*<div class="colophon"/>.*$}m, "")))
|
193
|
+
.to be_equivalent_to xmlpp(word)
|
192
194
|
end
|
193
195
|
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
|