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
@@ -15,7 +15,7 @@ RSpec.describe Asciidoctor::ISO do
15
15
  INPUT
16
16
  #{BLANK_HDR}
17
17
  <sections>
18
- </sections><bibliography><references id="_" obligation="informative">
18
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
19
19
  <title>Normative References</title>
20
20
  <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>
21
21
  <bibitem id="iso123" type="standard">
@@ -32,7 +32,7 @@ RSpec.describe Asciidoctor::ISO do
32
32
  <abbreviation>ISO</abbreviation>
33
33
  </organization>
34
34
  </contributor>
35
- <note format="text/plain">ISO DATE: The standard is in press</note>
35
+ <note format="text/plain" type="ISO DATE">The standard is in press</note>
36
36
  </bibitem>
37
37
  </references>
38
38
  </bibliography>
@@ -64,7 +64,7 @@ RSpec.describe Asciidoctor::ISO do
64
64
  </p>
65
65
  </clause>
66
66
  </sections>
67
- <bibliography><references id="_" obligation="informative">
67
+ <bibliography><references id="_" obligation="informative" normative="true">
68
68
  <title>Normative References</title>
69
69
  <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>
70
70
  <bibitem id="iso123" type="standard">
@@ -100,7 +100,7 @@ RSpec.describe Asciidoctor::ISO do
100
100
  #{BLANK_HDR}
101
101
  <sections>
102
102
 
103
- </sections><bibliography><references id="_" obligation="informative">
103
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
104
104
  <title>Normative References</title>
105
105
  <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>
106
106
  <bibitem id="iso123">
@@ -127,7 +127,7 @@ RSpec.describe Asciidoctor::ISO 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="false">
131
131
  <title>Bibliography</title>
132
132
  <bibitem id="iso123">
133
133
  <formattedref format="application/x-isodoc+xml">
@@ -84,7 +84,7 @@ standardization at the following addresses:

84
84
  <link target="http://www.electropedia.org"/>
85
85
  </p> </li> </ul>
86
86
 
87
- <term id="_">
87
+ <term id="term-term1">
88
88
  <preferred>Term1</preferred>
89
89
  </term>
90
90
  </terms>
@@ -109,7 +109,7 @@ standardization at the following addresses:

109
109
  </li>
110
110
  </ul>
111
111
  <title>Normal Terms</title>
112
- <term id="_">
112
+ <term id="term-term2">
113
113
  <preferred>Term2</preferred>
114
114
  </term>
115
115
  </terms>
@@ -133,12 +133,12 @@ standardization at the following addresses:

133
133
  </clause>
134
134
  <appendix id="_" inline-header="false" obligation="normative">
135
135
  <title>Appendix 1</title>
136
- </appendix></annex><bibliography><references id="_" obligation="informative">
136
+ </appendix></annex><bibliography><references id="_" obligation="informative" normative="true">
137
137
  <title>Normative References</title>
138
138
  <p id="_">There are no normative references in this document.</p>
139
139
  </references><clause id="_" obligation="informative">
140
140
  <title>Bibliography</title>
141
- <references id="_" obligation="informative">
141
+ <references id="_" obligation="informative" normative="false">
142
142
  <title>Bibliography Subsection</title>
143
143
  </references>
144
144
  </clause>
@@ -247,7 +247,7 @@ standardization at the following addresses:

247
247
  <p id="_">Foreword</p>
248
248
  </foreword></preface><sections>
249
249
  <terms id="_" obligation="normative">
250
- <title>Terms and definitions</title><p id="_">For the purposes of this document, the terms and definitions
250
+ <title>Terms and definitions</title><p id="_">For the purposes of this document, the terms and definitions
251
251
  given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> and the following apply.</p>
252
252
  <p id="_">ISO and IEC maintain terminological databases for use in
253
253
  standardization at the following addresses:</p>
@@ -259,7 +259,7 @@ standardization at the following addresses:

259
259
  <link target="http://www.electropedia.org"/>
260
260
  </p> </li> </ul>
261
261
 
262
- <term id="_">
262
+ <term id="term-term1">
263
263
  <preferred>Term1</preferred>
264
264
  </term>
265
265
  </terms></sections>
@@ -296,13 +296,13 @@ standardization at the following addresses:

296
296
  <ul id='_'>
297
297
  <li>
298
298
  <p id='_'>
299
- ISO Online browsing platform: available at
299
+ ISO Online browsing platform: available at
300
300
  <link target='http://www.iso.org/obp'/>
301
301
  </p>
302
302
  </li>
303
303
  <li>
304
304
  <p id='_'>
305
- IEC Electropedia: available at
305
+ IEC Electropedia: available at
306
306
  <link target='http://www.electropedia.org'/>
307
307
  </p>
308
308
  </li>
@@ -150,7 +150,7 @@ RSpec.describe Asciidoctor::ISO do
150
150
  <tr>
151
151
  <th rowspan="2" align="left">Defect</th>
152
152
  <th colspan="4" align="center">Maximum permissible mass fraction of defects in husked rice<br/>
153
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>w</mi><mi>max</mi></msub></math></stem></th>
153
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>w</mi><mo>max</mo></msub></math></stem></th>
154
154
  </tr>
155
155
  <tr>
156
156
  <th align="left">in husked rice</th>
@@ -0,0 +1,652 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "cross-references notes in amendments" do
5
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <bibdata> <ext> <doctype>amendment</doctype> </ext> </bibdata>
8
+ <preface>
9
+ <foreword>
10
+ <p>
11
+ <xref target="N"/>
12
+ <xref target="note1"/>
13
+ <xref target="note2"/>
14
+ <xref target="AN"/>
15
+ <xref target="Anote1"/>
16
+ <xref target="Anote2"/>
17
+ </p>
18
+ </foreword>
19
+ </preface>
20
+ <sections>
21
+ <clause id="scope"><title>Scope</title>
22
+ <note id="N">
23
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
24
+ </note>
25
+ <p><xref target="N"/></p>
26
+
27
+ </clause>
28
+ <terms id="terms"/>
29
+ <clause id="widgets"><title>Widgets</title>
30
+ <clause id="widgets1">
31
+ <note id="note1">
32
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
33
+ </note>
34
+ <note id="note2">
35
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
36
+ </note>
37
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
38
+
39
+ </clause>
40
+ </clause>
41
+ </sections>
42
+ <annex id="annex1">
43
+ <clause id="annex1a">
44
+ <note id="AN">
45
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
46
+ </note>
47
+ </clause>
48
+ <clause id="annex1b">
49
+ <note id="Anote1">
50
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
51
+ </note>
52
+ <note id="Anote2">
53
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
54
+ </note>
55
+ </clause>
56
+ </annex>
57
+ </iso-standard>
58
+ INPUT
59
+ #{HTML_HDR}
60
+ <br/>
61
+ <div>
62
+ <h1 class="ForewordTitle">Foreword</h1>
63
+ <p>
64
+ <a href="#N">[N]</a>
65
+ <a href="#note1">[note1]</a>
66
+ <a href="#note2">[note2]</a>
67
+ <a href="#AN">A.1, Note</a>
68
+ <a href="#Anote1">A.2, Note 1</a>
69
+ <a href="#Anote2">A.2, Note 2</a>
70
+ </p>
71
+ </div>
72
+ <p class="zzSTDTitle1"/>
73
+ <div id="scope">
74
+ <h1>Scope</h1>
75
+ <div id="N" class="Note">
76
+ <p><span class="note_label">NOTE</span>&#160; These results are based on a study carried out on three different types of kernel.</p>
77
+ </div>
78
+ <p>
79
+ <a href="#N">[n]</a>
80
+ </p>
81
+ </div>
82
+ <div id="terms"><h1/>
83
+ </div>
84
+ <div id="widgets">
85
+ <h1>Widgets</h1>
86
+ <div id="widgets1"><span class='zzMoveToFollowing'><b/></span>
87
+ <div id="note1" class="Note"><p><span class="note_label">NOTE</span>&#160; These results are based on a study carried out on three different types of kernel.</p></div>
88
+ <div id="note2" class="Note"><p><span class="note_label">NOTE</span>&#160; These results are based on a study carried out on three different types of kernel.</p></div>
89
+ <p> <a href="#note1">[note1]</a> <a href="#note2">[note2]</a> </p>
90
+
91
+ </div>
92
+ </div>
93
+ <br/>
94
+ <div id="annex1" class="Section3">
95
+ <h1 class='Annex'>
96
+ <b>Annex A</b>
97
+ <br/>
98
+ (informative)
99
+ <br/>
100
+ <br/>
101
+ <b/>
102
+ </h1>
103
+ <div id="annex1a"><span class='zzMoveToFollowing'><b>A.1&#160; </b></span>
104
+ <div id="AN" class="Note"><p><span class="note_label">NOTE</span>&#160; These results are based on a study carried out on three different types of kernel.</p></div>
105
+ </div>
106
+ <div id="annex1b"><span class='zzMoveToFollowing'><b>A.2&#160; </b></span>
107
+ <div id="Anote1" class="Note"><p><span class="note_label">NOTE 1</span>&#160; These results are based on a study carried out on three different types of kernel.</p></div>
108
+ <div id="Anote2" class="Note"><p><span class="note_label">NOTE 2</span>&#160; These results are based on a study carried out on three different types of kernel.</p></div>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </body>
113
+ </html>
114
+ OUTPUT
115
+ end
116
+
117
+ it "cross-references sections" do
118
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
119
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
120
+ <bibdata> <ext> <doctype>amendment</doctype> </ext> </bibdata>
121
+ <preface>
122
+ <foreword obligation="informative">
123
+ <title>Foreword</title>
124
+ <p id="A">This is a preamble
125
+ <xref target="C"/>
126
+ <xref target="C1"/>
127
+ <xref target="D"/>
128
+ <xref target="H"/>
129
+ <xref target="I"/>
130
+ <xref target="J"/>
131
+ <xref target="K"/>
132
+ <xref target="L"/>
133
+ <xref target="M"/>
134
+ <xref target="N"/>
135
+ <xref target="O"/>
136
+ <xref target="P"/>
137
+ <xref target="Q"/>
138
+ <xref target="Q1"/>
139
+ <xref target="Q2"/>
140
+ <xref target="R"/>
141
+ </p>
142
+ </foreword>
143
+ <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
144
+ <title>Introduction Subsection</title>
145
+ </clause>
146
+ <clause id="C1" inline-header="false" obligation="informative">Text</clause>
147
+ </introduction></preface><sections>
148
+ <clause id="D" obligation="normative">
149
+ <title>Scope</title>
150
+ <p id="E">Text</p>
151
+ </clause>
152
+
153
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
154
+ <title>Introduction</title>
155
+ </clause>
156
+ <clause id="O" inline-header="false" obligation="normative">
157
+ <title>Clause 4.2</title>
158
+ </clause></clause>
159
+
160
+ </sections><annex id="P" inline-header="false" obligation="normative">
161
+ <title>Annex</title>
162
+ <clause id="Q" inline-header="false" obligation="normative">
163
+ <title>Annex A.1</title>
164
+ <clause id="Q1" inline-header="false" obligation="normative">
165
+ <title>Annex A.1a</title>
166
+ </clause>
167
+ </clause>
168
+ <appendix id="Q2" inline-header="false" obligation="normative">
169
+ <title>An Appendix</title>
170
+ </appendix>
171
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
172
+ <title>Normative References</title>
173
+ </references><clause id="S" obligation="informative">
174
+ <title>Bibliography</title>
175
+ <references id="T" obligation="informative" normative="false">
176
+ <title>Bibliography Subsection</title>
177
+ </references>
178
+ </clause>
179
+ </bibliography>
180
+ </iso-standard>
181
+ INPUT
182
+ #{HTML_HDR}
183
+ <br/>
184
+ <div>
185
+ <h1 class="ForewordTitle">Foreword</h1>
186
+ <p id="A">This is a preamble
187
+ <a href='#C'>[C]</a>
188
+ <a href='#C1'>[C1]</a>
189
+ <a href='#D'>[D]</a>
190
+ <a href='#H'>[H]</a>
191
+ <a href='#I'>[I]</a>
192
+ <a href='#J'>[J]</a>
193
+ <a href='#K'>[K]</a>
194
+ <a href='#L'>[L]</a>
195
+ <a href='#M'>[M]</a>
196
+ <a href='#N'>[N]</a>
197
+ <a href='#O'>[O]</a>
198
+ <a href='#P'>Annex A</a>
199
+ <a href='#Q'>A.1</a>
200
+ <a href='#Q1'>A.1.1</a>
201
+ <a href='#Q2'>Annex A, Appendix 1</a>
202
+ <a href='#R'>[R]</a>
203
+ </p>
204
+ </div>
205
+ <br/>
206
+ <div class="Section3" id="B">
207
+ <h1 class="IntroTitle">Introduction</h1>
208
+ <div id="C">
209
+ <h1>Introduction Subsection</h1>
210
+ </div>
211
+ <div id="C1"><span class='zzMoveToFollowing'>
212
+ <b/>
213
+ </span>
214
+ Text</div>
215
+ </div>
216
+ <p class="zzSTDTitle1"/>
217
+ <div id="D">
218
+ <h1>Scope</h1>
219
+ <p id="E">Text</p>
220
+ </div>
221
+ <div>
222
+ <h1>Normative references</h1>
223
+ </div>
224
+ <div id="M">
225
+ <h1>Clause 4</h1>
226
+ <div id="N">
227
+ <h1>Introduction</h1>
228
+ </div>
229
+ <div id="O">
230
+ <h1>Clause 4.2</h1>
231
+ </div>
232
+ </div>
233
+ <br/>
234
+ <div id="P" class="Section3">
235
+ <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
236
+ <div id="Q">
237
+ <h2>A.1&#160; Annex A.1</h2>
238
+ <div id="Q1">
239
+ <h3>A.1.1&#160; Annex A.1a</h3>
240
+ </div>
241
+ </div>
242
+ <div id="Q2">
243
+ <h2>Appendix 1&#160; An Appendix</h2>
244
+ </div>
245
+ </div>
246
+ <br/>
247
+ <div>
248
+ <h1 class="Section3">Bibliography</h1>
249
+ <div>
250
+ <h2 class="Section3">Bibliography Subsection</h2>
251
+ </div>
252
+ </div>
253
+ </div>
254
+ </body>
255
+ </html>
256
+ OUTPUT
257
+ end
258
+
259
+ it "processes section names" do
260
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
261
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
262
+ <bibdata> <ext> <doctype>amendment</doctype> </ext> </bibdata>
263
+ <boilerplate>
264
+ <copyright-statement>
265
+ <clause>
266
+ <title>Copyright</title>
267
+ </clause>
268
+ </copyright-statement>
269
+ <license-statement>
270
+ <clause>
271
+ <title>License</title>
272
+ </clause>
273
+ </license-statement>
274
+ <legal-statement>
275
+ <clause>
276
+ <title>Legal</title>
277
+ </clause>
278
+ </legal-statement>
279
+ <feedback-statement>
280
+ <clause>
281
+ <title>Feedback</title>
282
+ </clause>
283
+ </feedback-statement>
284
+ </boilerplate>
285
+ <preface>
286
+ <abstract obligation="informative">
287
+ <title>Foreword</title>
288
+ </abstract>
289
+ <foreword obligation="informative">
290
+ <title>Foreword</title>
291
+ <p id="A">This is a preamble</p>
292
+ </foreword>
293
+ <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
294
+ <title>Introduction Subsection</title>
295
+ </clause>
296
+ </introduction>
297
+ <clause id="B1"><title>Dedication</title></clause>
298
+ <clause id="B2"><title>Note to reader</title></clause>
299
+ <acknowledgements obligation="informative">
300
+ <title>Acknowledgements</title>
301
+ </acknowledgements>
302
+ </preface><sections>
303
+ <clause id="D" obligation="normative">
304
+ <title>Scope</title>
305
+ <p id="E">Text</p>
306
+ </clause>
307
+
308
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
309
+ <title>Introduction</title>
310
+ </clause>
311
+ <clause id="O" inline-header="false" obligation="normative">
312
+ <title>Clause 4.2</title>
313
+ </clause>
314
+ <clause id="O1" inline-header="false" obligation="normative">
315
+ </clause>
316
+ </clause>
317
+
318
+ </sections><annex id="P" inline-header="false" obligation="normative">
319
+ <title>Annex</title>
320
+ <clause id="Q" inline-header="false" obligation="normative">
321
+ <title>Annex A.1</title>
322
+ <clause id="Q1" inline-header="false" obligation="normative">
323
+ <title>Annex A.1a</title>
324
+ </clause>
325
+ <references id="Q2" normative="false"><title>Annex Bibliography</title></references>
326
+ </clause>
327
+ </annex>
328
+ <annex id="P1" inline-header="false" obligation="normative">
329
+ </annex>
330
+ <bibliography><references id="R" obligation="informative" normative="true">
331
+ <title>Normative References</title>
332
+ </references><clause id="S" obligation="informative">
333
+ <title>Bibliography</title>
334
+ <references id="T" obligation="informative" normative="false">
335
+ <title>Bibliography Subsection</title>
336
+ </references>
337
+ </clause>
338
+ </bibliography>
339
+ </iso-standard>
340
+ INPUT
341
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
342
+ <head/>
343
+ <body lang='en'>
344
+ <div class='title-section'>
345
+ <p>&#160;</p>
346
+ </div>
347
+ <br/>
348
+ <div class='prefatory-section'>
349
+ <p>&#160;</p>
350
+ </div>
351
+ <br/>
352
+ <div class='main-section'>
353
+ <div class='authority'>
354
+ <div class='boilerplate-copyright'>
355
+ <div>
356
+ <h1>Copyright</h1>
357
+ </div>
358
+ </div>
359
+ <div class='boilerplate-license'>
360
+ <div>
361
+ <h1>License</h1>
362
+ </div>
363
+ </div>
364
+ <div class='boilerplate-legal'>
365
+ <div>
366
+ <h1>Legal</h1>
367
+ </div>
368
+ </div>
369
+ <div class='boilerplate-feedback'>
370
+ <div>
371
+ <h1>Feedback</h1>
372
+ </div>
373
+ </div>
374
+ </div>
375
+ <br/>
376
+ <div>
377
+ <h1 class='AbstractTitle'>Abstract</h1>
378
+ </div>
379
+ <br/>
380
+ <div>
381
+ <h1 class='ForewordTitle'>Foreword</h1>
382
+ <p id='A'>This is a preamble</p>
383
+ </div>
384
+ <br/>
385
+ <div class='Section3' id='B'>
386
+ <h1 class='IntroTitle'>Introduction</h1>
387
+ <div id='C'>
388
+ <h1>Introduction Subsection</h1>
389
+ </div>
390
+ </div>
391
+ <br/>
392
+ <div class='Section3' id='B1'>
393
+ <h1 class='IntroTitle'>Dedication</h1>
394
+ </div>
395
+ <br/>
396
+ <div class='Section3' id='B2'>
397
+ <h1 class='IntroTitle'>Note to reader</h1>
398
+ </div>
399
+ <br/>
400
+ <div class='Section3' id=''>
401
+ <h1 class='IntroTitle'>Acknowledgements</h1>
402
+ </div>
403
+ <p class='zzSTDTitle1'/>
404
+ <div id='D'>
405
+ <h1>Scope</h1>
406
+ <p id='E'>Text</p>
407
+ </div>
408
+ <div>
409
+ <h1>Normative references</h1>
410
+ </div>
411
+ <div id='M'>
412
+ <h1>Clause 4</h1>
413
+ <div id='N'>
414
+ <h1>Introduction</h1>
415
+ </div>
416
+ <div id='O'>
417
+ <h1>Clause 4.2</h1>
418
+ </div>
419
+ <div id='O1'>
420
+ <span class='zzMoveToFollowing'>
421
+ <b/>
422
+ </span>
423
+ </div>
424
+ </div>
425
+ <br/>
426
+ <div id='P' class='Section3'>
427
+ <h1 class='Annex'>
428
+ <b>Annex A</b>
429
+ <br/>
430
+ (normative)
431
+ <br/>
432
+ <br/>
433
+ <b>Annex</b>
434
+ </h1>
435
+ <div id='Q'>
436
+ <h2>A.1&#160; Annex A.1</h2>
437
+ <div id='Q1'>
438
+ <h3>A.1.1&#160; Annex A.1a</h3>
439
+ </div>
440
+ <div>
441
+ <h3>A.1.2&#160; Annex Bibliography</h3>
442
+ </div>
443
+ </div>
444
+ </div>
445
+ <br/>
446
+ <div id='P1' class='Section3'>
447
+ <h1 class='Annex'>
448
+ <b>Annex B</b>
449
+ <br/>
450
+ (normative)
451
+ <br/>
452
+ <br/>
453
+ <b/>
454
+ </h1>
455
+ </div>
456
+ <br/>
457
+ <div>
458
+ <h1 class='Section3'>Bibliography</h1>
459
+ <div>
460
+ <h2 class='Section3'>Bibliography Subsection</h2>
461
+ </div>
462
+ </div>
463
+ </div>
464
+ </body>
465
+ </html>
466
+ OUTPUT
467
+ end
468
+
469
+ it "processes IsoXML metadata" do
470
+ c = IsoDoc::Iso::HtmlConvert.new({})
471
+ arr = c.convert_init(<<~"INPUT", "test", false)
472
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
473
+ INPUT
474
+ expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT"
475
+ <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
476
+ <bibdata type='standard'>
477
+ <title language='en' format='text/plain' type='main'>Introduction — Main Title — Title — Title Part  — Mass fraction of
478
+ extraneous matter, milled rice (nonglutinous), sample dividers and
479
+ recommendations relating to storage and transport conditions</title>
480
+ <title language='en' format='text/plain' type='title-intro'>Introduction</title>
481
+ <title language='en' format='text/plain' type='title-main'>Main Title — Title</title>
482
+ <title language='en' format='text/plain' type='title-part'>Title Part</title>
483
+ <title language='en' format='text/plain' type='title-amd'>Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions</title>
484
+ <title language='fr' format='text/plain' type='main'>
485
+ Introduction Française — Titre Principal — Part du Titre — Fraction
486
+ massique de matière étrangère, riz usiné (non gluant), diviseurs
487
+ d’échantillon et recommandations relatives aux conditions d’entreposage et
488
+ de transport
489
+ </title>
490
+ <title language='fr' format='text/plain' type='title-intro'>Introduction Française</title>
491
+ <title language='fr' format='text/plain' type='title-main'>Titre Principal</title>
492
+ <title language='fr' format='text/plain' type='title-part'>Part du Titre</title>
493
+ <title language='fr' format='text/plain' type='title-amd'>Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs d’échantillon et recommandations relatives aux conditions d’entreposage et de transport</title>
494
+ <docidentifier type='ISO'>ISO/PreNWIP3 17301-1:2016/Amd.1</docidentifier>
495
+ <docidentifier type='iso-with-lang'>ISO/PreNWIP3 17301-1:2016/Amd.1(E)</docidentifier>
496
+ <docidentifier type='iso-reference'>ISO/PreNWIP3 17301-1:2016/Amd.1:2017(E)</docidentifier>
497
+ <docnumber>17301</docnumber>
498
+ <date type='created'>
499
+ <on>2016-05-01</on>
500
+ </date>
501
+ <contributor>
502
+ <role type='author'/>
503
+ <organization>
504
+ <name>International Organization for Standardization</name>
505
+ <abbreviation>ISO</abbreviation>
506
+ </organization>
507
+ </contributor>
508
+ <contributor>
509
+ <role type='publisher'/>
510
+ <organization>
511
+ <name>International Organization for Standardization</name>
512
+ <abbreviation>ISO</abbreviation>
513
+ </organization>
514
+ </contributor>
515
+ <edition>2</edition>
516
+ <version>
517
+ <revision-date>2000-01-01</revision-date>
518
+ <draft>0.3.4</draft>
519
+ </version>
520
+ <language>en</language>
521
+ <script>Latn</script>
522
+ <status>
523
+ <stage abbreviation='NWIP'>10</stage>
524
+ <substage>20</substage>
525
+ <iteration>3</iteration>
526
+ </status>
527
+ <copyright>
528
+ <from>2017</from>
529
+ <owner>
530
+ <organization>
531
+ <name>International Organization for Standardization</name>
532
+ <abbreviation>ISO</abbreviation>
533
+ </organization>
534
+ </owner>
535
+ </copyright>
536
+ <ext>
537
+ <doctype>amendment</doctype>
538
+ <editorialgroup>
539
+ <technical-committee number='1' type='A'>TC</technical-committee>
540
+ <technical-committee number='11' type='A1'>TC1</technical-committee>
541
+ <subcommittee number='2' type='B'>SC</subcommittee>
542
+ <subcommittee number='21' type='B1'>SC1</subcommittee>
543
+ <workgroup number='3' type='C'>WG</workgroup>
544
+ <workgroup number='31' type='C1'>WG1</workgroup>
545
+ <secretariat>SECRETARIAT</secretariat>
546
+ </editorialgroup>
547
+ <ics>
548
+ <code>1</code>
549
+ </ics>
550
+ <ics>
551
+ <code>2</code>
552
+ </ics>
553
+ <ics>
554
+ <code>3</code>
555
+ </ics>
556
+ <structuredidentifier>
557
+ <project-number part='1' amendment='1' corrigendum='2' origyr='2016-05-01'>17301</project-number>
558
+ </structuredidentifier>
559
+ <stagename>New work item proposal</stagename>
560
+ <updates-document-type>international-standard</updates-document-type>
561
+ </ext>
562
+ </bibdata>
563
+ <sections/>
564
+ </iso-standard>
565
+ INPUT
566
+ {:agency=>"ISO",
567
+ :authors=>[],
568
+ :authors_affiliations=>{},
569
+ :createddate=>"2016-05-01",
570
+ :docnumber=>"ISO/PreNWIP3 17301-1:2016/Amd.1",
571
+ :docnumber_lang=>"ISO/PreNWIP3 17301-1:2016/Amd.1(E)",
572
+ :docnumber_reference=>"ISO/PreNWIP3 17301-1:2016/Amd.1:2017(E)",
573
+ :docnumeric=>"17301",
574
+ :docsubtitle=>"Introduction Fran&#xe7;aise&nbsp;&mdash; Titre Principal&nbsp;&mdash; Partie&nbsp;1: Part du Titre",
575
+ :docsubtitleamd=>"Fraction massique de mati&#xe8;re &#xe9;trang&#xe8;re, riz usin&#xe9; (non gluant), diviseurs d&#x2019;&#xe9;chantillon et recommandations relatives aux conditions d&#x2019;entreposage et de transport",
576
+ :docsubtitleamdlabel=>"AMENDMENT&nbsp;1",
577
+ :docsubtitlecorrlabel=>"RECTIFICATIF TECHNIQUE&nbsp;2",
578
+ :docsubtitleintro=>"Introduction Fran&#xe7;aise",
579
+ :docsubtitlemain=>"Titre Principal",
580
+ :docsubtitlepart=>"Part du Titre",
581
+ :docsubtitlepartlabel=>"Partie&nbsp;1",
582
+ :doctitle=>"Introduction&nbsp;&mdash; Main Title&#x2009;&#x2014;&#x2009;Title&nbsp;&mdash; Part&nbsp;1: Title Part",
583
+ :doctitleamd=>"Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions",
584
+ :doctitleamdlabel=>"AMENDMENT&nbsp;1",
585
+ :doctitlecorrlabel=>"TECHNICAL CORRIGENDUM&nbsp;2",
586
+ :doctitleintro=>"Introduction",
587
+ :doctitlemain=>"Main Title&#x2009;&#x2014;&#x2009;Title",
588
+ :doctitlepart=>"Title Part",
589
+ :doctitlepartlabel=>"Part&nbsp;1",
590
+ :doctype=>"Amendment",
591
+ :docyear=>"2017",
592
+ :draft=>"0.3.4",
593
+ :draftinfo=>" (draft 0.3.4, 2000-01-01)",
594
+ :edition=>"2",
595
+ :editorialgroup=>["A 1", "B 2", "C 3"],
596
+ :ics=>"1, 2, 3",
597
+ :keywords=>[],
598
+ :obsoletes=>nil,
599
+ :obsoletes_part=>nil,
600
+ :publisher=>"International Organization for Standardization",
601
+ :revdate=>"2000-01-01",
602
+ :revdate_monthyear=>"January 2000",
603
+ :sc=>"B 2",
604
+ :secretariat=>"SECRETARIAT",
605
+ :stage=>"10",
606
+ :stage_int=>10,
607
+ :stageabbr=>"NWIP",
608
+ :statusabbr=>"PreNWIP3",
609
+ :tc=>"A 1",
610
+ :tc_docnumber=>[],
611
+ :unpublished=>true,
612
+ :wg=>"C 3"}
613
+ OUTPUT
614
+ end
615
+
616
+ it "processes middle title" do
617
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
618
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
619
+ <bibdata>
620
+ <title language='en' format='text/plain' type='title-intro'>Introduction</title>
621
+ <title language='en' format='text/plain' type='title-main'>Main Title — Title</title>
622
+ <title language='en' format='text/plain' type='title-part'>Title Part</title>
623
+ <title language='en' format='text/plain' type='title-amd'>Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions</title>
624
+ <ext>
625
+ <structuredidentifier>
626
+ <project-number part='1' amendment='1' corrigendum='2' origyr='2016-05-01'>17301</project-number>
627
+ </structuredidentifier>
628
+ </ext>
629
+ </bibdata>
630
+ <sections/>
631
+ </iso-standard>
632
+ INPUT
633
+ #{HTML_HDR}
634
+ <p class='zzSTDTitle1'>Introduction &#8212; Main Title&#8201;&#8212;&#8201;Title &#8212; </p>
635
+ <p class='zzSTDTitle2'>
636
+ Part&#160;1:
637
+ <br/><b>Title Part</b>
638
+ </p>
639
+ <p class='zzSTDTitle2'>
640
+ AMENDMENT&#160;1: Mass fraction of extraneous matter, milled rice
641
+ (nonglutinous), sample dividers and recommendations relating to storage
642
+ and transport conditions
643
+ </p>
644
+ <p class='zzSTDTitle2'>TECHNICAL CORRIGENDUM&#160;2</p>
645
+ </div>
646
+ </body>
647
+ </html>
648
+ OUTPUT
649
+ end
650
+
651
+
652
+ end