metanorma-iec 1.0.6 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -1
  3. data/.github/workflows/ubuntu.yml +20 -7
  4. data/.github/workflows/windows.yml +8 -1
  5. data/lib/asciidoctor/iec/biblio.rng +36 -6
  6. data/lib/asciidoctor/iec/converter.rb +8 -0
  7. data/lib/asciidoctor/iec/front.rb +2 -2
  8. data/lib/asciidoctor/iec/isodoc.rng +444 -1
  9. data/lib/asciidoctor/iec/isostandard.rng +12 -1
  10. data/lib/asciidoctor/iec/reqt.rng +23 -0
  11. data/lib/isodoc/iec/base_convert.rb +21 -37
  12. data/lib/isodoc/iec/html/isodoc.scss +15 -9
  13. data/lib/isodoc/iec/html/scripts.html +18 -0
  14. data/lib/isodoc/iec/html/wordstyle.scss +0 -3
  15. data/lib/isodoc/iec/iec.international-standard.xsl +1346 -608
  16. data/lib/isodoc/iec/pdf_convert.rb +2 -12
  17. data/lib/isodoc/iec/presentation_xml_convert.rb +10 -0
  18. data/lib/isodoc/iec/word_convert.rb +19 -8
  19. data/lib/isodoc/iec/xref.rb +45 -0
  20. data/lib/metanorma-iec.rb +2 -0
  21. data/lib/metanorma/iec/processor.rb +11 -9
  22. data/lib/metanorma/iec/version.rb +1 -1
  23. data/metanorma-iec.gemspec +2 -2
  24. data/spec/asciidoctor-iec/base_spec.rb +7 -6
  25. data/spec/asciidoctor-iec/cleanup_spec.rb +1 -1
  26. data/spec/asciidoctor-iec/iev_spec.rb +2 -2
  27. data/spec/isodoc/blocks_spec.rb +154 -0
  28. data/spec/isodoc/i18n_spec.rb +4 -4
  29. data/spec/isodoc/iev_spec.rb +11 -10
  30. data/spec/isodoc/inline_spec.rb +9 -9
  31. data/spec/isodoc/iso_spec.rb +4 -4
  32. data/spec/isodoc/metadata_spec.rb +90 -7
  33. data/spec/isodoc/postproc_spec.rb +3 -3
  34. data/spec/isodoc/ref_spec.rb +249 -0
  35. data/spec/isodoc/section_spec.rb +46 -9
  36. data/spec/isodoc/terms_spec.rb +10 -12
  37. data/spec/metanorma/processor_spec.rb +2 -5
  38. data/spec/spec_helper.rb +7 -0
  39. metadata +14 -11
@@ -37,7 +37,7 @@ RSpec.describe IsoDoc do
37
37
  <h2>Introduction Subsection</h2>
38
38
  </div>
39
39
  </div>
40
- #{IEC_TITLE}
40
+ #{IEC_TITLE1}
41
41
  </div>
42
42
  </body>
43
43
  </html>
@@ -122,10 +122,14 @@ INPUT
122
122
  <h1 class='ForewordTitle'>FOREWORD</h1>
123
123
  <div class='boilerplate_legal'/>
124
124
  </div>
125
- #{IEC_TITLE}
125
+ #{IEC_TITLE1}
126
126
  <div>
127
127
  <h1>1&#160; Normative references</h1>
128
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>
129
133
  </div>
130
134
  </div>
131
135
  </body>
@@ -137,7 +141,7 @@ OUTPUT
137
141
  expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
138
142
  <iso-standard xmlns="http://riboseinc.com/isoxml">
139
143
  <bibdata type='standard'>
140
- <docidentifier type='iso'>IEC 60050-192 ED 1</docidentifier>
144
+ <docidentifier type='ISO'>IEC 60050-192 ED 1</docidentifier>
141
145
  <docnumber>60050</docnumber>
142
146
  </bibdata>
143
147
  <sections>
@@ -194,7 +198,7 @@ INPUT
194
198
  <h1 class='ForewordTitle'>FOREWORD</h1>
195
199
  <div class='boilerplate_legal'/>
196
200
  </div>
197
- #{IEC_TITLE}
201
+ #{IEC_TITLE1}
198
202
  <div id='_terms_and_definitions'>
199
203
  <h1>1&#160; Terms and definitions</h1>
200
204
  <br/>
@@ -244,14 +248,14 @@ INPUT
244
248
  <li>A</li>
245
249
  </ul>
246
250
  </div>
247
- <div class='Note'>
251
+ <div class='Note' id='_671a1994-4783-40d0-bc81-987d06ffb74e'>
248
252
  <p>
249
253
  Note 1 to entry: The starch of waxy rice consists almost entirely
250
254
  of amylopectin. The kernels have a tendency to stick together
251
255
  after cooking.
252
256
  </p>
253
257
  </div>
254
- <div class='Note'>
258
+ <div class='Note' id='_671a1994-4783-40d0-bc81-987d06ffb74f'>
255
259
  <p>
256
260
  Note 2 to entry:
257
261
  <ul>
@@ -282,7 +286,7 @@ end
282
286
  IsoDoc::Iec::WordConvert.new({}).convert("test", <<~"INPUT", false)
283
287
  <iso-standard xmlns="http://riboseinc.com/isoxml">
284
288
  <bibdata type='standard'>
285
- <docidentifier type='iso'>IEC 60050-192 ED 1</docidentifier>
289
+ <docidentifier type='ISO'>IEC 60050-192 ED 1</docidentifier>
286
290
  <docnumber>60050</docnumber>
287
291
  </bibdata>
288
292
  <sections>
@@ -308,9 +312,6 @@ end
308
312
  sub(%r{<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>.*$}m, "")
309
313
  expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
310
314
  <div class='WordSection3'>
311
- <p class='zzSTDTitle1'>INTERNATIONAL ELECTROTECHNICAL COMMISSION</p>
312
- <p class='zzSTDTitle1'>____________</p>
313
- <p class='zzSTDTitle1'>&#xA0;</p>
314
315
  <p class='zzSTDTitle1'>
315
316
  <b/>
316
317
  </p>
@@ -24,7 +24,7 @@ RSpec.describe IsoDoc do
24
24
  <a id="H"/> <br/>
25
25
  </p>
26
26
  </div>
27
- #{IEC_TITLE}
27
+ #{IEC_TITLE1}
28
28
  </div>
29
29
  </body>
30
30
  </html>
@@ -56,7 +56,7 @@ RSpec.describe IsoDoc do
56
56
  <a href="mailto:fred@example.com">mailto:fred@example.com</a>
57
57
  </p>
58
58
  </div>
59
- #{IEC_TITLE}
59
+ #{IEC_TITLE1}
60
60
  </div>
61
61
  </body>
62
62
  </html>
@@ -82,7 +82,7 @@ RSpec.describe IsoDoc do
82
82
  <para><b role="strong">&lt;barry fred="http://example.com"&gt;example&lt;/barry&gt;</b></para>
83
83
  </p>
84
84
  </div>
85
- #{IEC_TITLE}
85
+ #{IEC_TITLE1}
86
86
  </div>
87
87
  </body>
88
88
  </html>
@@ -114,7 +114,7 @@ RSpec.describe IsoDoc do
114
114
  <span class="stem">Latex?</span>
115
115
  </p>
116
116
  </div>
117
- #{IEC_TITLE}
117
+ #{IEC_TITLE1}
118
118
  </div>
119
119
  </body>
120
120
  </html>
@@ -142,7 +142,7 @@ RSpec.describe IsoDoc do
142
142
  (#((Hello))#)
143
143
  </p>
144
144
  </div>
145
- #{IEC_TITLE}
145
+ #{IEC_TITLE1}
146
146
  </div>
147
147
  </body>
148
148
  </html>
@@ -182,7 +182,7 @@ RSpec.describe IsoDoc do
182
182
  <a href="#ISO712">A</a>
183
183
  </p>
184
184
  </div>
185
- #{IEC_TITLE}
185
+ #{IEC_TITLE1}
186
186
  <div>
187
187
  <h1>1&#160; Normative references</h1>
188
188
  <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
@@ -243,15 +243,15 @@ RSpec.describe IsoDoc do
243
243
  <a href="#ISO712">ISO 712, Clause 1</a>
244
244
  <a href="#ISO712">ISO 712, 1.5</a>
245
245
  <a href="#ISO712">A</a>
246
- <a href="#ISO712">ISO 712, </a>
246
+ <a href="#ISO712">ISO 712, Whole of text</a>
247
247
  <a href="#ISO712">ISO 712, Prelude 7</a>
248
248
  <a href="#ISO712">A</a>
249
249
  </p>
250
250
  </div>
251
- #{IEC_TITLE}
251
+ #{IEC_TITLE1}
252
252
  <div>
253
253
  <h1>1&#160; Normative references</h1>
254
- <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
254
+ <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
255
255
  </div>
256
256
  </div>
257
257
  </body>
@@ -88,7 +88,7 @@ RSpec.describe IsoDoc::Iec do
88
88
  <p><span class="example_label">EXAMPLE</span>&#160; Hello</p>
89
89
  </div>
90
90
  </div>
91
- #{IEC_TITLE}
91
+ #{IEC_TITLE1}
92
92
  </div>
93
93
  </body>
94
94
  </html>
@@ -120,7 +120,7 @@ RSpec.describe IsoDoc::Iec do
120
120
  <p><span class="example_label">EXAMPLE 2</span>&#160; Hello</p>
121
121
  </div>
122
122
  </div>
123
- #{IEC_TITLE}
123
+ #{IEC_TITLE1}
124
124
  </div>
125
125
  </body>
126
126
  </html>
@@ -156,7 +156,7 @@ RSpec.describe IsoDoc::Iec do
156
156
  <br clear="all" class="section"/>
157
157
  </p>
158
158
  <div class="WordSection3">
159
- #{IEC_TITLE}
159
+ #{IEC_TITLE1}
160
160
  </div>
161
161
  <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
162
162
  <div class="colophon"/>
@@ -200,7 +200,7 @@ RSpec.describe IsoDoc::Iec do
200
200
  <br clear="all" class="section"/>
201
201
  </p>
202
202
  <div class="WordSection3">
203
- #{IEC_TITLE}
203
+ #{IEC_TITLE1}
204
204
  </div>
205
205
  <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
206
206
  <div class="colophon"/>
@@ -5,9 +5,9 @@ RSpec.describe IsoDoc::Iec::Metadata do
5
5
  it "processes IsoXML metadata" do
6
6
  c = IsoDoc::Iec::HtmlConvert.new({})
7
7
  arr = c.convert_init(<<~"INPUT", "test", false)
8
- <iso-standard xmlns="http://riboseinc.com/isoxml">
8
+ <iec-standard xmlns="http://riboseinc.com/isoxml">
9
9
  INPUT
10
- expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT"
10
+ expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort].to_s.gsub(/, :/, ",\n:")).to be_equivalent_to <<~"OUTPUT"
11
11
  <iso-standard xmlns="http://riboseinc.com/isoxml">
12
12
  <bibdata type="standard">
13
13
  <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
@@ -16,7 +16,7 @@ RSpec.describe IsoDoc::Iec::Metadata do
16
16
  <title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
17
17
  <title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
18
18
  <title type="title-part" language="fr" format="text/plain">Riz</title>
19
- <docidentifier type="iso">ISO/PreCD3 17301-1</docidentifier>
19
+ <docidentifier type="ISO">ISO/PreCD3 17301-1</docidentifier>
20
20
  <docidentifier type="iso-tc">17301</docidentifier>
21
21
  <docnumber>1730</docnumber>
22
22
  <date type="published"><on>2011</on></date>
@@ -73,7 +73,51 @@ RSpec.describe IsoDoc::Iec::Metadata do
73
73
  </bibdata>
74
74
  </iso-standard>
75
75
  INPUT
76
- {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>[], :authors_affiliations=>{}, :createddate=>"2010&ndash;2011", :docnumber=>"ISO/PreCD3 17301-1", :docnumber_lang=>nil, :docnumber_reference=>nil, :docnumeric=>"1730", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :publisher=>"International Organization for Standardization", :revdate=>"2016-05-01", :revdate_monthyear=>"May 2016", :sc=>"SC 4", :secretariat=>"GB", :stage=>"35", :stage_int=>35, :stageabbr=>"CD", :statusabbr=>"3CD", :tc=>"TC 34", :tc_docnumber=>["17301"], :unpublished=>true, :wg=>"WG 3"}
76
+ {:accesseddate=>"2012",
77
+ :activateddate=>"2013",
78
+ :agency=>"ISO",
79
+ :authors=>[],
80
+ :authors_affiliations=>{},
81
+ :createddate=>"2010&ndash;2011",
82
+ :docnumber=>"ISO/PreCD3 17301-1",
83
+ :docnumber_lang=>nil,
84
+ :docnumber_reference=>nil,
85
+ :docnumeric=>"1730",
86
+ :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz",
87
+ :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses",
88
+ :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai",
89
+ :docsubtitlepart=>"Riz",
90
+ :docsubtitlepartlabel=>"Partie&nbsp;1",
91
+ :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice",
92
+ :doctitleintro=>"Cereals and pulses",
93
+ :doctitlemain=>"Specifications and test methods",
94
+ :doctitlepart=>"Rice",
95
+ :doctitlepartlabel=>"Part&nbsp;1",
96
+ :doctype=>"International Standard",
97
+ :docyear=>"2016",
98
+ :draft=>"0.4",
99
+ :draftinfo=>" (draft 0.4, 2016-05-01)",
100
+ :edition=>"2",
101
+ :editorialgroup=>["TC 34", "SC 4", "WG 3"],
102
+ :ics=>nil,
103
+ :keywords=>[],
104
+ :obsoleteddate=>"2014",
105
+ :obsoletes=>nil,
106
+ :obsoletes_part=>nil,
107
+ :publisheddate=>"2011",
108
+ :publisher=>"International Organization for Standardization",
109
+ :revdate=>"2016-05-01",
110
+ :revdate_monthyear=>"May 2016",
111
+ :sc=>"SC 4",
112
+ :secretariat=>"GB",
113
+ :stage=>"35",
114
+ :stage_int=>35,
115
+ :stageabbr=>"CD",
116
+ :statusabbr=>"3CD",
117
+ :tc=>"TC 34",
118
+ :tc_docnumber=>["17301"],
119
+ :unpublished=>true,
120
+ :wg=>"WG 3"}
77
121
  OUTPUT
78
122
  end
79
123
 
@@ -82,7 +126,7 @@ OUTPUT
82
126
  arr = c.convert_init(<<~"INPUT", "test", false)
83
127
  <iso-standard xmlns="http://riboseinc.com/isoxml">
84
128
  INPUT
85
- expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT"
129
+ expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort].to_s.gsub(/, :/, ",\n:")).to be_equivalent_to <<~"OUTPUT"
86
130
  <iso-standard xmlns="http://riboseinc.com/isoxml">
87
131
  <bibdata type="standard">
88
132
  <title>
@@ -95,7 +139,7 @@ OUTPUT
95
139
  <title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
96
140
  <title type="title-part" language="fr" format="text/plain">Riz</title>
97
141
  </title>
98
- <docidentifier type="iso">ISO/IEC/CD 17301-1-3</docidentifier>
142
+ <docidentifier type="ISO">ISO/IEC/CD 17301-1-3</docidentifier>
99
143
  <docidentifier type="iso-tc">17301</docidentifier>
100
144
  <contributor>
101
145
  <role type="author"/>
@@ -152,7 +196,46 @@ OUTPUT
152
196
  </bibdata>
153
197
  </iso-standard>
154
198
  INPUT
155
- {:agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :docnumber=>"ISO/IEC/CD 17301-1-3", :docnumber_lang=>nil, :docnumber_reference=>nil, :docnumeric=>nil, :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1&ndash;3", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1&ndash;3", :doctype=>"Technical Report", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisher=>"International Organization for Standardization and International Electrotechnical Commission", :revdate=>nil, :revdate_monthyear=>nil, :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"50", :stage_int=>50, :stageabbr=>"FDIS", :statusabbr=>"CFDIS", :tc=>"ABC 34", :tc_docnumber=>["17301"], :unpublished=>true, :wg=>"GHI 3"}
199
+ {:agency=>"ISO/IEC",
200
+ :authors=>[],
201
+ :authors_affiliations=>{},
202
+ :docnumber=>"ISO/IEC/CD 17301-1-3",
203
+ :docnumber_lang=>nil,
204
+ :docnumber_reference=>nil,
205
+ :docnumeric=>nil,
206
+ :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz",
207
+ :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses",
208
+ :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai",
209
+ :docsubtitlepart=>"Riz",
210
+ :docsubtitlepartlabel=>"Partie&nbsp;1&ndash;3",
211
+ :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice",
212
+ :doctitleintro=>"Cereals and pulses",
213
+ :doctitlemain=>"Specifications and test methods",
214
+ :doctitlepart=>"Rice",
215
+ :doctitlepartlabel=>"Part&nbsp;1&ndash;3",
216
+ :doctype=>"Technical Report",
217
+ :docyear=>"2016",
218
+ :draft=>nil,
219
+ :draftinfo=>"",
220
+ :edition=>nil,
221
+ :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
222
+ :ics=>"1.2.3, 1.2.3",
223
+ :keywords=>[],
224
+ :obsoletes=>"IEC 8121",
225
+ :obsoletes_part=>"3.1",
226
+ :publisher=>"International Organization for Standardization and International Electrotechnical Commission",
227
+ :revdate=>nil,
228
+ :revdate_monthyear=>nil,
229
+ :sc=>"DEF 4",
230
+ :secretariat=>"XXXX",
231
+ :stage=>"50",
232
+ :stage_int=>50,
233
+ :stageabbr=>"FDIS",
234
+ :statusabbr=>"CFDIS",
235
+ :tc=>"ABC 34",
236
+ :tc_docnumber=>["17301"],
237
+ :unpublished=>true,
238
+ :wg=>"GHI 3"}
156
239
  OUTPUT
157
240
  end
158
241
 
@@ -123,7 +123,7 @@ RSpec.describe IsoDoc do
123
123
  sub(%r{<br.*$}m, "")
124
124
  expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
125
125
  <div class="WordSection3">
126
- #{IEC_TITLE.gsub(/\&#160;/, "&#xA0;")}
126
+ #{IEC_TITLE1.gsub(/\&#160;/, "&#xA0;")}
127
127
  <div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1 class="main">1<span style="mso-tab-count:1">&#xA0; </span>Terms and Definitions</h1>
128
128
  <p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1</p><p class="Terms" style="text-align:left;">paddy</p>
129
129
  <p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
@@ -228,7 +228,7 @@ RSpec.describe IsoDoc do
228
228
  sub(%r{<br[^>]*>\s*<div class="colophon">.*$}m, "")
229
229
  expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
230
230
  <div class="WordSection3">
231
- #{IEC_TITLE.gsub(/\&#160;/, "&#xA0;")}
231
+ #{IEC_TITLE1.gsub(/\&#160;/, "&#xA0;")}
232
232
  <p class="MsoNormal">
233
233
  <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
234
234
  </p>
@@ -274,7 +274,7 @@ RSpec.describe IsoDoc do
274
274
  sub(%r{<br[^>]*>\s*<div class="colophon">.*$}m, "")
275
275
  expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
276
276
  <div class="WordSection3">
277
- #{IEC_TITLE.gsub(/\&#160;/, "&#xA0;")}
277
+ #{IEC_TITLE1.gsub(/\&#160;/, "&#xA0;")}
278
278
  <p class="MsoNormal">
279
279
  <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
280
280
  </p>
@@ -0,0 +1,249 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc::Iec do
4
+ it "processes IsoXML bibliographies" 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
+ <language>en</language>
9
+ </bibdata>
10
+ <preface><foreword>
11
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
12
+ <eref bibitemid="ISO712"/>
13
+ <eref bibitemid="ISBN"/>
14
+ <eref bibitemid="ISSN"/>
15
+ <eref bibitemid="ISO16634"/>
16
+ <eref bibitemid="ref1"/>
17
+ <eref bibitemid="ref10"/>
18
+ <eref bibitemid="ref12"/>
19
+ <eref bibitemid="zip_ffs"/>
20
+ </p>
21
+ </foreword></preface>
22
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
23
+ <p>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>
24
+ <bibitem id="ISO712" type="standard">
25
+ <title format="text/plain">Cereals or cereal products</title>
26
+ <title type="main" format="text/plain">Cereals and cereal products</title>
27
+ <docidentifier type="ISO">ISO 712</docidentifier>
28
+ <docidentifier type="metanorma">[110]</docidentifier>
29
+ <contributor>
30
+ <role type="publisher"/>
31
+ <organization>
32
+ <name>International Organization for Standardization</name>
33
+ </organization>
34
+ </contributor>
35
+ </bibitem>
36
+ <bibitem id="ISO16634" type="standard">
37
+ <title language="x" format="text/plain">Cereals, pulses, milled cereal products, xxxx, oilseeds and animal feeding stuffs</title>
38
+ <title language="en" format="text/plain">Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</title>
39
+ <docidentifier type="ISO">ISO 16634:-- (all parts)</docidentifier>
40
+ <date type="published"><on>--</on></date>
41
+ <contributor>
42
+ <role type="publisher"/>
43
+ <organization>
44
+ <abbreviation>ISO</abbreviation>
45
+ </organization>
46
+ </contributor>
47
+ <note format="text/plain" reference="1" type="ISO DATE">Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
48
+ <extent type="part">
49
+ <referenceFrom>all</referenceFrom>
50
+ </extent>
51
+
52
+ </bibitem>
53
+ <bibitem id="ISO20483" type="standard">
54
+ <title format="text/plain">Cereals and pulses</title>
55
+ <docidentifier type="ISO">ISO 20483:2013-2014</docidentifier>
56
+ <date type="published"><from>2013</from><to>2014</to></date>
57
+ <contributor>
58
+ <role type="publisher"/>
59
+ <organization>
60
+ <name>International Organization for Standardization</name>
61
+ </organization>
62
+ </contributor>
63
+ </bibitem>
64
+ <bibitem id="ref1">
65
+ <formattedref format="application/x-isodoc+xml"><smallcap>Standard No I.C.C 167</smallcap>. <em>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</em> (see <link target="http://www.icc.or.at"/>)</formattedref>
66
+ <docidentifier type="ICC">167</docidentifier>
67
+ </bibitem>
68
+ <note><p>This is an annotation of ISO 20483:2013-2014</p></note>
69
+ <bibitem id="zip_ffs"><formattedref format="application/x-isodoc+xml">Title 5</formattedref><docidentifier type="metanorma">[5]</docidentifier></bibitem>
70
+
71
+
72
+ </references><references id="_bibliography" obligation="informative" normative="false">
73
+ <title>Bibliography</title>
74
+ <bibitem id="ISBN" type="ISBN">
75
+ <title format="text/plain">Chemicals for analytical laboratory use</title>
76
+ <docidentifier type="ISBN">ISBN</docidentifier>
77
+ <docidentifier type="metanorma">[1]</docidentifier>
78
+ <contributor>
79
+ <role type="publisher"/>
80
+ <organization>
81
+ <abbreviation>ISBN</abbreviation>
82
+ </organization>
83
+ </contributor>
84
+ </bibitem>
85
+ <bibitem id="ISSN" type="ISSN">
86
+ <title format="text/plain">Instruments for analytical laboratory use</title>
87
+ <docidentifier type="ISSN">ISSN</docidentifier>
88
+ <docidentifier type="metanorma">[2]</docidentifier>
89
+ <contributor>
90
+ <role type="publisher"/>
91
+ <organization>
92
+ <abbreviation>ISSN</abbreviation>
93
+ </organization>
94
+ </contributor>
95
+ </bibitem>
96
+ <note><p>This is an annotation of document ISSN.</p></note>
97
+ <note><p>This is another annotation of document ISSN.</p></note>
98
+ <bibitem id="ISO3696" type="standard">
99
+ <title format="text/plain">Water for analytical laboratory use</title>
100
+ <docidentifier type="ISO">ISO 3696</docidentifier>
101
+ <contributor>
102
+ <role type="publisher"/>
103
+ <organization>
104
+ <abbreviation>ISO</abbreviation>
105
+ </organization>
106
+ </contributor>
107
+ </bibitem>
108
+ <bibitem id="ref10">
109
+ <formattedref format="application/x-isodoc+xml"><smallcap>Standard No I.C.C 167</smallcap>. <em>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</em> (see <link target="http://www.icc.or.at"/>)</formattedref>
110
+ <docidentifier type="metanorma">[10]</docidentifier>
111
+ </bibitem>
112
+ <bibitem id="ref11">
113
+ <title>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</title>
114
+ <docidentifier type="IETF">RFC 10</docidentifier>
115
+ </bibitem>
116
+ <bibitem id="ref12">
117
+ <formattedref format="application/x-isodoc+xml">CitationWorks. 2019. <em>How to cite a reference</em>.</formattedref>
118
+ <docidentifier type="metanorma">[Citn]</docidentifier>
119
+ <docidentifier type="IETF">RFC 20</docidentifier>
120
+ </bibitem>
121
+
122
+
123
+ </references>
124
+ </bibliography>
125
+ </iso-standard>
126
+ INPUT
127
+ #{HTML_HDR}
128
+ <div>
129
+ <h1 class='ForewordTitle'>FOREWORD</h1>
130
+ <div class='boilerplate_legal'/>
131
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
132
+ <a href='#ISO712'>[110]</a>
133
+ <a href='#ISBN'>[1]</a>
134
+ <a href='#ISSN'>[2]</a>
135
+ <a href='#ISO16634'>ISO 16634:--</a>
136
+ <a href='#ref1'>ICC 167</a>
137
+ <a href='#ref10'>[10]</a>
138
+ <a href='#ref12'>Citn</a>
139
+ <a href='#zip_ffs'>[5]</a>
140
+ </p>
141
+ </div>
142
+ #{IEC_TITLE1}
143
+ <div>
144
+ <h1>1&#160; Normative references</h1>
145
+ <p>
146
+ The following documents are referred to in the text in such a way that
147
+ some or all of their content constitutes requirements of this
148
+ document. For dated references, only the edition cited applies. For
149
+ undated references, the latest edition of the referenced document
150
+ (including any amendments) applies.
151
+ </p>
152
+ <p id='ISO712' class='NormRef'>
153
+ [110], ISO 712,
154
+ <i>Cereals and cereal products</i>
155
+ </p>
156
+ <p id='ISO16634' class='NormRef'>
157
+ ISO 16634:-- (all parts)
158
+ <a class='FootnoteRef' href='#fn:1'>
159
+ <sup>1</sup>
160
+ </a>
161
+ ,
162
+ <i>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i>
163
+ </p>
164
+ <p id='ISO20483' class='NormRef'>
165
+ ISO 20483:2013-2014,
166
+ <i>Cereals and pulses</i>
167
+ </p>
168
+ <p id='ref1' class='NormRef'>
169
+ ICC 167,
170
+ <span style='font-variant:small-caps;'>Standard No I.C.C 167</span>
171
+ .
172
+ <i>
173
+ Determination of the protein content in cereal and cereal products
174
+ for food and animal feeding stuffs according to the Dumas combustion
175
+ method
176
+ </i>
177
+ (see
178
+ <a href='http://www.icc.or.at'>http://www.icc.or.at</a>
179
+ )
180
+ </p>
181
+ <div class='Note'>
182
+ <p>
183
+ <span class='note_label'>NOTE</span>
184
+ &#160; This is an annotation of ISO 20483:2013-2014
185
+ </p>
186
+ </div>
187
+ <p id='zip_ffs' class='NormRef'>[5], Title 5</p>
188
+ </div>
189
+ <br/>
190
+ <div>
191
+ <h1 class='Section3'>Bibliography</h1>
192
+ <p id='ISBN' class='NormRef'>
193
+ [1],
194
+ <i>Chemicals for analytical laboratory use</i>
195
+ </p>
196
+ <p id='ISSN' class='NormRef'>
197
+ [2],
198
+ <i>Instruments for analytical laboratory use</i>
199
+ </p>
200
+ <div class='Note'>
201
+ <p>
202
+ <span class='note_label'>NOTE</span>
203
+ &#160; This is an annotation of document ISSN.
204
+ </p>
205
+ </div>
206
+ <div class='Note'>
207
+ <p>
208
+ <span class='note_label'>NOTE</span>
209
+ &#160; This is another annotation of document ISSN.
210
+ </p>
211
+ </div>
212
+ <p id='ISO3696' class='NormRef'>
213
+ ISO 3696,
214
+ <i>Water for analytical laboratory use</i>
215
+ </p>
216
+ <p id='ref10' class='NormRef'>
217
+ [10],
218
+ <span style='font-variant:small-caps;'>Standard No I.C.C 167</span>
219
+ .
220
+ <i>
221
+ Determination of the protein content in cereal and cereal products
222
+ for food and animal feeding stuffs according to the Dumas combustion
223
+ method
224
+ </i>
225
+ (see
226
+ <a href='http://www.icc.or.at'>http://www.icc.or.at</a>
227
+ )
228
+ </p>
229
+ <p id='ref11' class='NormRef'>
230
+ IETF RFC 10,
231
+ <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i>
232
+ </p>
233
+ <p id='ref12' class='NormRef'>
234
+ Citn, IETF RFC 20, CitationWorks. 2019.
235
+ <i>How to cite a reference</i>
236
+ .
237
+ </p>
238
+ </div>
239
+ <aside id='fn:1' class='footnote'>
240
+ <p>Under preparation. (Stage at the time of publication ISO/DIS 16634)</p>
241
+ </aside>
242
+ </div>
243
+ </body>
244
+ </html>
245
+
246
+ OUTPUT
247
+ end
248
+
249
+ end