metanorma-iec 1.0.3 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -7
  3. data/.github/workflows/ubuntu.yml +12 -9
  4. data/.github/workflows/windows.yml +8 -8
  5. data/lib/asciidoctor/iec/biblio.rng +142 -37
  6. data/lib/asciidoctor/iec/converter.rb +22 -130
  7. data/lib/asciidoctor/iec/front.rb +220 -0
  8. data/lib/asciidoctor/iec/isodoc.rng +48 -2
  9. data/lib/asciidoctor/iec/isostandard.rng +17 -1
  10. data/lib/isodoc/iec/base_convert.rb +157 -0
  11. data/lib/isodoc/iec/html/htmlstyle.scss +11 -8
  12. data/lib/isodoc/iec/html/isodoc.scss +15 -9
  13. data/lib/isodoc/iec/html/scripts.html +23 -21
  14. data/lib/isodoc/iec/html/wordstyle.scss +0 -3
  15. data/lib/isodoc/iec/html_convert.rb +8 -0
  16. data/lib/isodoc/iec/i18n-en.yaml +2 -0
  17. data/lib/isodoc/iec/i18n-fr.yaml +2 -0
  18. data/lib/isodoc/iec/iec.international-standard.xsl +4133 -0
  19. data/lib/isodoc/iec/metadata.rb +3 -52
  20. data/lib/isodoc/iec/pdf_convert.rb +31 -0
  21. data/lib/isodoc/iec/word_convert.rb +17 -6
  22. data/lib/metanorma-iec.rb +1 -0
  23. data/lib/metanorma/iec/processor.rb +12 -1
  24. data/lib/metanorma/iec/version.rb +1 -1
  25. data/spec/asciidoctor-iec/base_spec.rb +20 -29
  26. data/spec/asciidoctor-iec/blocks_spec.rb +15 -7
  27. data/spec/asciidoctor-iec/cleanup_spec.rb +13 -7
  28. data/spec/asciidoctor-iec/iev_spec.rb +161 -0
  29. data/spec/asciidoctor-iec/inline_spec.rb +2 -1
  30. data/spec/asciidoctor-iec/section_spec.rb +8 -8
  31. data/spec/assets/iso.xml +65 -2
  32. data/spec/examples/rice.html +5 -5
  33. data/spec/examples/rice_img/rice_image1.png +0 -0
  34. data/spec/examples/rice_img/rice_image2.png +0 -0
  35. data/spec/examples/rice_img/rice_image3_1.png +0 -0
  36. data/spec/examples/rice_img/rice_image3_2.png +0 -0
  37. data/spec/examples/rice_img/rice_image3_3.png +0 -0
  38. data/spec/isodoc/blocks_spec.rb +160 -0
  39. data/spec/isodoc/i18n_spec.rb +15 -22
  40. data/spec/isodoc/iev_spec.rb +360 -0
  41. data/spec/isodoc/inline_spec.rb +2 -2
  42. data/spec/isodoc/iso_spec.rb +2 -19
  43. data/spec/isodoc/metadata_spec.rb +92 -9
  44. data/spec/isodoc/postproc_spec.rb +8 -2
  45. data/spec/isodoc/ref_spec.rb +249 -0
  46. data/spec/isodoc/section_spec.rb +49 -14
  47. data/spec/isodoc/terms_spec.rb +2 -2
  48. data/spec/metanorma/processor_spec.rb +3 -3
  49. data/spec/spec_helper.rb +3 -2
  50. metadata +14 -2
@@ -5,6 +5,7 @@ RSpec.describe IsoDoc do
5
5
  expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <bibdata>
8
+ <docnumber>1</docnumber>
8
9
  <language>en</language>
9
10
  </bibdata>
10
11
  <preface>
@@ -15,16 +16,14 @@ RSpec.describe IsoDoc do
15
16
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
16
17
  <title>Introduction Subsection</title>
17
18
  </clause>
18
- <patent-notice>
19
19
  <p>This is patent boilerplate</p>
20
- </patent-notice>
21
20
  </introduction></preface><sections>
22
21
  <clause id="D" obligation="normative">
23
22
  <title>Scope</title>
24
23
  <p id="E">Text</p>
25
24
  </clause>
26
25
 
27
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
26
+ <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
28
27
  <title>Normal Terms</title>
29
28
  <term id="J">
30
29
  <preferred>Term2</preferred>
@@ -61,11 +60,11 @@ RSpec.describe IsoDoc do
61
60
  <appendix id="Q2" inline-header="false" obligation="normative">
62
61
  <title>An Appendix</title>
63
62
  </appendix>
64
- </annex><bibliography><references id="R" obligation="informative">
63
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
65
64
  <title>Normative References</title>
66
65
  </references><clause id="S" obligation="informative">
67
66
  <title>Bibliography</title>
68
- <references id="T" obligation="informative">
67
+ <references id="T" obligation="informative" normative="false">
69
68
  <title>Bibliography Subsection</title>
70
69
  </references>
71
70
  </clause>
@@ -161,16 +160,14 @@ RSpec.describe IsoDoc do
161
160
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
162
161
  <title>Introduction Subsection</title>
163
162
  </clause>
164
- <patent-notice>
165
163
  <p>This is patent boilerplate</p>
166
- </patent-notice>
167
164
  </introduction></preface><sections>
168
165
  <clause id="D" obligation="normative">
169
166
  <title>Scope</title>
170
167
  <p id="E">Text</p>
171
168
  </clause>
172
169
 
173
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
170
+ <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
174
171
  <title>Normal Terms</title>
175
172
  <term id="J">
176
173
  <preferred>Term2</preferred>
@@ -207,11 +204,11 @@ RSpec.describe IsoDoc do
207
204
  <appendix id="Q2" inline-header="false" obligation="normative">
208
205
  <title>An Appendix</title>
209
206
  </appendix>
210
- </annex><bibliography><references id="R" obligation="informative">
207
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
211
208
  <title>Normative References</title>
212
209
  </references><clause id="S" obligation="informative">
213
210
  <title>Bibliography</title>
214
- <references id="T" obligation="informative">
211
+ <references id="T" obligation="informative" normative="false">
215
212
  <title>Bibliography Subsection</title>
216
213
  </references>
217
214
  </clause>
@@ -307,16 +304,14 @@ RSpec.describe IsoDoc do
307
304
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
308
305
  <title>Introduction Subsection</title>
309
306
  </clause>
310
- <patent-notice>
311
307
  <p>This is patent boilerplate</p>
312
- </patent-notice>
313
308
  </introduction></preface><sections>
314
309
  <clause id="D" obligation="normative">
315
310
  <title>Scope</title>
316
311
  <p id="E">Text</p>
317
312
  </clause>
318
313
 
319
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
314
+ <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
320
315
  <title>Normal Terms</title>
321
316
  <term id="J">
322
317
  <preferred>Term2</preferred>
@@ -353,11 +348,11 @@ RSpec.describe IsoDoc do
353
348
  <appendix id="Q2" inline-header="false" obligation="normative">
354
349
  <title>An Appendix</title>
355
350
  </appendix>
356
- </annex><bibliography><references id="R" obligation="informative">
351
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
357
352
  <title>Normative References</title>
358
353
  </references><clause id="S" obligation="informative">
359
354
  <title>Bibliography</title>
360
- <references id="T" obligation="informative">
355
+ <references id="T" obligation="informative" normative="false">
361
356
  <title>Bibliography Subsection</title>
362
357
  </references>
363
358
  </clause>
@@ -455,16 +450,14 @@ RSpec.describe IsoDoc do
455
450
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
456
451
  <title>Introduction Subsection</title>
457
452
  </clause>
458
- <patent-notice>
459
453
  <p>This is patent boilerplate</p>
460
- </patent-notice>
461
454
  </introduction></preface><sections>
462
455
  <clause id="D" obligation="normative">
463
456
  <title>Scope</title>
464
457
  <p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
465
458
  </clause>
466
459
 
467
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
460
+ <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
468
461
  <title>Normal Terms</title>
469
462
  <term id="J">
470
463
  <preferred>Term2</preferred>
@@ -501,7 +494,7 @@ RSpec.describe IsoDoc do
501
494
  <appendix id="Q2" inline-header="false" obligation="normative">
502
495
  <title>An Appendix</title>
503
496
  </appendix>
504
- </annex><bibliography><references id="R" obligation="informative">
497
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
505
498
  <title>Normative References</title>
506
499
  <bibitem id="ISO712" type="standard">
507
500
  <title format="text/plain">Cereals and cereal products</title>
@@ -515,14 +508,14 @@ RSpec.describe IsoDoc do
515
508
  </bibitem>
516
509
  </references><clause id="S" obligation="informative">
517
510
  <title>Bibliography</title>
518
- <references id="T" obligation="informative">
511
+ <references id="T" obligation="informative" normative="false">
519
512
  <title>Bibliography Subsection</title>
520
513
  </references>
521
514
  </clause>
522
515
  </bibliography>
523
516
  </iso-standard>
524
517
  INPUT
525
- #{HTML_HDR.gsub(/"en"/, '"zh"').sub(/INTERNATIONAL ELECTROTECHNICAL COMMISSION/, "国际电工委员会")}
518
+ #{HTML_HDR.gsub(/"en"/, '"zh"').sub(/INTERNATIONAL ELECTROTECHNICAL COMMISSION/, "&#22269;&#38469;&#30005;&#24037;&#22996;&#21592;&#20250;")}
526
519
  <div>
527
520
  <h1 class="ForewordTitle">&#21069;&#35328;</h1>
528
521
  <div class="boilerplate_legal"/>
@@ -536,7 +529,7 @@ RSpec.describe IsoDoc do
536
529
  </div>
537
530
  <p>This is patent boilerplate</p>
538
531
  </div>
539
- #{IEC_TITLE.sub(/INTERNATIONAL ELECTROTECHNICAL COMMISSION/, "国际电工委员会")}
532
+ #{IEC_TITLE.sub(/INTERNATIONAL ELECTROTECHNICAL COMMISSION/, "&#22269;&#38469;&#30005;&#24037;&#22996;&#21592;&#20250;")}
540
533
  <div id="D">
541
534
  <h1>1&#160; &#33539;&#22260;</h1>
542
535
  <p id="E">
@@ -0,0 +1,360 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "processes introductions under IEV" do
5
+ expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
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
+ #{HTML_HDR}
24
+ <div>
25
+ <h1 class='ForewordTitle'>FOREWORD</h1>
26
+ <div class='boilerplate_legal'/>
27
+ <p id='A'>This is a preamble</p>
28
+ </div>
29
+ <br/>
30
+ <div class='Section3' id='B'>
31
+ <h1 class='IntroTitle'>
32
+ INTRODUCTION
33
+ <br/>
34
+ Principles and rules followed
35
+ </h1>
36
+ <div id='C'>
37
+ <h2>Introduction Subsection</h2>
38
+ </div>
39
+ </div>
40
+ #{IEC_TITLE}
41
+ </div>
42
+ </body>
43
+ </html>
44
+ OUTPUT
45
+ end
46
+
47
+ it "processes bibliographies under IEV" do
48
+ expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
49
+ <iec-standard xmlns='https://www.metanorma.org/ns/iec'>
50
+ <bibdata type='standard'>
51
+ <docidentifier type='iso'>IEC 60050 ED 1</docidentifier>
52
+ <docnumber>60050</docnumber>
53
+ <contributor>
54
+ <role type='author'/>
55
+ <organization>
56
+ <name>International Electrotechnical Commission</name>
57
+ <abbreviation>IEC</abbreviation>
58
+ </organization>
59
+ </contributor>
60
+ <contributor>
61
+ <role type='publisher'/>
62
+ <organization>
63
+ <name>International Electrotechnical Commission</name>
64
+ <abbreviation>IEC</abbreviation>
65
+ </organization>
66
+ </contributor>
67
+ <language>en</language>
68
+ <script>Latn</script>
69
+ <status>
70
+ <stage>60</stage>
71
+ <substage>60</substage>
72
+ </status>
73
+ <copyright>
74
+ <from>2020</from>
75
+ <owner>
76
+ <organization>
77
+ <name>International Electrotechnical Commission</name>
78
+ <abbreviation>IEC</abbreviation>
79
+ </organization>
80
+ </owner>
81
+ </copyright>
82
+ <ext>
83
+ <doctype>article</doctype>
84
+ <editorialgroup>
85
+ <technical-committee/>
86
+ <subcommittee/>
87
+ <workgroup/>
88
+ </editorialgroup>
89
+ <structuredidentifier>
90
+ <project-number>IEC 60050</project-number>
91
+ </structuredidentifier>
92
+ </ext>
93
+ </bibdata>
94
+ <sections> </sections>
95
+ <bibliography>
96
+ <references id='_' obligation='informative' normative="true">
97
+ <title>Normative References</title>
98
+ <p id='_'>There are no normative references in this document.</p>
99
+ <bibitem id='A'>
100
+ <formattedref format='application/x-isodoc+xml'>
101
+ <em>TITLE</em>
102
+ </formattedref>
103
+ <docidentifier>B</docidentifier>
104
+ </bibitem>
105
+ </references>
106
+ <references id='_' obligation='informative' normative="false">
107
+ <title>Bibliography</title>
108
+ <p id='_'>There are no normative references in this document.</p>
109
+ <bibitem id='A'>
110
+ <formattedref format='application/x-isodoc+xml'>
111
+ <em>TITLE</em>
112
+ </formattedref>
113
+ <docidentifier>B</docidentifier>
114
+ </bibitem>
115
+ </references>
116
+
117
+ </bibliography>
118
+ </iec-standard>
119
+ INPUT
120
+ #{HTML_HDR}
121
+ <div id=''>
122
+ <h1 class='ForewordTitle'>FOREWORD</h1>
123
+ <div class='boilerplate_legal'/>
124
+ </div>
125
+ #{IEC_TITLE}
126
+ <div>
127
+ <h1>1&#160; Normative references</h1>
128
+ <p id='_'>There are no normative references in this document.</p>
129
+ <p id='A' class='NormRef'>
130
+ B,
131
+ <i>TITLE</i>
132
+ </p>
133
+ </div>
134
+ </div>
135
+ </body>
136
+ </html>
137
+ OUTPUT
138
+ end
139
+
140
+ it "processes IEV terms" do
141
+ expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
142
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
143
+ <bibdata type='standard'>
144
+ <docidentifier type='iso'>IEC 60050-192 ED 1</docidentifier>
145
+ <docnumber>60050</docnumber>
146
+ </bibdata>
147
+ <sections>
148
+ <clause id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title>
149
+ <terms id="_general" obligation="normative"><title>General</title>
150
+
151
+ <term id="paddy1"><preferred>paddy</preferred>
152
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
153
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
154
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
155
+ <ul>
156
+ <li>A</li>
157
+ </ul>
158
+ </termexample>
159
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
160
+ <ul>
161
+ <li>A</li>
162
+ </ul>
163
+ </termexample>
164
+
165
+ <termsource status="modified">
166
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
167
+ <modification>
168
+ <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>
169
+ </modification>
170
+ </termsource></term>
171
+
172
+ <term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
173
+ <admitted>rough rice</admitted>
174
+ <deprecates>cargo rice</deprecates>
175
+ <domain>rice</domain>
176
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
177
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
178
+ <ul>
179
+ <li>A</li>
180
+ </ul>
181
+ </termexample>
182
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
183
+ <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>
184
+ </termnote>
185
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
186
+ <ul><li>A</li></ul>
187
+ <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>
188
+ </termnote>
189
+ <termsource status="identical">
190
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
191
+ </termsource></term>
192
+ </terms>
193
+ </sections>
194
+ </iso-standard>
195
+ INPUT
196
+ #{HTML_HDR}
197
+ <div id=''>
198
+ <h1 class='ForewordTitle'>FOREWORD</h1>
199
+ <div class='boilerplate_legal'/>
200
+ </div>
201
+ #{IEC_TITLE}
202
+ <div id='_terms_and_definitions'>
203
+ <h1>1&#160; Terms and definitions</h1>
204
+ <br/>
205
+ <div id='_general'>
206
+ <p class='zzSTDTitle2'>
207
+ <b>192-01 General</b>
208
+ </p>
209
+ <p class='TermNum' id='paddy1'>192-01-01</p>
210
+ <p class='Terms' style='text-align:left;'>paddy</p>
211
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
212
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f892' class='example'>
213
+ <p>
214
+ <span class='example_label'>EXAMPLE 1</span>
215
+ &#160; Foreign seeds, husks, bran, sand, dust.
216
+ </p>
217
+ <ul>
218
+ <li>A</li>
219
+ </ul>
220
+ </div>
221
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f894' class='example'>
222
+ <p>
223
+ <span class='example_label'>EXAMPLE 2</span>
224
+ &#160;
225
+ </p>
226
+ <ul>
227
+ <li>A</li>
228
+ </ul>
229
+ </div>
230
+ <p>
231
+ [TERMREF]
232
+ <a href='#ISO7301'>ISO 7301:2011, 3.1</a>
233
+ [MODIFICATION]The term "cargo rice" is shown as deprecated, and
234
+ Note 1 to entry is not included here [/TERMREF]
235
+ </p>
236
+ <p class='TermNum' id='paddy'>192-01-02</p>
237
+ <p class='Terms' style='text-align:left;'>paddy, &lt;rice&gt;</p>
238
+ <p class='AltTerms' style='text-align:left;'>paddy rice, &lt;rice&gt;</p>
239
+ <p class='AltTerms' style='text-align:left;'>rough rice, &lt;rice&gt;</p>
240
+ <p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: cargo rice, &lt;rice&gt;</p>
241
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
242
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f893' class='example'>
243
+ <p>
244
+ <span class='example_label'>EXAMPLE</span>
245
+ &#160;
246
+ </p>
247
+ <ul>
248
+ <li>A</li>
249
+ </ul>
250
+ </div>
251
+ <div class='Note'>
252
+ <p>
253
+ Note 1 to entry: The starch of waxy rice consists almost entirely
254
+ of amylopectin. The kernels have a tendency to stick together
255
+ after cooking.
256
+ </p>
257
+ </div>
258
+ <div class='Note'>
259
+ <p>
260
+ Note 2 to entry:
261
+ <ul>
262
+ <li>A</li>
263
+ </ul>
264
+ <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
265
+ The starch of waxy rice consists almost entirely of amylopectin.
266
+ The kernels have a tendency to stick together after cooking.
267
+ </p>
268
+ </p>
269
+ </div>
270
+ <p>
271
+ [TERMREF]
272
+ <a href='#ISO7301'>ISO 7301:2011, 3.1</a>
273
+ [/TERMREF]
274
+ </p>
275
+ </div>
276
+ </div>
277
+ </div>
278
+ </body>
279
+ </html>
280
+ OUTPUT
281
+ end
282
+
283
+ it "populates Word template with terms reference labels" do
284
+ FileUtils.rm_f "test.doc"
285
+ FileUtils.rm_f "test.html"
286
+ IsoDoc::Iec::WordConvert.new({}).convert("test", <<~"INPUT", false)
287
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
288
+ <bibdata type='standard'>
289
+ <docidentifier type='iso'>IEC 60050-192 ED 1</docidentifier>
290
+ <docnumber>60050</docnumber>
291
+ </bibdata>
292
+ <sections>
293
+ <clause id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title>
294
+ <terms id="_general" obligation="normative"><title>General</title>
295
+
296
+ <term id="paddy1"><preferred>paddy</preferred>
297
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
298
+ <termsource status="modified">
299
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
300
+ <modification>
301
+ <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>
302
+ </modification>
303
+ </termsource></term>
304
+
305
+ </terms>
306
+ </clause>
307
+ </sections>
308
+ </iso-standard>
309
+
310
+ INPUT
311
+ word = File.read("test.doc").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
312
+ sub(%r{<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>.*$}m, "")
313
+ expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
314
+ <div class='WordSection3'>
315
+ <p class='zzSTDTitle1'>INTERNATIONAL ELECTROTECHNICAL COMMISSION</p>
316
+ <p class='zzSTDTitle1'>____________</p>
317
+ <p class='zzSTDTitle1'>&#xA0;</p>
318
+ <p class='zzSTDTitle1'>
319
+ <b/>
320
+ </p>
321
+ <p class='zzSTDTitle1'>&#xA0;</p>
322
+ <div>
323
+ <a name='_terms_and_definitions' id='_terms_and_definitions'/>
324
+ <h1 class='main'>
325
+ 1
326
+ <span style='mso-tab-count:1'>&#xA0; </span>
327
+ Terms and definitions
328
+ </h1>
329
+ <p class='MsoNormal'>
330
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
331
+ </p>
332
+ <div>
333
+ <a name='_general' id='_general'/>
334
+ <p class='zzSTDTitle2'>
335
+ <b>192-01 General</b>
336
+ </p>
337
+ <p class='TermNum'>
338
+ <a name='paddy1' id='paddy1'/>
339
+ 192-01-01
340
+ </p>
341
+ <p class='Terms' style='text-align:left;'>paddy</p>
342
+ <p class='MsoNormal'>
343
+ <a name='_eb29b35e-123e-4d1c-b50b-2714d41e747f' id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'/>
344
+ rice retaining its husk after threshing
345
+ </p>
346
+ <p class='MsoNormal'>
347
+ SOURCE:
348
+ <a href='#ISO7301'>ISO 7301:2011, 3.1</a>
349
+ , modified &#x2014; The term "cargo rice" is shown as deprecated, and
350
+ Note 1 to entry is not included here
351
+ </p>
352
+ </div>
353
+ </div>
354
+ </div>
355
+ OUTPUT
356
+ end
357
+
358
+
359
+ end
360
+