metanorma-iec 1.0.2 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +10 -10
  3. data/.github/workflows/ubuntu.yml +25 -11
  4. data/.github/workflows/windows.yml +11 -12
  5. data/README.adoc +3 -2
  6. data/lib/asciidoctor/iec/biblio.rng +131 -46
  7. data/lib/asciidoctor/iec/converter.rb +19 -130
  8. data/lib/asciidoctor/iec/front.rb +220 -0
  9. data/lib/asciidoctor/iec/isodoc.rng +32 -4
  10. data/lib/asciidoctor/iec/isostandard.rng +10 -0
  11. data/lib/isodoc/iec/base_convert.rb +118 -0
  12. data/lib/isodoc/iec/html/htmlstyle.scss +11 -8
  13. data/lib/isodoc/iec/html/scripts.html +23 -21
  14. data/lib/isodoc/iec/html_convert.rb +8 -0
  15. data/lib/isodoc/iec/i18n-en.yaml +2 -0
  16. data/lib/isodoc/iec/i18n-fr.yaml +2 -0
  17. data/lib/isodoc/iec/iec.international-standard.xsl +3969 -0
  18. data/lib/isodoc/iec/metadata.rb +3 -52
  19. data/lib/isodoc/iec/pdf_convert.rb +31 -0
  20. data/lib/metanorma-iec.rb +1 -0
  21. data/lib/metanorma/iec/processor.rb +12 -1
  22. data/lib/metanorma/iec/version.rb +1 -1
  23. data/spec/asciidoctor-iec/base_spec.rb +17 -27
  24. data/spec/asciidoctor-iec/blocks_spec.rb +15 -7
  25. data/spec/asciidoctor-iec/cleanup_spec.rb +13 -7
  26. data/spec/asciidoctor-iec/iev_spec.rb +161 -0
  27. data/spec/asciidoctor-iec/inline_spec.rb +2 -1
  28. data/spec/asciidoctor-iec/section_spec.rb +8 -8
  29. data/spec/assets/iso.xml +65 -2
  30. data/spec/examples/rice.html +5 -5
  31. data/spec/examples/rice_img/rice_image1.png +0 -0
  32. data/spec/examples/rice_img/rice_image2.png +0 -0
  33. data/spec/examples/rice_img/rice_image3_1.png +0 -0
  34. data/spec/examples/rice_img/rice_image3_2.png +0 -0
  35. data/spec/examples/rice_img/rice_image3_3.png +0 -0
  36. data/spec/isodoc/i18n_spec.rb +15 -22
  37. data/spec/isodoc/iev_spec.rb +356 -0
  38. data/spec/isodoc/inline_spec.rb +2 -2
  39. data/spec/isodoc/iso_spec.rb +2 -19
  40. data/spec/isodoc/metadata_spec.rb +12 -7
  41. data/spec/isodoc/postproc_spec.rb +9 -3
  42. data/spec/isodoc/section_spec.rb +11 -13
  43. data/spec/isodoc/terms_spec.rb +2 -2
  44. data/spec/metanorma/processor_spec.rb +3 -3
  45. data/spec/spec_helper.rb +3 -2
  46. metadata +12 -2
@@ -127,7 +127,7 @@ RSpec.describe Asciidoctor::Iec do
127
127
  #{BLANK_HDR}
128
128
  <sections>
129
129
 
130
- </sections><bibliography><references id="_" obligation="informative">
130
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
131
131
  <title>Normative References</title>
132
132
  <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
133
133
  <bibitem id="ISO712">
@@ -137,6 +137,7 @@ RSpec.describe Asciidoctor::Iec do
137
137
  <bibitem id="ISO713">
138
138
  <formattedref format="application/x-isodoc+xml">Reference</formattedref>
139
139
  <docidentifier>ISO713</docidentifier>
140
+ <docnumber>713</docnumber>
140
141
  </bibitem>
141
142
  </references>
142
143
  </bibliography>
@@ -69,7 +69,7 @@ RSpec.describe Asciidoctor::Iec do
69
69
  <title>Terms and definitions</title>
70
70
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
71
71
  #{TERMS_BOILERPLATE}
72
- <term id="_">
72
+ <term id="term-term1">
73
73
  <preferred>Term1</preferred>
74
74
  </term>
75
75
  </terms>
@@ -94,7 +94,7 @@ RSpec.describe Asciidoctor::Iec do
94
94
  </p>
95
95
  </li>
96
96
  </ul>
97
- <term id="_">
97
+ <term id="term-term2">
98
98
  <preferred>Term2</preferred>
99
99
  </term>
100
100
  </terms>
@@ -118,11 +118,11 @@ RSpec.describe Asciidoctor::Iec do
118
118
  </clause>
119
119
  <appendix id="_" inline-header="false" obligation="normative">
120
120
  <title>Appendix 1</title>
121
- </appendix></annex><bibliography><references id="_" obligation="informative">
121
+ </appendix></annex><bibliography><references id="_" obligation="informative" normative="true">
122
122
  <title>Normative References</title><p id="_">There are no normative references in this document.</p>
123
123
  </references><clause id="_" obligation="informative">
124
124
  <title>Bibliography</title>
125
- <references id="_" obligation="informative">
125
+ <references id="_" obligation="informative" normative="false">
126
126
  <title>Bibliography Subsection</title>
127
127
  </references>
128
128
  </clause>
@@ -209,7 +209,7 @@ RSpec.describe Asciidoctor::Iec do
209
209
  <title>Terms and definitions</title>
210
210
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
211
211
  #{TERMS_BOILERPLATE}
212
- <term id="_">
212
+ <term id="term-term1">
213
213
  <preferred>Term1</preferred>
214
214
  </term>
215
215
  </terms>
@@ -236,7 +236,7 @@ RSpec.describe Asciidoctor::Iec do
236
236
  </p>
237
237
  </li>
238
238
  </ul>
239
- <term id='_'>
239
+ <term id='term-term2'>
240
240
  <preferred>Term2</preferred>
241
241
  </term>
242
242
  </terms>
@@ -267,13 +267,13 @@ RSpec.describe Asciidoctor::Iec do
267
267
  </appendix>
268
268
  </annex>
269
269
  <bibliography>
270
- <references id='_' obligation='informative'>
270
+ <references id='_' obligation='informative' normative="true">
271
271
  <title>Normative References</title>
272
272
  <p id="_">There are no normative references in this document.</p>
273
273
  </references>
274
274
  <clause id='_' obligation='informative'>
275
275
  <title>Bibliography</title>
276
- <references id='_' obligation='informative'>
276
+ <references id='_' obligation='informative' normative="false">
277
277
  <title>Bibliography Subsection</title>
278
278
  </references>
279
279
  </clause>
@@ -1,8 +1,71 @@
1
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1
+ <iec-standard xmlns="https://www.metanorma.org/ns/iec">
2
+ <bibdata type="standard">
3
+ <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
4
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
5
+ <title type="main" language="en" format="text/plain">Specifications and test methods</title>
6
+ <title type="title-part" language="en" format="text/plain">Rice</title>
7
+ <title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
8
+ <title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
9
+ <title type="title-part" language="fr" format="text/plain">Riz</title>
10
+ <docidentifier type="iso">ISO/PreCD3 17301-1</docidentifier>
11
+ <docidentifier type="iso-tc">17301</docidentifier>
12
+ <docnumber>1730</docnumber>
13
+ <date type="published"><on>2011</on></date>
14
+ <date type="accessed"><on>2012</on></date>
15
+ <date type="created"><from>2010</from><to>2011</to></date>
16
+ <date type="activated"><on>2013</on></date>
17
+ <date type="obsoleted"><on>2014</on></date>
18
+ <edition>2</edition>
19
+ <version>
20
+ <revision-date>2016-05-01</revision-date>
21
+ <draft>0.4</draft>
22
+ </version>
23
+ <contributor>
24
+ <role type="author"/>
25
+ <organization>
26
+ <name>International Organization for Standardization</name>
27
+ <abbreviation>ISO</abbreviation>
28
+ </organization>
29
+ </contributor>
30
+ <contributor>
31
+ <role type="publisher"/>
32
+ <organization>
33
+ <name>International Organization for Standardization</name>
34
+ <abbreviation>ISO</abbreviation>
35
+ </organization>
36
+ </contributor>
37
+ <language>en</language>
38
+ <script>Latn</script>
39
+ <status>
40
+ <stage abbreviation="CD">35</stage>
41
+ <substage abbreviation="3CD">20</substage>
42
+ <iteration>3</iteration>
43
+ </status>
44
+ <copyright>
45
+ <from>2016</from>
46
+ <owner>
47
+ <organization>
48
+ <abbreviation>ISO</abbreviation>
49
+ </organization>
50
+ </owner>
51
+ </copyright>
52
+ <ext>
53
+ <doctype>international-standard</doctype>
54
+ <editorialgroup>
55
+ <technical-committee number="34">Food products</technical-committee>
56
+ <subcommittee number="4">Cereals and pulses</subcommittee>
57
+ <workgroup number="3">Rice Group</workgroup>
58
+ <secretariat>GB</secretariat>
59
+ </editorialgroup>
60
+ <structuredidentifier>
61
+ <project-number part="1">ISO/PreCD3 17301</project-number>
62
+ </structuredidentifier>
63
+ </ext>
64
+ </bibdata>
2
65
  <foreword>
3
66
  <note>
4
67
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
5
68
  </note>
6
69
  </foreword>
7
- </iso-standard>
70
+ </iec-standard>
8
71
 
@@ -269,14 +269,14 @@ p.Terms {
269
269
  font-size: 0.9em;
270
270
  overflow: auto;
271
271
  padding: 0 0 0 20px;
272
- background-color: #f7f7f7;
272
+ background-color: #f5faff;
273
273
  line-height: 1.2em; }
274
274
  #toggle {
275
275
  position: fixed;
276
276
  height: 100%;
277
277
  width: 30px;
278
278
  border-right: solid black 1px;
279
- background-color: #f7f7f7;
279
+ background-color: #f5faff;
280
280
  color: black !important;
281
281
  cursor: pointer;
282
282
  margin-left: -4em;
@@ -506,7 +506,7 @@ p.Biblio, p.NormRef {
506
506
  font-variant-ligatures: none; }
507
507
 
508
508
  .figure, .Sourcecode {
509
- background-color: #f7f7f7;
509
+ background-color: #f5faff;
510
510
  line-height: 1.6em;
511
511
  padding: 1.5em;
512
512
  margin: 2em 0 1em 0;
@@ -639,7 +639,7 @@ ol > li > p:before {
639
639
  3.11 Blockquotes
640
640
  */
641
641
  .blockquote, .Quote {
642
- background-color: #f7f7f7;
642
+ background-color: #f5faff;
643
643
  font-style: italic;
644
644
  width: 80%;
645
645
  padding: 1.5em;
@@ -651,7 +651,7 @@ ol > li > p:before {
651
651
  3.12 Formulas
652
652
  */
653
653
  .formula {
654
- background-color: #f7f7f7;
654
+ background-color: #f5faff;
655
655
  padding: 1.5em;
656
656
  margin-top: 2em;
657
657
  text-align: center;
@@ -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,356 @@
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
+ </div>
130
+ </div>
131
+ </body>
132
+ </html>
133
+ OUTPUT
134
+ end
135
+
136
+ it "processes IEV terms" do
137
+ expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
138
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
139
+ <bibdata type='standard'>
140
+ <docidentifier type='iso'>IEC 60050-192 ED 1</docidentifier>
141
+ <docnumber>60050</docnumber>
142
+ </bibdata>
143
+ <sections>
144
+ <clause id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title>
145
+ <terms id="_general" obligation="normative"><title>General</title>
146
+
147
+ <term id="paddy1"><preferred>paddy</preferred>
148
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
149
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
150
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
151
+ <ul>
152
+ <li>A</li>
153
+ </ul>
154
+ </termexample>
155
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
156
+ <ul>
157
+ <li>A</li>
158
+ </ul>
159
+ </termexample>
160
+
161
+ <termsource status="modified">
162
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
163
+ <modification>
164
+ <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>
165
+ </modification>
166
+ </termsource></term>
167
+
168
+ <term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
169
+ <admitted>rough rice</admitted>
170
+ <deprecates>cargo rice</deprecates>
171
+ <domain>rice</domain>
172
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
173
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
174
+ <ul>
175
+ <li>A</li>
176
+ </ul>
177
+ </termexample>
178
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
179
+ <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>
180
+ </termnote>
181
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
182
+ <ul><li>A</li></ul>
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
+ <termsource status="identical">
186
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
187
+ </termsource></term>
188
+ </terms>
189
+ </sections>
190
+ </iso-standard>
191
+ INPUT
192
+ #{HTML_HDR}
193
+ <div id=''>
194
+ <h1 class='ForewordTitle'>FOREWORD</h1>
195
+ <div class='boilerplate_legal'/>
196
+ </div>
197
+ #{IEC_TITLE}
198
+ <div id='_terms_and_definitions'>
199
+ <h1>1&#160; Terms and definitions</h1>
200
+ <br/>
201
+ <div id='_general'>
202
+ <p class='zzSTDTitle2'>
203
+ <b>192-01 General</b>
204
+ </p>
205
+ <p class='TermNum' id='paddy1'>192-01-01</p>
206
+ <p class='Terms' style='text-align:left;'>paddy</p>
207
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
208
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f892' class='example'>
209
+ <p>
210
+ <span class='example_label'>EXAMPLE 1</span>
211
+ &#160; Foreign seeds, husks, bran, sand, dust.
212
+ </p>
213
+ <ul>
214
+ <li>A</li>
215
+ </ul>
216
+ </div>
217
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f894' class='example'>
218
+ <p>
219
+ <span class='example_label'>EXAMPLE 2</span>
220
+ &#160;
221
+ </p>
222
+ <ul>
223
+ <li>A</li>
224
+ </ul>
225
+ </div>
226
+ <p>
227
+ [TERMREF]
228
+ <a href='#ISO7301'>ISO 7301:2011, 3.1</a>
229
+ [MODIFICATION]The term "cargo rice" is shown as deprecated, and
230
+ Note 1 to entry is not included here [/TERMREF]
231
+ </p>
232
+ <p class='TermNum' id='paddy'>192-01-02</p>
233
+ <p class='Terms' style='text-align:left;'>paddy, &lt;rice&gt;</p>
234
+ <p class='AltTerms' style='text-align:left;'>paddy rice, &lt;rice&gt;</p>
235
+ <p class='AltTerms' style='text-align:left;'>rough rice, &lt;rice&gt;</p>
236
+ <p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: cargo rice, &lt;rice&gt;</p>
237
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
238
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f893' class='example'>
239
+ <p>
240
+ <span class='example_label'>EXAMPLE</span>
241
+ &#160;
242
+ </p>
243
+ <ul>
244
+ <li>A</li>
245
+ </ul>
246
+ </div>
247
+ <div class='Note'>
248
+ <p>
249
+ Note 1 to entry: The starch of waxy rice consists almost entirely
250
+ of amylopectin. The kernels have a tendency to stick together
251
+ after cooking.
252
+ </p>
253
+ </div>
254
+ <div class='Note'>
255
+ <p>
256
+ Note 2 to entry:
257
+ <ul>
258
+ <li>A</li>
259
+ </ul>
260
+ <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
261
+ The starch of waxy rice consists almost entirely of amylopectin.
262
+ The kernels have a tendency to stick together after cooking.
263
+ </p>
264
+ </p>
265
+ </div>
266
+ <p>
267
+ [TERMREF]
268
+ <a href='#ISO7301'>ISO 7301:2011, 3.1</a>
269
+ [/TERMREF]
270
+ </p>
271
+ </div>
272
+ </div>
273
+ </div>
274
+ </body>
275
+ </html>
276
+ OUTPUT
277
+ end
278
+
279
+ it "populates Word template with terms reference labels" do
280
+ FileUtils.rm_f "test.doc"
281
+ FileUtils.rm_f "test.html"
282
+ IsoDoc::Iec::WordConvert.new({}).convert("test", <<~"INPUT", false)
283
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
284
+ <bibdata type='standard'>
285
+ <docidentifier type='iso'>IEC 60050-192 ED 1</docidentifier>
286
+ <docnumber>60050</docnumber>
287
+ </bibdata>
288
+ <sections>
289
+ <clause id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title>
290
+ <terms id="_general" obligation="normative"><title>General</title>
291
+
292
+ <term id="paddy1"><preferred>paddy</preferred>
293
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
294
+ <termsource status="modified">
295
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
296
+ <modification>
297
+ <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>
298
+ </modification>
299
+ </termsource></term>
300
+
301
+ </terms>
302
+ </clause>
303
+ </sections>
304
+ </iso-standard>
305
+
306
+ INPUT
307
+ word = File.read("test.doc").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
308
+ sub(%r{<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>.*$}m, "")
309
+ expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
310
+ <div class='WordSection3'>
311
+ <p class='zzSTDTitle1'>INTERNATIONAL ELECTROTECHNICAL COMMISSION</p>
312
+ <p class='zzSTDTitle1'>____________</p>
313
+ <p class='zzSTDTitle1'>&#xA0;</p>
314
+ <p class='zzSTDTitle1'>
315
+ <b/>
316
+ </p>
317
+ <p class='zzSTDTitle1'>&#xA0;</p>
318
+ <div>
319
+ <a name='_terms_and_definitions' id='_terms_and_definitions'/>
320
+ <h1 class='main'>
321
+ 1
322
+ <span style='mso-tab-count:1'>&#xA0; </span>
323
+ Terms and definitions
324
+ </h1>
325
+ <p class='MsoNormal'>
326
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
327
+ </p>
328
+ <div>
329
+ <a name='_general' id='_general'/>
330
+ <p class='zzSTDTitle2'>
331
+ <b>192-01 General</b>
332
+ </p>
333
+ <p class='TermNum'>
334
+ <a name='paddy1' id='paddy1'/>
335
+ 192-01-01
336
+ </p>
337
+ <p class='Terms' style='text-align:left;'>paddy</p>
338
+ <p class='MsoNormal'>
339
+ <a name='_eb29b35e-123e-4d1c-b50b-2714d41e747f' id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'/>
340
+ rice retaining its husk after threshing
341
+ </p>
342
+ <p class='MsoNormal'>
343
+ SOURCE:
344
+ <a href='#ISO7301'>ISO 7301:2011, 3.1</a>
345
+ , modified &#x2014; The term "cargo rice" is shown as deprecated, and
346
+ Note 1 to entry is not included here
347
+ </p>
348
+ </div>
349
+ </div>
350
+ </div>
351
+ OUTPUT
352
+ end
353
+
354
+
355
+ end
356
+