metanorma-iec 1.3.3 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +12 -11
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -6
- data/lib/asciidoctor/iec/front.rb +64 -46
- data/lib/asciidoctor/iec/iec.rng +4 -0
- data/lib/asciidoctor/iec/isodoc.rng +65 -7
- data/lib/asciidoctor/iec/isostandard.rng +18 -3
- data/lib/isodoc/iec/base_convert.rb +20 -14
- data/lib/isodoc/iec/html_convert.rb +6 -6
- data/lib/isodoc/iec/iec.international-standard.xsl +538 -67
- data/lib/isodoc/iec/metadata.rb +1 -1
- data/lib/isodoc/iec/pdf_convert.rb +1 -1
- data/lib/isodoc/iec/presentation_xml_convert.rb +17 -17
- data/lib/isodoc/iec/word_convert.rb +69 -19
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +2 -2
- data/spec/asciidoctor/blocks_spec.rb +0 -2
- data/spec/isodoc/blocks_spec.rb +2 -2
- data/spec/isodoc/i18n_spec.rb +346 -432
- data/spec/isodoc/iev_spec.rb +508 -519
- data/spec/isodoc/inline_spec.rb +2 -2
- data/spec/isodoc/postproc_spec.rb +221 -192
- data/spec/isodoc/ref_spec.rb +6 -6
- data/spec/isodoc/section_spec.rb +334 -339
- data/spec/isodoc/terms_spec.rb +1 -1
- metadata +5 -5
data/spec/isodoc/iev_spec.rb
CHANGED
@@ -1,560 +1,549 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
|
2
|
+
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes introductions under IEV" do
|
5
5
|
input = <<~INPUT
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<docnumber>60050</docnumber>
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
6
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
|
+
<bibdata>
|
8
|
+
<docidentifier type="iso">IEC/PWI 60050-871 ED 2</docidentifier>
|
9
|
+
<docnumber>60050</docnumber>
|
10
|
+
</bibdata>
|
11
|
+
<preface>
|
12
|
+
<foreword obligation="informative">
|
13
|
+
<title>Foreword</title>
|
14
|
+
<p id="A">This is a preamble</p>
|
15
|
+
</foreword>
|
16
|
+
<introduction id="B" obligation="informative"><title>Introduction</title>
|
17
|
+
<clause id="C" inline-header="false" obligation="informative">
|
18
|
+
<title>Introduction Subsection</title>
|
19
|
+
</clause>
|
20
|
+
</introduction></preface><sections/>
|
21
|
+
</iso-standard>
|
22
|
+
INPUT
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
</iso-standard>
|
44
|
-
OUTPUT
|
24
|
+
presxml = <<~OUTPUT
|
25
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
26
|
+
<bibdata>
|
27
|
+
<docidentifier type='iso'>IEC/PWI 60050-871 ED 2</docidentifier>
|
28
|
+
<docnumber>60050</docnumber>
|
29
|
+
</bibdata>
|
30
|
+
<preface>
|
31
|
+
<foreword obligation='informative' displayorder="1">
|
32
|
+
<title>Foreword</title>
|
33
|
+
<p id='A'>This is a preamble</p>
|
34
|
+
</foreword>
|
35
|
+
<introduction id='B' obligation='informative' displayorder="2">
|
36
|
+
<title depth='1'>Introduction</title>
|
37
|
+
<clause id='C' inline-header='false' obligation='informative'>
|
38
|
+
<title depth='2'>Introduction Subsection</title>
|
39
|
+
</clause>
|
40
|
+
</introduction>
|
41
|
+
</preface>
|
42
|
+
<sections/>
|
43
|
+
</iso-standard>
|
44
|
+
OUTPUT
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
</html>
|
66
|
-
|
46
|
+
html = <<~OUTPUT
|
47
|
+
#{HTML_HDR}
|
48
|
+
<div>
|
49
|
+
<h1 class='ForewordTitle'>FOREWORD</h1>
|
50
|
+
<div class='boilerplate_legal'/>
|
51
|
+
<p id='A'>This is a preamble</p>
|
52
|
+
</div>
|
53
|
+
<br/>
|
54
|
+
<div class='Section3' id='B'>
|
55
|
+
<h1 class='IntroTitle'>
|
56
|
+
Introduction
|
57
|
+
</h1>
|
58
|
+
<div id='C'>
|
59
|
+
<h2>Introduction Subsection</h2>
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
#{IEC_TITLE1}
|
63
|
+
</div>
|
64
|
+
</body>
|
65
|
+
</html>
|
66
|
+
OUTPUT
|
67
67
|
expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
|
68
68
|
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
69
69
|
end
|
70
70
|
|
71
71
|
it "processes bibliographies under IEV" do
|
72
72
|
input = <<~INPUT
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
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
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
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
|
-
|
73
|
+
<iec-standard xmlns='https://www.metanorma.org/ns/iec'>
|
74
|
+
<bibdata type='standard'>
|
75
|
+
<docidentifier type='iso'>IEC 60050 ED 1</docidentifier>
|
76
|
+
<docnumber>60050</docnumber>
|
77
|
+
<contributor>
|
78
|
+
<role type='author'/>
|
79
|
+
<organization>
|
80
|
+
<name>International Electrotechnical Commission</name>
|
81
|
+
<abbreviation>IEC</abbreviation>
|
82
|
+
</organization>
|
83
|
+
</contributor>
|
84
|
+
<contributor>
|
85
|
+
<role type='publisher'/>
|
86
|
+
<organization>
|
87
|
+
<name>International Electrotechnical Commission</name>
|
88
|
+
<abbreviation>IEC</abbreviation>
|
89
|
+
</organization>
|
90
|
+
</contributor>
|
91
|
+
<language>en</language>
|
92
|
+
<script>Latn</script>
|
93
|
+
<status>
|
94
|
+
<stage>60</stage>
|
95
|
+
<substage>60</substage>
|
96
|
+
</status>
|
97
|
+
<copyright>
|
98
|
+
<from>2020</from>
|
99
|
+
<owner>
|
100
|
+
<organization>
|
101
|
+
<name>International Electrotechnical Commission</name>
|
102
|
+
<abbreviation>IEC</abbreviation>
|
103
|
+
</organization>
|
104
|
+
</owner>
|
105
|
+
</copyright>
|
106
|
+
<ext>
|
107
|
+
<doctype>article</doctype>
|
108
|
+
<editorialgroup>
|
109
|
+
<technical-committee/>
|
110
|
+
<subcommittee/>
|
111
|
+
<workgroup/>
|
112
|
+
</editorialgroup>
|
113
|
+
<structuredidentifier>
|
114
|
+
<project-number>IEC 60050</project-number>
|
115
|
+
</structuredidentifier>
|
116
|
+
</ext>
|
117
|
+
</bibdata>
|
118
|
+
<sections> </sections>
|
119
|
+
<bibliography>
|
120
|
+
<references obligation='informative' normative="true" id="X">
|
121
|
+
<title>Normative References</title>
|
122
|
+
<p id='_'>There are no normative references in this document.</p>
|
123
|
+
<bibitem id='A'>
|
124
|
+
<formattedref format='application/x-isodoc+xml'>
|
125
|
+
<em>TITLE</em>
|
126
|
+
</formattedref>
|
127
|
+
<docidentifier>B</docidentifier>
|
128
|
+
</bibitem>
|
129
|
+
</references>
|
130
|
+
<references id='_' obligation='informative' normative="false">
|
131
|
+
<title>Bibliography</title>
|
132
|
+
<p id='_'>There are no normative references in this document.</p>
|
133
|
+
<bibitem id='A'>
|
134
|
+
<formattedref format='application/x-isodoc+xml'>
|
135
|
+
<em>TITLE</em>
|
136
|
+
</formattedref>
|
137
|
+
<docidentifier>B</docidentifier>
|
138
|
+
</bibitem>
|
139
|
+
</references>
|
140
140
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
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
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
</div>
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
</div>
|
226
|
-
|
227
|
-
|
228
|
-
</html>
|
229
|
-
OUTPUT
|
141
|
+
</bibliography>
|
142
|
+
</iec-standard>
|
143
|
+
INPUT
|
144
|
+
presxml = <<~OUTPUT
|
145
|
+
<iec-standard xmlns='https://www.metanorma.org/ns/iec' type="presentation">
|
146
|
+
<bibdata type='standard'>
|
147
|
+
<docidentifier type='iso'>IEC 60050 ED 1</docidentifier>
|
148
|
+
<docnumber>60050</docnumber>
|
149
|
+
<contributor>
|
150
|
+
<role type='author'/>
|
151
|
+
<organization>
|
152
|
+
<name>International Electrotechnical Commission</name>
|
153
|
+
<abbreviation>IEC</abbreviation>
|
154
|
+
</organization>
|
155
|
+
</contributor>
|
156
|
+
<contributor>
|
157
|
+
<role type='publisher'/>
|
158
|
+
<organization>
|
159
|
+
<name>International Electrotechnical Commission</name>
|
160
|
+
<abbreviation>IEC</abbreviation>
|
161
|
+
</organization>
|
162
|
+
</contributor>
|
163
|
+
<language current="true">en</language>
|
164
|
+
<script current="true">Latn</script>
|
165
|
+
<status>
|
166
|
+
<stage language="">60</stage>
|
167
|
+
<substage language="">60</substage>
|
168
|
+
</status>
|
169
|
+
<copyright>
|
170
|
+
<from>2020</from>
|
171
|
+
<owner>
|
172
|
+
<organization>
|
173
|
+
<name>International Electrotechnical Commission</name>
|
174
|
+
<abbreviation>IEC</abbreviation>
|
175
|
+
</organization>
|
176
|
+
</owner>
|
177
|
+
</copyright>
|
178
|
+
<ext>
|
179
|
+
<doctype language="">article</doctype>
|
180
|
+
<editorialgroup>
|
181
|
+
<technical-committee/>
|
182
|
+
<subcommittee/>
|
183
|
+
<workgroup/>
|
184
|
+
</editorialgroup>
|
185
|
+
<structuredidentifier>
|
186
|
+
<project-number>IEC 60050</project-number>
|
187
|
+
</structuredidentifier>
|
188
|
+
</ext>
|
189
|
+
</bibdata>
|
190
|
+
<sections> </sections>
|
191
|
+
<bibliography>
|
192
|
+
<references obligation='informative' normative='true' id="X" displayorder="1">
|
193
|
+
<title depth='1'>1<tab/>Normative References</title>
|
194
|
+
<p id='_'>There are no normative references in this document.</p>
|
195
|
+
<bibitem id='A'>
|
196
|
+
<formattedref format='application/x-isodoc+xml'>
|
197
|
+
<em>TITLE</em>
|
198
|
+
</formattedref>
|
199
|
+
<docidentifier>B</docidentifier>
|
200
|
+
</bibitem>
|
201
|
+
</references>
|
202
|
+
<references id='_' obligation='informative' normative='false' displayorder="2">
|
203
|
+
<title depth='1'>Bibliography</title>
|
204
|
+
<p id='_'>There are no normative references in this document.</p>
|
205
|
+
<bibitem id='A'>
|
206
|
+
<formattedref format='application/x-isodoc+xml'>
|
207
|
+
<em>TITLE</em>
|
208
|
+
</formattedref>
|
209
|
+
<docidentifier>B</docidentifier>
|
210
|
+
</bibitem>
|
211
|
+
</references>
|
212
|
+
</bibliography>
|
213
|
+
</iec-standard>
|
214
|
+
OUTPUT
|
215
|
+
html = <<~OUTPUT
|
216
|
+
#{HTML_HDR}
|
217
|
+
<div id=''>
|
218
|
+
<h1 class='ForewordTitle'>FOREWORD</h1>
|
219
|
+
<div class='boilerplate_legal'/>
|
220
|
+
</div>
|
221
|
+
#{IEC_TITLE1}
|
222
|
+
<div>
|
223
|
+
<h1>1  Normative References</h1>
|
224
|
+
<p id='_'>There are no normative references in this document.</p>
|
225
|
+
</div>
|
226
|
+
</div>
|
227
|
+
</body>
|
228
|
+
</html>
|
229
|
+
OUTPUT
|
230
230
|
expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
|
231
231
|
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
232
232
|
end
|
233
233
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
<
|
246
|
-
<
|
247
|
-
<
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
<
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
<
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
</
|
265
|
-
|
266
|
-
<
|
267
|
-
<
|
268
|
-
<
|
269
|
-
<
|
270
|
-
<
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
</
|
276
|
-
<termnote id="_671a1994-4783-40d0-bc81-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
<
|
281
|
-
|
282
|
-
</
|
283
|
-
|
284
|
-
|
285
|
-
</
|
286
|
-
</
|
287
|
-
|
288
|
-
</sections>
|
289
|
-
</iso-standard>
|
290
|
-
INPUT
|
291
|
-
|
292
|
-
presxml = <<~INPUT
|
293
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
294
|
-
<bibdata type='standard'>
|
295
|
-
<docidentifier type='ISO'>IEC 60050-192 ED 1</docidentifier>
|
296
|
-
<docnumber>60050</docnumber>
|
297
|
-
</bibdata>
|
298
|
-
<sections>
|
299
|
-
<clause id="_terms_and_definitions" obligation="normative"><title depth="1">1<tab/>Terms and definitions</title>
|
300
|
-
<terms id="_general" obligation="normative"><title>192-01 General</title>
|
301
|
-
|
302
|
-
<term id="paddy1">
|
303
|
-
<name>192-01-01</name>
|
304
|
-
<preferred>paddy</preferred>
|
305
|
-
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
306
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
307
|
-
<name>EXAMPLE 1</name>
|
308
|
-
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
309
|
-
<ul>
|
310
|
-
<li>A</li>
|
311
|
-
</ul>
|
312
|
-
</termexample>
|
313
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
314
|
-
<name>EXAMPLE 2</name>
|
315
|
-
<ul>
|
316
|
-
<li>A</li>
|
317
|
-
</ul>
|
318
|
-
</termexample>
|
319
|
-
|
320
|
-
<termsource status="modified">
|
321
|
-
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
322
|
-
<modification>
|
323
|
-
<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>
|
324
|
-
</modification>
|
325
|
-
</termsource></term>
|
234
|
+
it "processes IEV terms" do
|
235
|
+
input = <<~INPUT
|
236
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
237
|
+
<bibdata type='standard'>
|
238
|
+
<docidentifier type='ISO'>IEC 60050-192 ED 1</docidentifier>
|
239
|
+
<docnumber>60050</docnumber>
|
240
|
+
</bibdata>
|
241
|
+
<sections>
|
242
|
+
<clause id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title>
|
243
|
+
<terms id="_general" obligation="normative"><title>General</title>
|
244
|
+
<term id="paddy1"><preferred>paddy</preferred>
|
245
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
246
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
247
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
248
|
+
<ul>
|
249
|
+
<li>A</li>
|
250
|
+
</ul>
|
251
|
+
</termexample>
|
252
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
253
|
+
<ul>
|
254
|
+
<li>A</li>
|
255
|
+
</ul>
|
256
|
+
</termexample>
|
257
|
+
<termsource status="modified">
|
258
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
259
|
+
<modification>
|
260
|
+
<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>
|
261
|
+
</modification>
|
262
|
+
</termsource></term>
|
263
|
+
<term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
|
264
|
+
<admitted>rough rice</admitted>
|
265
|
+
<deprecates>cargo rice</deprecates>
|
266
|
+
<domain>rice</domain>
|
267
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
268
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
269
|
+
<ul>
|
270
|
+
<li>A</li>
|
271
|
+
</ul>
|
272
|
+
</termexample>
|
273
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
274
|
+
<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>
|
275
|
+
</termnote>
|
276
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
277
|
+
<ul><li>A</li></ul>
|
278
|
+
<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>
|
279
|
+
</termnote>
|
280
|
+
<termsource status="identical">
|
281
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
282
|
+
</termsource></term>
|
283
|
+
</terms>
|
284
|
+
</clause>
|
285
|
+
</sections>
|
286
|
+
</iso-standard>
|
287
|
+
INPUT
|
326
288
|
|
327
|
-
|
328
|
-
<
|
329
|
-
<
|
330
|
-
<
|
331
|
-
<
|
332
|
-
|
333
|
-
<
|
334
|
-
<
|
335
|
-
<
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
</
|
340
|
-
<
|
341
|
-
<name>
|
342
|
-
|
343
|
-
|
344
|
-
<
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
</
|
349
|
-
<
|
350
|
-
|
351
|
-
</
|
352
|
-
</
|
353
|
-
|
354
|
-
</
|
355
|
-
|
356
|
-
|
289
|
+
presxml = <<~INPUT
|
290
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
291
|
+
<bibdata type='standard'>
|
292
|
+
<docidentifier type='ISO'>IEC 60050-192 ED 1</docidentifier>
|
293
|
+
<docnumber>60050</docnumber>
|
294
|
+
</bibdata>
|
295
|
+
<sections>
|
296
|
+
<clause id="_terms_and_definitions" obligation="normative" displayorder="1"><title depth="1">1<tab/>Terms and definitions</title>
|
297
|
+
<terms id="_general" obligation="normative"><title>192-01 General</title>
|
298
|
+
<term id="paddy1">
|
299
|
+
<name>192-01-01</name>
|
300
|
+
<preferred>paddy</preferred>
|
301
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
302
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
303
|
+
<name>EXAMPLE 1</name>
|
304
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
305
|
+
<ul>
|
306
|
+
<li>A</li>
|
307
|
+
</ul>
|
308
|
+
</termexample>
|
309
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
310
|
+
<name>EXAMPLE 2</name>
|
311
|
+
<ul>
|
312
|
+
<li>A</li>
|
313
|
+
</ul>
|
314
|
+
</termexample>
|
315
|
+
<termsource status="modified">
|
316
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
317
|
+
<modification>
|
318
|
+
<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>
|
319
|
+
</modification>
|
320
|
+
</termsource></term>
|
321
|
+
<term id="paddy">
|
322
|
+
<name>192-01-02</name>
|
323
|
+
<preferred>paddy</preferred><admitted>paddy rice</admitted>
|
324
|
+
<admitted>rough rice</admitted>
|
325
|
+
<deprecates>cargo rice</deprecates>
|
326
|
+
<domain>rice</domain>
|
327
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
328
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
329
|
+
<name>EXAMPLE</name>
|
330
|
+
<ul>
|
331
|
+
<li>A</li>
|
332
|
+
</ul>
|
333
|
+
</termexample>
|
334
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
335
|
+
<name>Note 1 to entry</name>
|
336
|
+
<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>
|
337
|
+
</termnote>
|
338
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
339
|
+
<name>Note 2 to entry</name>
|
340
|
+
<ul><li>A</li></ul>
|
341
|
+
<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>
|
342
|
+
</termnote>
|
343
|
+
<termsource status="identical">
|
344
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
345
|
+
</termsource></term>
|
346
|
+
</terms>
|
347
|
+
</clause>
|
348
|
+
</sections>
|
349
|
+
</iso-standard>
|
350
|
+
INPUT
|
357
351
|
|
358
|
-
html = <<~OUTPUT
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
352
|
+
html = <<~OUTPUT
|
353
|
+
#{HTML_HDR}
|
354
|
+
<div id=''>
|
355
|
+
<h1 class='ForewordTitle'>FOREWORD</h1>
|
356
|
+
<div class='boilerplate_legal'/>
|
357
|
+
</div>
|
358
|
+
#{IEC_TITLE1}
|
359
|
+
<div id='_terms_and_definitions'>
|
360
|
+
<h1>1  Terms and definitions</h1>
|
361
|
+
<br/>
|
362
|
+
<div id='_general'>
|
363
|
+
<p class='zzSTDTitle2'>
|
364
|
+
<b>192-01 General</b>
|
365
|
+
</p>
|
366
|
+
<p class='TermNum' id='paddy1'>192-01-01</p>
|
367
|
+
<p class='Terms' style='text-align:left;'>paddy</p>
|
368
|
+
<p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
|
369
|
+
<div id='_bd57bbf1-f948-4bae-b0ce-73c00431f892' class='example'>
|
370
|
+
<p>
|
371
|
+
<span class='example_label'>EXAMPLE 1</span>
|
372
|
+
  Foreign seeds, husks, bran, sand, dust.
|
373
|
+
</p>
|
374
|
+
<ul>
|
375
|
+
<li>A</li>
|
376
|
+
</ul>
|
377
|
+
</div>
|
378
|
+
<div id='_bd57bbf1-f948-4bae-b0ce-73c00431f894' class='example'>
|
379
|
+
<p>
|
380
|
+
<span class='example_label'>EXAMPLE 2</span>
|
381
|
+
 
|
382
|
+
</p>
|
383
|
+
<ul>
|
384
|
+
<li>A</li>
|
385
|
+
</ul>
|
386
|
+
</div>
|
387
|
+
<p>
|
388
|
+
[TERMREF]
|
389
|
+
<a href='#ISO7301'>ISO 7301:2011, 3.1</a>
|
390
|
+
[MODIFICATION]The term "cargo rice" is shown as deprecated, and
|
391
|
+
Note 1 to entry is not included here [/TERMREF]
|
392
|
+
</p>
|
393
|
+
<p class='TermNum' id='paddy'>192-01-02</p>
|
394
|
+
<p class='Terms' style='text-align:left;'>paddy, <rice></p>
|
395
|
+
<p class='AltTerms' style='text-align:left;'>paddy rice, <rice></p>
|
396
|
+
<p class='AltTerms' style='text-align:left;'>rough rice, <rice></p>
|
397
|
+
<p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: cargo rice, <rice></p>
|
398
|
+
<p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
|
399
|
+
<div id='_bd57bbf1-f948-4bae-b0ce-73c00431f893' class='example'>
|
400
|
+
<p>
|
401
|
+
<span class='example_label'>EXAMPLE</span>
|
402
|
+
 
|
403
|
+
</p>
|
404
|
+
<ul>
|
405
|
+
<li>A</li>
|
406
|
+
</ul>
|
407
|
+
</div>
|
408
|
+
<div class='Note' id='_671a1994-4783-40d0-bc81-987d06ffb74e'>
|
409
|
+
<p>
|
410
|
+
Note 1 to entry: The starch of waxy rice consists almost entirely
|
411
|
+
of amylopectin. The kernels have a tendency to stick together
|
412
|
+
after cooking.
|
413
|
+
</p>
|
414
|
+
</div>
|
415
|
+
<div class='Note' id='_671a1994-4783-40d0-bc81-987d06ffb74f'>
|
416
|
+
<p>
|
417
|
+
Note 2 to entry:
|
418
|
+
<ul>
|
419
|
+
<li>A</li>
|
420
|
+
</ul>
|
421
|
+
<p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
|
422
|
+
The starch of waxy rice consists almost entirely of amylopectin.
|
423
|
+
The kernels have a tendency to stick together after cooking.
|
424
|
+
</p>
|
425
|
+
</p>
|
426
|
+
</div>
|
427
|
+
<p>
|
428
|
+
[TERMREF]
|
429
|
+
<a href='#ISO7301'>ISO 7301:2011, 3.1</a>
|
430
|
+
[/TERMREF]
|
431
|
+
</p>
|
432
|
+
</div>
|
433
|
+
</div>
|
432
434
|
</div>
|
433
|
-
|
434
|
-
|
435
|
-
<a href='#ISO7301'>ISO 7301:2011, 3.1</a>
|
436
|
-
[/TERMREF]
|
437
|
-
</p>
|
438
|
-
</div>
|
439
|
-
</div>
|
440
|
-
</div>
|
441
|
-
</body>
|
442
|
-
</html>
|
435
|
+
</body>
|
436
|
+
</html>
|
443
437
|
OUTPUT
|
444
438
|
expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
|
445
439
|
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
446
|
-
end
|
440
|
+
end
|
447
441
|
|
448
|
-
|
442
|
+
it "populates Word template with terms reference labels" do
|
449
443
|
FileUtils.rm_f "test.doc"
|
450
444
|
FileUtils.rm_f "test.html"
|
451
445
|
input = <<~INPUT
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
<
|
462
|
-
<
|
463
|
-
<
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
</
|
469
|
-
|
470
|
-
</
|
471
|
-
</
|
472
|
-
</sections>
|
473
|
-
</iso-standard>
|
446
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
447
|
+
<bibdata type='standard'>
|
448
|
+
<docidentifier type='ISO'>IEC 60050-192 ED 1</docidentifier>
|
449
|
+
<docnumber>60050</docnumber>
|
450
|
+
</bibdata>
|
451
|
+
<sections>
|
452
|
+
<clause id="_terms_and_definitions" obligation="normative" displayorder="1"><title>Terms and definitions</title>
|
453
|
+
<terms id="_general" obligation="normative"><title>General</title>
|
454
|
+
<term id="paddy1"><preferred>paddy</preferred>
|
455
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
456
|
+
<termsource status="modified">
|
457
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
458
|
+
<modification>
|
459
|
+
<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>
|
460
|
+
</modification>
|
461
|
+
</termsource></term>
|
462
|
+
</terms>
|
463
|
+
</clause>
|
464
|
+
</sections>
|
465
|
+
</iso-standard>
|
474
466
|
INPUT
|
475
467
|
presxml = <<~OUTPUT
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
</iso-standard>
|
511
|
-
OUTPUT
|
468
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
469
|
+
<bibdata type='standard'>
|
470
|
+
<docidentifier type='ISO'>IEC 60050-192 ED 1</docidentifier>
|
471
|
+
<docnumber>60050</docnumber>
|
472
|
+
</bibdata>
|
473
|
+
<sections>
|
474
|
+
<clause id='_terms_and_definitions' obligation='normative' displayorder="1">
|
475
|
+
<title depth='1'>1<tab/>Terms and definitions</title>
|
476
|
+
<terms id='_general' obligation='normative'>
|
477
|
+
<title>192-01 General</title>
|
478
|
+
<term id='paddy1'>
|
479
|
+
<name>192-01-01</name>
|
480
|
+
<preferred>paddy</preferred>
|
481
|
+
<definition>
|
482
|
+
<p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
|
483
|
+
</definition>
|
484
|
+
<termsource status='modified'>
|
485
|
+
<origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'>
|
486
|
+
<locality type='clause'>
|
487
|
+
<referenceFrom>3.1</referenceFrom>
|
488
|
+
</locality>
|
489
|
+
ISO 7301:2011, 3.1
|
490
|
+
</origin>
|
491
|
+
<modification>
|
492
|
+
<p id='_e73a417d-ad39-417d-a4c8-20e4e2529489'>
|
493
|
+
The term "cargo rice" is shown as deprecated, and Note 1 to
|
494
|
+
entry is not included here
|
495
|
+
</p>
|
496
|
+
</modification>
|
497
|
+
</termsource>
|
498
|
+
</term>
|
499
|
+
</terms>
|
500
|
+
</clause>
|
501
|
+
</sections>
|
502
|
+
</iso-standard>
|
503
|
+
OUTPUT
|
512
504
|
expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
|
513
505
|
IsoDoc::Iec::WordConvert.new({}).convert("test", presxml, false)
|
514
|
-
word = File.read("test.doc").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
515
|
-
sub(%r{<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>.*$}m, "")
|
506
|
+
word = File.read("test.doc").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
507
|
+
.sub(%r{<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>.*$}m, "")
|
516
508
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
</p>
|
521
|
-
<p class='zzSTDTitle1'> </p>
|
522
|
-
<div>
|
523
|
-
<a name='_terms_and_definitions' id='_terms_and_definitions'/>
|
524
|
-
<h1 class='main'>
|
525
|
-
1
|
526
|
-
<span style='mso-tab-count:1'>  </span>
|
527
|
-
Terms and definitions
|
528
|
-
</h1>
|
529
|
-
<p class='MsoNormal'>
|
530
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
509
|
+
<div class='WordSection3'>
|
510
|
+
<p class='zzSTDTitle1'>
|
511
|
+
<b/>
|
531
512
|
</p>
|
513
|
+
<p class='zzSTDTitle1'> </p>
|
532
514
|
<div>
|
533
|
-
<a name='
|
534
|
-
<
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
192-01-01
|
540
|
-
</p>
|
541
|
-
<p class='Terms' style='text-align:left;'>paddy</p>
|
542
|
-
<p class='MsoNormal'>
|
543
|
-
<a name='_eb29b35e-123e-4d1c-b50b-2714d41e747f' id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'/>
|
544
|
-
rice retaining its husk after threshing
|
545
|
-
</p>
|
515
|
+
<a name='_terms_and_definitions' id='_terms_and_definitions'/>
|
516
|
+
<h1 class='main'>
|
517
|
+
1
|
518
|
+
<span style='mso-tab-count:1'>  </span>
|
519
|
+
Terms and definitions
|
520
|
+
</h1>
|
546
521
|
<p class='MsoNormal'>
|
547
|
-
|
548
|
-
<a href='#ISO7301'>ISO 7301:2011, 3.1</a>
|
549
|
-
, modified — The term "cargo rice" is shown as deprecated, and
|
550
|
-
Note 1 to entry is not included here
|
522
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
551
523
|
</p>
|
524
|
+
<div>
|
525
|
+
<a name='_general' id='_general'/>
|
526
|
+
<p class='zzSTDTitle2'>
|
527
|
+
<b>192-01 General</b>
|
528
|
+
</p>
|
529
|
+
<p class='TermNum'>
|
530
|
+
<a name='paddy1' id='paddy1'/>
|
531
|
+
192-01-01
|
532
|
+
</p>
|
533
|
+
<p class='Terms' style='text-align:left;'>paddy</p>
|
534
|
+
<p class='MsoNormal'>
|
535
|
+
<a name='_eb29b35e-123e-4d1c-b50b-2714d41e747f' id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'/>
|
536
|
+
rice retaining its husk after threshing
|
537
|
+
</p>
|
538
|
+
<p class='MsoNormal'>
|
539
|
+
SOURCE:
|
540
|
+
<a href='#ISO7301'>ISO 7301:2011, 3.1</a>
|
541
|
+
, modified — The term "cargo rice" is shown as deprecated, and
|
542
|
+
Note 1 to entry is not included here
|
543
|
+
</p>
|
544
|
+
</div>
|
552
545
|
</div>
|
553
546
|
</div>
|
554
|
-
</div>
|
555
547
|
OUTPUT
|
556
548
|
end
|
557
|
-
|
558
|
-
|
559
549
|
end
|
560
|
-
|