metanorma-iso 1.3.23 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -0
  3. data/.github/workflows/ubuntu.yml +8 -0
  4. data/.github/workflows/windows.yml +8 -0
  5. data/lib/asciidoctor/iso/base.rb +26 -13
  6. data/lib/asciidoctor/iso/biblio.rng +36 -6
  7. data/lib/asciidoctor/iso/cleanup.rb +20 -3
  8. data/lib/asciidoctor/iso/front.rb +16 -107
  9. data/lib/asciidoctor/iso/front_id.rb +196 -0
  10. data/lib/asciidoctor/iso/isodoc.rng +450 -4
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +98 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +12 -1
  13. data/lib/asciidoctor/iso/macros.rb +21 -0
  14. data/lib/asciidoctor/iso/reqt.rng +23 -0
  15. data/lib/asciidoctor/iso/section.rb +18 -32
  16. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +87 -0
  17. data/lib/asciidoctor/iso/validate.rb +41 -25
  18. data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
  19. data/lib/asciidoctor/iso/validate_section.rb +2 -2
  20. data/lib/asciidoctor/iso/validate_style.rb +6 -5
  21. data/lib/asciidoctor/iso/validate_title.rb +1 -1
  22. data/lib/isodoc/iso/base_convert.rb +67 -99
  23. data/lib/isodoc/iso/html/header.html +10 -6
  24. data/lib/isodoc/iso/html/html_iso_titlepage.html +25 -16
  25. data/lib/isodoc/iso/html/isodoc.scss +25 -0
  26. data/lib/isodoc/iso/html/scripts.html +18 -0
  27. data/lib/isodoc/iso/html/style-human.scss +23 -0
  28. data/lib/isodoc/iso/html/style-iso.scss +18 -0
  29. data/lib/isodoc/iso/html/word_iso_intro.html +4 -0
  30. data/lib/isodoc/iso/html/word_iso_titlepage.html +21 -0
  31. data/lib/isodoc/iso/html/wordstyle.scss +45 -4
  32. data/lib/isodoc/iso/html_convert.rb +7 -0
  33. data/lib/isodoc/iso/iso.amendment.xsl +5082 -0
  34. data/lib/isodoc/iso/iso.international-standard.xsl +1899 -796
  35. data/lib/isodoc/iso/metadata.rb +69 -23
  36. data/lib/isodoc/iso/pdf_convert.rb +5 -11
  37. data/lib/isodoc/iso/presentation_xml_convert.rb +13 -0
  38. data/lib/isodoc/iso/sections.rb +66 -0
  39. data/lib/isodoc/iso/sts_convert.rb +31 -0
  40. data/lib/isodoc/iso/xref.rb +111 -0
  41. data/lib/metanorma-iso.rb +2 -0
  42. data/lib/metanorma/iso/processor.rb +23 -8
  43. data/lib/metanorma/iso/version.rb +1 -1
  44. data/metanorma-iso.gemspec +5 -2
  45. data/spec/asciidoctor-iso/amd_spec.rb +726 -0
  46. data/spec/asciidoctor-iso/base_spec.rb +31 -21
  47. data/spec/asciidoctor-iso/blocks_spec.rb +6 -6
  48. data/spec/asciidoctor-iso/cleanup_spec.rb +15 -15
  49. data/spec/asciidoctor-iso/inline_spec.rb +1 -1
  50. data/spec/asciidoctor-iso/macros_spec.rb +289 -0
  51. data/spec/asciidoctor-iso/refs_spec.rb +5 -5
  52. data/spec/asciidoctor-iso/section_spec.rb +8 -8
  53. data/spec/asciidoctor-iso/table_spec.rb +1 -1
  54. data/spec/isodoc/amd_spec.rb +652 -0
  55. data/spec/isodoc/blocks_spec.rb +112 -27
  56. data/spec/isodoc/i18n_spec.rb +8 -8
  57. data/spec/isodoc/inline_spec.rb +4 -4
  58. data/spec/isodoc/iso_spec.rb +1 -1
  59. data/spec/isodoc/metadata_spec.rb +90 -4
  60. data/spec/isodoc/postproc_spec.rb +11 -116
  61. data/spec/isodoc/ref_spec.rb +9 -9
  62. data/spec/isodoc/section_spec.rb +33 -6
  63. data/spec/isodoc/table_spec.rb +29 -29
  64. data/spec/isodoc/terms_spec.rb +4 -4
  65. data/spec/isodoc/xref_spec.rb +34 -28
  66. data/spec/metanorma/processor_spec.rb +2 -2
  67. data/spec/spec_helper.rb +11 -0
  68. metadata +63 -12
  69. data/asciidoctor-iso.gemspec.old +0 -50
@@ -8,12 +8,10 @@ RSpec.describe IsoDoc do
8
8
  <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true">
9
9
  <stem type="AsciiMath">r = 1 %</stem>
10
10
  <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
11
- <dt>
12
- <stem type="AsciiMath">r</stem>
13
- </dt>
14
- <dd>
15
- <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
16
- </dd>
11
+ <dt> <stem type="AsciiMath">r</stem> </dt>
12
+ <dd> <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p> </dd>
13
+ <dt> <stem type="AsciiMath">s_1</stem> </dt>
14
+ <dd> <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the other repeatability limit.</p> </dd>
17
15
  </dl>
18
16
  <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
19
17
  <p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p>
@@ -26,29 +24,55 @@ RSpec.describe IsoDoc do
26
24
  </iso-standard>
27
25
  INPUT
28
26
  #{HTML_HDR}
29
- <br/>
30
- <div>
31
- <h1 class="ForewordTitle">Foreword</h1>
32
- <div id="_be9158af-7e93-4ee2-90c5-26d31c181934" class="formula"><p><span class="stem">(#(r = 1 %)#)</span></p></div><p style='page-break-after:avoid;'>where</p><dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d" class='formula_dl'><dt>
33
- <span class="stem">(#(r)#)</span>
34
- </dt><dd>
35
- <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
36
- </dd></dl>
37
-
38
-
39
- <div id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0" class="Note"><p><span class="note_label">NOTE</span>&#160; [durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p></div>
40
-
41
- <div id="_be9158af-7e93-4ee2-90c5-26d31c181935" class="formula"><p><span class="stem">(#(r = 1 %)#)</span>&#160; (1)</p></div>
42
- </div>
43
- <p class="zzSTDTitle1"/>
44
- </div>
45
- </body>
46
- </html>
27
+ <br/>
28
+ <div>
29
+ <h1 class='ForewordTitle'>Foreword</h1>
30
+ <div id='_be9158af-7e93-4ee2-90c5-26d31c181934'><div class='formula'>
31
+ <p>
32
+ <span class='stem'>(#(r = 1 %)#)</span>
33
+ </p>
34
+ </div>
35
+ <p style='page-break-after:avoid;'>where</p>
36
+ <dl id='_e4fe94fe-1cde-49d9-b1ad-743293b7e21d' class='formula_dl'>
37
+ <dt>
38
+ <span class='stem'>(#(r)#)</span>
39
+ </dt>
40
+ <dd>
41
+ <p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the repeatability limit.</p>
42
+ </dd>
43
+ <dt>
44
+ <span class='stem'>(#(s_1)#)</span>
45
+ </dt>
46
+ <dd>
47
+ <p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the other repeatability limit.</p>
48
+ </dd>
49
+ </dl>
50
+ <div id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0' class='Note'>
51
+ <p>
52
+ <span class='note_label'>NOTE</span>
53
+ &#160; [durationUnits] is essentially a duration statement without
54
+ the "P" prefix. "P" is unnecessary because between "G" and "U"
55
+ duration is always expressed.
56
+ </p>
57
+ </div>
58
+ </div>
59
+ <div id='_be9158af-7e93-4ee2-90c5-26d31c181935'><div class='formula'>
60
+ <p>
61
+ <span class='stem'>(#(r = 1 %)#)</span>
62
+ &#160; (1)
63
+ </p>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ <p class='zzSTDTitle1'/>
68
+ </div>
69
+ </body>
70
+ </html>
47
71
  OUTPUT
48
72
  end
49
73
 
50
74
  it "processes formulae (Word)" do
51
- expect((IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{^.*<div>\s*<h1 class="ForewordTitle">}m, '<div><h1 class="ForewordTitle">').sub(%r{<p>\&#160;</p>\s*</div>.*$}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
75
+ expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{^.*<div>\s*<h1 class="ForewordTitle">}m, '<div><h1 class="ForewordTitle">').sub(%r{<p>\&#160;</p>\s*</div>.*$}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
52
76
  <iso-standard xmlns="http://riboseinc.com/isoxml">
53
77
  <preface><foreword>
54
78
  <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true">
@@ -60,6 +84,8 @@ RSpec.describe IsoDoc do
60
84
  <dd>
61
85
  <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
62
86
  </dd>
87
+ <dt> <stem type="AsciiMath">s_1</stem> </dt>
88
+ <dd> <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the other repeatability limit.</p> </dd>
63
89
  </dl>
64
90
  <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
65
91
  <p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p>
@@ -73,7 +99,7 @@ RSpec.describe IsoDoc do
73
99
  INPUT
74
100
  <div>
75
101
  <h1 class='ForewordTitle'>Foreword</h1>
76
- <div id='_be9158af-7e93-4ee2-90c5-26d31c181934' class='formula'>
102
+ <div id='_be9158af-7e93-4ee2-90c5-26d31c181934'><div class='formula'>
77
103
  <p>
78
104
  <span class='stem'>(#(r = 1 %)#)</span>
79
105
  </p>
@@ -90,6 +116,16 @@ RSpec.describe IsoDoc do
90
116
  <p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the repeatability limit.</p>
91
117
  </td>
92
118
  </tr>
119
+ <tr>
120
+ <td valign='top' align='left'>
121
+ <p align='left' style='margin-left:0pt;text-align:left;'>
122
+ <span class='stem'>(#(s_1)#)</span>
123
+ </p>
124
+ </td>
125
+ <td valign='top'>
126
+ <p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the other repeatability limit.</p>
127
+ </td>
128
+ </tr>
93
129
  </table>
94
130
  <div id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0' class='Note'>
95
131
  <p class='Note'>
@@ -100,16 +136,65 @@ RSpec.describe IsoDoc do
100
136
  always expressed.
101
137
  </p>
102
138
  </div>
103
- <div id='_be9158af-7e93-4ee2-90c5-26d31c181935' class='formula'>
139
+ </div>
140
+ <div id='_be9158af-7e93-4ee2-90c5-26d31c181935'><div class='formula'>
104
141
  <p>
105
142
  <span class='stem'>(#(r = 1 %)#)</span>
106
143
  <span style='mso-tab-count:1'>&#160; </span>
107
144
  (1)
108
145
  </p>
109
146
  </div>
147
+ </div>
110
148
  </div>
111
149
  OUTPUT
112
150
  end
113
151
 
152
+ it "processes formulae with single definition list entry" do
153
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
154
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
155
+ <preface><foreword>
156
+ <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true">
157
+ <stem type="AsciiMath">r = 1 %</stem>
158
+ <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
159
+ <dt>
160
+ <stem type="AsciiMath">r</stem>
161
+ </dt>
162
+ <dd>
163
+ <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
164
+ </dd>
165
+ </dl>
166
+ <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
167
+ <p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p>
168
+ </note>
169
+ </formula>
170
+ <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
171
+ <stem type="AsciiMath">r = 1 %</stem>
172
+ </formula>
173
+ </foreword></preface>
174
+ </iso-standard>
175
+ INPUT
176
+ #{HTML_HDR}
177
+ <br/>
178
+ <div>
179
+ <h1 class="ForewordTitle">Foreword</h1>
180
+ <div id="_be9158af-7e93-4ee2-90c5-26d31c181934"><div class="formula"><p><span class="stem">(#(r = 1 %)#)</span></p></div>
181
+ <span class='zzMoveToFollowing'>
182
+ where
183
+ <span class='stem'>(#(r)#)</span>
184
+ </span>
185
+ <p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the repeatability limit.</p>
186
+
187
+ <div id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0" class="Note"><p><span class="note_label">NOTE</span>&#160; [durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p></div>
188
+ </div>
189
+
190
+ <div id="_be9158af-7e93-4ee2-90c5-26d31c181935"><div class="formula"><p><span class="stem">(#(r = 1 %)#)</span>&#160; (1)</p></div></div>
191
+ </div>
192
+ <p class="zzSTDTitle1"/>
193
+ </div>
194
+ </body>
195
+ </html>
196
+ OUTPUT
197
+ end
198
+
114
199
 
115
200
  end
@@ -59,11 +59,11 @@ RSpec.describe IsoDoc do
59
59
  <appendix id="Q2" inline-header="false" obligation="normative">
60
60
  <title>An Appendix</title>
61
61
  </appendix>
62
- </annex><bibliography><references id="R" obligation="informative">
62
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
63
63
  <title>Normative References</title>
64
64
  </references><clause id="S" obligation="informative">
65
65
  <title>Bibliography</title>
66
- <references id="T" obligation="informative">
66
+ <references id="T" obligation="informative" normative="false">
67
67
  <title>Bibliography Subsection</title>
68
68
  </references>
69
69
  </clause>
@@ -203,11 +203,11 @@ RSpec.describe IsoDoc do
203
203
  <appendix id="Q2" inline-header="false" obligation="normative">
204
204
  <title>An Appendix</title>
205
205
  </appendix>
206
- </annex><bibliography><references id="R" obligation="informative">
206
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
207
207
  <title>Normative References</title>
208
208
  </references><clause id="S" obligation="informative">
209
209
  <title>Bibliography</title>
210
- <references id="T" obligation="informative">
210
+ <references id="T" obligation="informative" normative="false">
211
211
  <title>Bibliography Subsection</title>
212
212
  </references>
213
213
  </clause>
@@ -347,11 +347,11 @@ RSpec.describe IsoDoc do
347
347
  <appendix id="Q2" inline-header="false" obligation="normative">
348
348
  <title>An Appendix</title>
349
349
  </appendix>
350
- </annex><bibliography><references id="R" obligation="informative">
350
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
351
351
  <title>Normative References</title>
352
352
  </references><clause id="S" obligation="informative">
353
353
  <title>Bibliography</title>
354
- <references id="T" obligation="informative">
354
+ <references id="T" obligation="informative" normative="false">
355
355
  <title>Bibliography Subsection</title>
356
356
  </references>
357
357
  </clause>
@@ -492,7 +492,7 @@ RSpec.describe IsoDoc do
492
492
  <appendix id="Q2" inline-header="false" obligation="normative">
493
493
  <title>An Appendix</title>
494
494
  </appendix>
495
- </annex><bibliography><references id="R" obligation="informative">
495
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
496
496
  <title>Normative References</title>
497
497
  <bibitem id="ISO712" type="standard">
498
498
  <title format="text/plain">Cereals and cereal products</title>
@@ -506,7 +506,7 @@ RSpec.describe IsoDoc do
506
506
  </bibitem>
507
507
  </references><clause id="S" obligation="informative">
508
508
  <title>Bibliography</title>
509
- <references id="T" obligation="informative">
509
+ <references id="T" obligation="informative" normative="false">
510
510
  <title>Bibliography Subsection</title>
511
511
  </references>
512
512
  </clause>
@@ -158,7 +158,7 @@ RSpec.describe IsoDoc do
158
158
  <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</stem>
159
159
  </p>
160
160
  </foreword></preface>
161
- <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
161
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
162
162
  <bibitem id="ISO712" type="standard">
163
163
  <title format="text/plain">Cereals and cereal products</title>
164
164
  <docidentifier>ISO 712</docidentifier>
@@ -213,7 +213,7 @@ RSpec.describe IsoDoc do
213
213
  <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
214
214
  </p>
215
215
  </foreword></preface>
216
- <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
216
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
217
217
  <bibitem id="ISO712" type="standard">
218
218
  <title format="text/plain">Cereals and cereal products</title>
219
219
  <docidentifier>ISO 712</docidentifier>
@@ -243,7 +243,7 @@ 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>
@@ -251,7 +251,7 @@ RSpec.describe IsoDoc do
251
251
  <p class="zzSTDTitle1"/>
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>
@@ -96,7 +96,7 @@ RSpec.describe IsoDoc::Iso do
96
96
  <eref bibitemid="ISO20483"/>
97
97
  </p>
98
98
  </foreword></preface>
99
- <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
99
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
100
100
  <bibitem type="international-standard" id="IEV">
101
101
  <title format="text/plain" language="en" script="Latn">Electropedia:
102
102
  The World's Online Electrotechnical Vocabulary</title>
@@ -16,8 +16,9 @@ RSpec.describe IsoDoc::Iso::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-with-lang">ISO/PreCD3 17301-1 (E)</docidentifier>
21
+ <docidentifier type="iso-reference">ISO/PreCD3 17301-1:2000 (E)</docidentifier>
21
22
  <docidentifier type="iso-tc">17301</docidentifier>
22
23
  <docidentifier type="iso-tc">17302</docidentifier>
23
24
  <docnumber>1730</docnumber>
@@ -59,6 +60,8 @@ RSpec.describe IsoDoc::Iso::Metadata do
59
60
  </organization>
60
61
  </owner>
61
62
  </copyright>
63
+ <keyword>kw2</keyword>
64
+ <keyword>kw1</keyword>
62
65
  <ext>
63
66
  <doctype>international-standard</doctype>
64
67
  <editorialgroup>
@@ -75,7 +78,51 @@ RSpec.describe IsoDoc::Iso::Metadata do
75
78
  </bibdata>
76
79
  </iso-standard>
77
80
  INPUT
78
- {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>[], :authors_affiliations=>{}, :createddate=>"2010&ndash;2011", :docnumber=>"ISO/PreCD3 17301-1", :docnumber_lang=>"ISO/PreCD3 17301-1 (E)", :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=>"30", :stage_int=>30, :stageabbr=>"CD", :statusabbr=>"PreCD3", :tc=>"TC 34", :tc_docnumber=>["17301", "17302"], :unpublished=>true, :wg=>"WG 3"}
81
+ {:accesseddate=>"2012",
82
+ :activateddate=>"2013",
83
+ :agency=>"ISO",
84
+ :authors=>[],
85
+ :authors_affiliations=>{},
86
+ :createddate=>"2010&ndash;2011",
87
+ :docnumber=>"ISO/PreCD3 17301-1",
88
+ :docnumber_lang=>"ISO/PreCD3 17301-1 (E)",
89
+ :docnumber_reference=>"ISO/PreCD3 17301-1:2000 (E)",
90
+ :docnumeric=>"1730",
91
+ :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",
92
+ :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses",
93
+ :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai",
94
+ :docsubtitlepart=>"Riz",
95
+ :docsubtitlepartlabel=>"Partie&nbsp;1",
96
+ :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice",
97
+ :doctitleintro=>"Cereals and pulses",
98
+ :doctitlemain=>"Specifications and test methods",
99
+ :doctitlepart=>"Rice",
100
+ :doctitlepartlabel=>"Part&nbsp;1",
101
+ :doctype=>"International Standard",
102
+ :docyear=>"2016",
103
+ :draft=>"0.4",
104
+ :draftinfo=>" (draft 0.4, 2016-05-01)",
105
+ :edition=>"2",
106
+ :editorialgroup=>["TC 34", "SC 4", "WG 3"],
107
+ :ics=>nil,
108
+ :keywords=>["kw2", "kw1"],
109
+ :obsoleteddate=>"2014",
110
+ :obsoletes=>nil,
111
+ :obsoletes_part=>nil,
112
+ :publisheddate=>"2011",
113
+ :publisher=>"International Organization for Standardization",
114
+ :revdate=>"2016-05-01",
115
+ :revdate_monthyear=>"May 2016",
116
+ :sc=>"SC 4",
117
+ :secretariat=>"GB",
118
+ :stage=>"30",
119
+ :stage_int=>30,
120
+ :stageabbr=>"CD",
121
+ :statusabbr=>"PreCD3",
122
+ :tc=>"TC 34",
123
+ :tc_docnumber=>["17301", "17302"],
124
+ :unpublished=>true,
125
+ :wg=>"WG 3"}
79
126
  OUTPUT
80
127
  end
81
128
 
@@ -97,8 +144,9 @@ OUTPUT
97
144
  <title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
98
145
  <title type="title-part" language="fr" format="text/plain">Riz</title>
99
146
  </title>
100
- <docidentifier type="iso">ISO/IEC/CD 17301-1-3</docidentifier>
147
+ <docidentifier type="ISO">ISO/IEC/CD 17301-1-3</docidentifier>
101
148
  <docidentifier type="iso-with-lang">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
149
+ <docidentifier type="iso-reference">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
102
150
  <docidentifier type="iso-tc">17301</docidentifier>
103
151
  <contributor>
104
152
  <role type="author"/>
@@ -155,7 +203,45 @@ OUTPUT
155
203
  </bibdata>
156
204
  </iso-standard>
157
205
  INPUT
158
- {:agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :docnumber=>"ISO/IEC/CD 17301-1-3", :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)", :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=>"International Standard", :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=>"60", :stage_int=>60, :statusabbr=>"IS", :tc=>"ABC 34", :tc_docnumber=>["17301"], :unpublished=>false, :wg=>"GHI 3"}
206
+ {:agency=>"ISO/IEC",
207
+ :authors=>[],
208
+ :authors_affiliations=>{},
209
+ :docnumber=>"ISO/IEC/CD 17301-1-3",
210
+ :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
211
+ :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
212
+ :docnumeric=>nil,
213
+ :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",
214
+ :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses",
215
+ :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai",
216
+ :docsubtitlepart=>"Riz",
217
+ :docsubtitlepartlabel=>"Partie&nbsp;1&ndash;3",
218
+ :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice",
219
+ :doctitleintro=>"Cereals and pulses",
220
+ :doctitlemain=>"Specifications and test methods",
221
+ :doctitlepart=>"Rice",
222
+ :doctitlepartlabel=>"Part&nbsp;1&ndash;3",
223
+ :doctype=>"International Standard",
224
+ :docyear=>"2016",
225
+ :draft=>nil,
226
+ :draftinfo=>"",
227
+ :edition=>nil,
228
+ :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
229
+ :ics=>"1.2.3, 1.2.3",
230
+ :keywords=>[],
231
+ :obsoletes=>"IEC 8121",
232
+ :obsoletes_part=>"3.1",
233
+ :publisher=>"International Organization for Standardization and International Electrotechnical Commission",
234
+ :revdate=>nil,
235
+ :revdate_monthyear=>nil,
236
+ :sc=>"DEF 4",
237
+ :secretariat=>"XXXX",
238
+ :stage=>"60",
239
+ :stage_int=>60,
240
+ :statusabbr=>"IS",
241
+ :tc=>"ABC 34",
242
+ :tc_docnumber=>["17301"],
243
+ :unpublished=>false,
244
+ :wg=>"GHI 3"}
159
245
  OUTPUT
160
246
  end
161
247
 
@@ -292,25 +292,25 @@ RSpec.describe IsoDoc do
292
292
  <p class="zzSTDTitle1"></p>
293
293
  <div id="A">
294
294
  <h1 id="toc0">1&#xA0; Clause 4</h1>
295
- <a rel="footnote" href="#fn:3" epub:type="footnote" id="fnref:1">
295
+ <a href="#fn:3" class="FootnoteRef" id="fnref:1">
296
296
  <sup>1)</sup>
297
297
  </a>
298
298
  <div id="N">
299
299
 
300
- <h2 id="toc1">1.1&#xA0; Introduction to this<a rel="footnote" href="#fn:2" epub:type="footnote" id="fnref:2"><sup>2)</sup></a></h2>
300
+ <h2 id="toc1">1.1&#xA0; Introduction to this<a href="#fn:2" class="FootnoteRef" id="fnref:2"><sup>2)</sup></a></h2>
301
301
  </div>
302
302
  <div id="O">
303
303
  <h2 id="toc2">1.2&#xA0; Clause 4.2</h2>
304
- <p>A<a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2)</sup></a></p>
304
+ <p>A<a class="FootnoteRef" href="#fn:2"><sup>2)</sup></a></p>
305
305
  </div>
306
306
  </div>
307
307
  <aside id="fn:3" class="footnote">
308
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a rel="footnote" href="#fn:3" epub:type="footnote">
308
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a class="FootnoteRef" href="#fn:3">
309
309
  <sup>1)</sup>
310
310
  </a>This is a footnote.</p>
311
311
  <a href="#fnref:1">&#x21A9;</a></aside>
312
312
  <aside id="fn:2" class="footnote">
313
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2)</sup></a>Formerly denoted as 15 % (m/m).</p>
313
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a href="#fn:2" class="FootnoteRef"><sup>2)</sup></a>Formerly denoted as 15 % (m/m).</p>
314
314
  <a href="#fnref:2">&#x21A9;</a></aside>
315
315
 
316
316
  </main>
@@ -353,7 +353,7 @@ RSpec.describe IsoDoc do
353
353
  Clause 4
354
354
  </h1>
355
355
  <span style='mso-bookmark:_Ref'>
356
- <a href='#_ftn1' epub:type='footnote' style='mso-footnote-id:ftn1' name='_ftnref1' title='' id='_ftnref1'>
356
+ <a href='#_ftn1' class='FootnoteRef' epub:type='footnote' style='mso-footnote-id:ftn1' name='_ftnref1' title='' id='_ftnref1'>
357
357
  <span class='MsoFootnoteReference'>
358
358
  <span style='mso-special-character:footnote'/>
359
359
  </span>
@@ -367,7 +367,7 @@ RSpec.describe IsoDoc do
367
367
  <span style='mso-tab-count:1'>&#xA0; </span>
368
368
  Introduction to this
369
369
  <span style='mso-bookmark:_Ref'>
370
- <a href='#_ftn2' epub:type='footnote' style='mso-footnote-id:ftn2' name='_ftnref2' title='' id='_ftnref2'>
370
+ <a href='#_ftn2' epub:type='footnote' class='FootnoteRef' style='mso-footnote-id:ftn2' name='_ftnref2' title='' id='_ftnref2'>
371
371
  <span class='MsoFootnoteReference'>
372
372
  <span style='mso-special-character:footnote'/>
373
373
  </span>
@@ -386,7 +386,7 @@ RSpec.describe IsoDoc do
386
386
  <p class='MsoNormal'>
387
387
  A
388
388
  <span style='mso-bookmark:_Ref'>
389
- <a href='#_ftn3' epub:type='footnote' style='mso-footnote-id:ftn3' name='_ftnref3' title='' id='_ftnref3'>
389
+ <a href='#_ftn3' class='FootnoteRef' epub:type='footnote' style='mso-footnote-id:ftn3' name='_ftnref3' title='' id='_ftnref3'>
390
390
  <span class='MsoFootnoteReference'>
391
391
  <span style='mso-special-character:footnote'/>
392
392
  </span>
@@ -678,8 +678,8 @@ documentation.

678
678
  </iso-standard>
679
679
  INPUT
680
680
  word = File.read("test.html", encoding: "UTF-8")
681
- expect(xmlpp(word)).to include "<h1 class='IntroTitle'>Warning for Stuff</h1>"
682
- expect(xmlpp(word)).to include "I am the Walrus."
681
+ expect((word)).to include '<h1 class="IntroTitle">Warning for Stuff</h1>'
682
+ expect((word)).to include "I am the Walrus."
683
683
  end
684
684
 
685
685
  it "processes boilerplate (Word)" do
@@ -730,7 +730,7 @@ end
730
730
  <a name='boilerplate-place' id='boilerplate-place'/>
731
731
  Dilbert Associates
732
732
  </p>
733
- <p align='left' style='text-align:left' class='zzAddress'>
733
+ <p align='left' style='text-align:left;' class='zzAddress'>
734
734
  <a name='boilerplate-address' id='boilerplate-address'/>
735
735
  Elbonia 5000
736
736
  </p>
@@ -740,109 +740,4 @@ end
740
740
  expect(word).to include '<p class="zzWarning">I am the Walrus</p>'
741
741
  end
742
742
 
743
- it "skips internal hyperlinks" do
744
- FileUtils.rm_f "test.html"
745
- FileUtils.rm_f "test.doc"
746
- IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
747
- <iso-standard xmlns="http://riboseinc.com/isoxml">
748
- <preface>
749
- <foreword>
750
- <p>
751
- <xref target="scope"/>
752
- <xref target="terms"/>
753
- <xref target="_waxy_rice"/>
754
- <xref target="N"/>
755
- <xref target="N1"/>
756
- <xref target="N2"/>
757
- <xref target="N3"/>
758
- <xref target="N4"/>
759
- <xref target="N5"/>
760
- <xref target="N6"/>
761
- <xref target="N7"/>
762
- <xref target="N8"/>
763
- <xref target="N9"/>
764
- <xref target="N10"/>
765
- <eref bibitemid="ISO712"/>
766
- </p>
767
- </foreword>
768
- </preface>
769
- <sections>
770
- <clause id="scope"><title>Scope</title>
771
- <note id="N">
772
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
773
- </note>
774
- <figure id="N1">
775
- <name>Split-it-right sample divider</name>
776
- </figure>
777
- <example id="N2">
778
- <p>Hello</p>
779
- </example>
780
- <formula id="N3">
781
- <stem type="AsciiMath">r = 1 %</stem>
782
- </formula>
783
- <table id="N4">
784
- <name>Repeatability and reproducibility of husked rice yield</name>
785
- <tbody>
786
- <tr>
787
- <td align="left">Number of laboratories retained after eliminating outliers</td>
788
- <td align="center">13</td>
789
- <td align="center">11</td>
790
- </tr>
791
- </tbody>
792
- </table>
793
- <ol id="N6">
794
- <li id="N7"><p>A</p></li>
795
- </ol>
796
- <requirement id="N8">
797
- <stem type="AsciiMath">r = 1 %</stem>
798
- </requirement>
799
- <recommendation id="N9">
800
- <stem type="AsciiMath">r = 1 %</stem>
801
- </requirement>
802
- <permission id="N10">
803
- <stem type="AsciiMath">r = 1 %</stem>
804
- </requirement>
805
- </clause>
806
- <terms id="terms">
807
- <term id="_waxy_rice"><preferred>waxy rice</preferred>
808
- <termnote id="N5">
809
- <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
810
- </termnote></term>
811
- </terms>
812
- </sections>
813
- <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
814
- <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>
815
- <bibitem id="ISO712" type="standard">
816
- <title format="text/plain">Cereals or cereal products</title>
817
- <title type="main" format="text/plain">Cereals and cereal products</title>
818
- <docidentifier type="ISO">ISO 712</docidentifier>
819
- <contributor>
820
- <role type="publisher"/>
821
- <organization>
822
- <name>International Organization for Standardization</name>
823
- </organization>
824
- </contributor>
825
- </bibitem>
826
- </references>
827
- </bibliography>
828
- </iso-standard>
829
- INPUT
830
- expect(File.exist?("test.html")).to be true
831
- html = File.read("test.html", encoding: "UTF-8").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
832
- sub(%r{</main>.*$}m, "</main>").sub(%r{^.*?<div>}m, "<div>").sub(%r{</div>.*$}m, "</div>")
833
- expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
834
- <div>
835
- <h1 class='ForewordTitle' id="toc0">Foreword</h1>
836
- <p>
837
- <a href='#scope'>Clause 1</a>
838
- <a href='#terms'>Clause 3</a>
839
- <a href='#_waxy_rice'>3.1</a>
840
- Clause 1, Note Figure 1 Clause 1, Example Clause 1, Formula (1) Table 1
841
- 3.1, Note 1 Clause 1, List Clause 1 a) Clause 1, Requirement 1 Clause 1,
842
- Recommendation 1 Clause 1, Permission 1
843
- <a href='#ISO712'>ISO 712</a>
844
- </p>
845
- </div>
846
- OUTPUT
847
- end
848
743
  end