metanorma-iso 1.3.24 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -1
  3. data/.github/workflows/ubuntu.yml +14 -3
  4. data/.github/workflows/windows.yml +8 -1
  5. data/lib/asciidoctor/iso/base.rb +21 -13
  6. data/lib/asciidoctor/iso/biblio.rng +36 -6
  7. data/lib/asciidoctor/iso/cleanup.rb +10 -1
  8. data/lib/asciidoctor/iso/front.rb +16 -110
  9. data/lib/asciidoctor/iso/front_id.rb +196 -0
  10. data/lib/asciidoctor/iso/isodoc.rng +444 -1
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +98 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +12 -1
  13. data/lib/asciidoctor/iso/reqt.rng +23 -0
  14. data/lib/asciidoctor/iso/section.rb +12 -0
  15. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +7 -10
  16. data/lib/asciidoctor/iso/validate.rb +40 -23
  17. data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
  18. data/lib/asciidoctor/iso/validate_style.rb +6 -5
  19. data/lib/asciidoctor/iso/validate_title.rb +1 -1
  20. data/lib/isodoc/iso/base_convert.rb +68 -87
  21. data/lib/isodoc/iso/html/header.html +5 -1
  22. data/lib/isodoc/iso/html/html_iso_titlepage.html +25 -16
  23. data/lib/isodoc/iso/html/isodoc.scss +25 -0
  24. data/lib/isodoc/iso/html/scripts.html +18 -0
  25. data/lib/isodoc/iso/html/style-human.scss +23 -0
  26. data/lib/isodoc/iso/html/style-iso.scss +18 -0
  27. data/lib/isodoc/iso/html/word_iso_intro.html +4 -0
  28. data/lib/isodoc/iso/html/word_iso_titlepage.html +21 -0
  29. data/lib/isodoc/iso/html/wordstyle.scss +45 -4
  30. data/lib/isodoc/iso/iso.amendment.xsl +5082 -0
  31. data/lib/isodoc/iso/iso.international-standard.xsl +1226 -530
  32. data/lib/isodoc/iso/metadata.rb +67 -23
  33. data/lib/isodoc/iso/pdf_convert.rb +5 -11
  34. data/lib/isodoc/iso/presentation_xml_convert.rb +13 -0
  35. data/lib/isodoc/iso/sections.rb +66 -0
  36. data/lib/isodoc/iso/sts_convert.rb +31 -0
  37. data/lib/isodoc/iso/xref.rb +111 -0
  38. data/lib/metanorma-iso.rb +2 -0
  39. data/lib/metanorma/iso/processor.rb +20 -9
  40. data/lib/metanorma/iso/version.rb +1 -1
  41. data/metanorma-iso.gemspec +5 -2
  42. data/spec/asciidoctor-iso/amd_spec.rb +726 -0
  43. data/spec/asciidoctor-iso/base_spec.rb +24 -20
  44. data/spec/asciidoctor-iso/cleanup_spec.rb +2 -2
  45. data/spec/asciidoctor-iso/macros_spec.rb +33 -17
  46. data/spec/asciidoctor-iso/refs_spec.rb +1 -1
  47. data/spec/asciidoctor-iso/table_spec.rb +1 -1
  48. data/spec/isodoc/amd_spec.rb +652 -0
  49. data/spec/isodoc/blocks_spec.rb +112 -27
  50. data/spec/isodoc/inline_spec.rb +2 -2
  51. data/spec/isodoc/metadata_spec.rb +88 -4
  52. data/spec/isodoc/postproc_spec.rb +11 -11
  53. data/spec/isodoc/ref_spec.rb +7 -7
  54. data/spec/isodoc/section_spec.rb +28 -1
  55. data/spec/isodoc/table_spec.rb +29 -29
  56. data/spec/isodoc/terms_spec.rb +4 -4
  57. data/spec/isodoc/xref_spec.rb +32 -26
  58. data/spec/metanorma/processor_spec.rb +2 -2
  59. data/spec/spec_helper.rb +11 -0
  60. metadata +61 -11
@@ -77,7 +77,7 @@ RSpec.describe Asciidoctor::ISO do
77
77
  :workgroup-number_2: 31
78
78
  :workgroup-type_2: C1
79
79
  :secretariat: SECRETARIAT
80
- :docstage: 10
80
+ :docstage: 20
81
81
  :docsubstage: 20
82
82
  :iteration: 3
83
83
  :language: en
@@ -101,10 +101,10 @@ RSpec.describe Asciidoctor::ISO do
101
101
  <title language="fr" format="text/plain" type="title-intro">Introduction Française</title>
102
102
  <title language="fr" format="text/plain" type="title-main">Titre Principal</title>
103
103
  <title language="fr" format="text/plain" type="title-part">Part du Titre</title>
104
- <docidentifier type="iso">ISO/PreNWIP3 1000-1</docidentifier>
105
- <docidentifier type='iso-with-lang'>ISO/PreNWIP3 1000-1(E)</docidentifier>
106
- <docidentifier type='iso-reference'>ISO/PreNWIP3 1000-1:2000(E)</docidentifier>
107
- <docnumber>1000</docnumber>
104
+ <docidentifier type="ISO">ISO/PreWD3 1000-1</docidentifier>
105
+ <docidentifier type='iso-with-lang'>ISO/PreWD3 1000-1(E)</docidentifier>
106
+ <docidentifier type='iso-reference'>ISO/PreWD3 1000-1:2000(E)</docidentifier>
107
+ <docnumber>1000</docnumber>
108
108
  <contributor>
109
109
  <role type="author"/>
110
110
  <organization>
@@ -127,7 +127,7 @@ RSpec.describe Asciidoctor::ISO do
127
127
  <language>en</language>
128
128
  <script>Latn</script>
129
129
  <status>
130
- <stage abbreviation="NWIP">10</stage>
130
+ <stage abbreviation="WD">20</stage>
131
131
  <substage>20</substage>
132
132
  <iteration>3</iteration>
133
133
  </status>
@@ -163,7 +163,7 @@ RSpec.describe Asciidoctor::ISO do
163
163
  <structuredidentifier>
164
164
  <project-number part="1">ISO 1000</project-number>
165
165
  </structuredidentifier>
166
- <stagename>New work item proposal</stagename>
166
+ <stagename>Third working draft</stagename>
167
167
  </ext>
168
168
  </bibdata>
169
169
  <sections/>
@@ -187,13 +187,14 @@ RSpec.describe Asciidoctor::ISO do
187
187
  :script: Grek
188
188
  :publisher: IEC,IETF,ISO
189
189
  :copyright-year: 2001
190
+ :doctype: technical-report
190
191
  INPUT
191
192
  <?xml version="1.0" encoding="UTF-8"?>
192
193
  <iso-standard xmlns="https://www.metanorma.org/ns/iso">
193
194
  <bibdata type="standard">
194
- <docidentifier type="iso">ISO/IEC/IETF 1000-1-1:2001</docidentifier>
195
- <docidentifier type='iso-with-lang'>ISO/IEC/IETF 1000-1-1:2001(X)</docidentifier>
196
- <docidentifier type='iso-reference'>ISO/IEC/IETF 1000-1-1:2001(X)</docidentifier>
195
+ <docidentifier type="ISO">ISO/IEC/IETF/TR 1000-1-1:2001</docidentifier>
196
+ <docidentifier type='iso-with-lang'>ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
197
+ <docidentifier type='iso-reference'>ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
197
198
  <docidentifier type="iso-tc">2000</docidentifier>
198
199
  <docidentifier type="iso-tc">2003</docidentifier>
199
200
  <docnumber>1000</docnumber>
@@ -270,7 +271,7 @@ RSpec.describe Asciidoctor::ISO do
270
271
  </owner>
271
272
  </copyright>
272
273
  <ext>
273
- <doctype>article</doctype>
274
+ <doctype>technical-report</doctype>
274
275
  <editorialgroup>
275
276
  <technical-committee/>
276
277
  <subcommittee/>
@@ -287,7 +288,7 @@ RSpec.describe Asciidoctor::ISO do
287
288
  OUTPUT
288
289
  end
289
290
 
290
- it "defaults substage" do
291
+ it "defaults substage, defines iteration on stage 50, gives stage 50 on technical specification" do
291
292
  expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
292
293
  = Document title
293
294
  Author
@@ -298,12 +299,14 @@ RSpec.describe Asciidoctor::ISO do
298
299
  :docnumber: 1000
299
300
  :docstage: 50
300
301
  :language: fr
302
+ :doctype: technical-specification
303
+ :iteration: 2
301
304
  INPUT
302
305
  <iso-standard xmlns="https://www.metanorma.org/ns/iso">
303
306
  <bibdata type="standard">
304
- <docidentifier type="iso">ISO/FDIS 1000</docidentifier>
305
- <docidentifier type='iso-with-lang'>ISO/FDIS 1000(F)</docidentifier>
306
- <docidentifier type='iso-reference'>ISO/FDIS 1000(F)</docidentifier>
307
+ <docidentifier type="ISO">ISO/DTS 1000.2</docidentifier>
308
+ <docidentifier type='iso-with-lang'>ISO/DTS 1000.2(F)</docidentifier>
309
+ <docidentifier type='iso-reference'>ISO/DTS 1000.2(F)</docidentifier>
307
310
  <docnumber>1000</docnumber>
308
311
  <contributor>
309
312
  <role type="author"/>
@@ -323,8 +326,9 @@ RSpec.describe Asciidoctor::ISO do
323
326
  <language>fr</language>
324
327
  <script>Latn</script>
325
328
  <status>
326
- <stage abbreviation="FDIS">50</stage>
329
+ <stage abbreviation="D">50</stage>
327
330
  <substage>00</substage>
331
+ <iteration>2</iteration>
328
332
  </status>
329
333
  <copyright>
330
334
  <from>#{Date.today.year}</from>
@@ -336,7 +340,7 @@ RSpec.describe Asciidoctor::ISO do
336
340
  </owner>
337
341
  </copyright>
338
342
  <ext>
339
- <doctype>article</doctype>
343
+ <doctype>technical-specification</doctype>
340
344
  <editorialgroup>
341
345
  <technical-committee/>
342
346
  <subcommittee/>
@@ -345,7 +349,7 @@ RSpec.describe Asciidoctor::ISO do
345
349
  <structuredidentifier>
346
350
  <project-number>ISO 1000</project-number>
347
351
  </structuredidentifier>
348
- <stagename>Final draft international standard</stagename>
352
+ <stagename>Final draft</stagename>
349
353
  </ext>
350
354
  </bibdata>
351
355
  <sections/>
@@ -366,7 +370,7 @@ OUTPUT
366
370
  INPUT
367
371
  <iso-standard xmlns="https://www.metanorma.org/ns/iso">
368
372
  <bibdata type="standard">
369
- <docidentifier type="iso">ISO 1000</docidentifier>
373
+ <docidentifier type="ISO">ISO 1000</docidentifier>
370
374
  <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
371
375
  <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
372
376
  <docnumber>1000</docnumber>
@@ -432,7 +436,7 @@ OUTPUT
432
436
  INPUT
433
437
  <iso-standard xmlns="https://www.metanorma.org/ns/iso">
434
438
  <bibdata type="standard">
435
- <docidentifier type="iso">ISO 1000</docidentifier>
439
+ <docidentifier type="ISO">ISO 1000</docidentifier>
436
440
  <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
437
441
  <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
438
442
  <docnumber>1000</docnumber>
@@ -547,7 +547,7 @@ RSpec.describe Asciidoctor::ISO do
547
547
  INPUT
548
548
  #{BLANK_HDR}
549
549
  <sections><formula id="_">
550
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>F</mi><mtext>or</mtext><mi>μ</mi><mi>l</mi><mi>a</mi></math></stem>
550
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>F</mi><mi>or</mi><mi>μ</mi><mi>l</mi><mi>a</mi></math></stem>
551
551
  <dl id="_">
552
552
  <dt>a</dt>
553
553
  <dd>
@@ -654,7 +654,7 @@ RSpec.describe Asciidoctor::ISO do
654
654
  <abbreviation>ISO</abbreviation>
655
655
  </organization>
656
656
  </contributor>
657
- <note format="text/plain">ISO DATE: The standard is in press</note>
657
+ <note format="text/plain" type="ISO DATE">The standard is in press</note>
658
658
  </bibitem>
659
659
  </references>
660
660
  </bibliography>
@@ -34,7 +34,7 @@ RSpec.describe Asciidoctor::ISO do
34
34
 
35
35
  == Main
36
36
 
37
- term:[name,name2]
37
+ term:[name,name2] is a term
38
38
  XML
39
39
  end
40
40
  let(:output) do
@@ -72,7 +72,7 @@ RSpec.describe Asciidoctor::ISO do
72
72
  <em>name</em>
73
73
  (
74
74
  <xref target='term-name2'/>
75
- )
75
+ ) is a term
76
76
  </p>
77
77
  </clause>
78
78
  </sections>
@@ -95,7 +95,7 @@ RSpec.describe Asciidoctor::ISO do
95
95
 
96
96
  == Main
97
97
 
98
- term:[name]
98
+ term:[name] is a term
99
99
  XML
100
100
  end
101
101
  let(:output) do
@@ -133,7 +133,7 @@ RSpec.describe Asciidoctor::ISO do
133
133
  <em>name</em>
134
134
  (
135
135
  <xref target='term-name' />
136
- )
136
+ ) is a term
137
137
  </p>
138
138
  </clause>
139
139
  </sections>
@@ -164,8 +164,8 @@ RSpec.describe Asciidoctor::ISO do
164
164
  [[term-name2]]
165
165
  == Second
166
166
 
167
- term:[name]
168
- term:[name2]
167
+ term:[name] is a term
168
+ term:[name2] is a term
169
169
  XML
170
170
  end
171
171
  let(:output) do
@@ -210,11 +210,11 @@ RSpec.describe Asciidoctor::ISO do
210
210
  <em>name</em>
211
211
  (
212
212
  <xref target='term-name-1' />
213
- )
213
+ ) is a term
214
214
  <em>name2</em>
215
215
  (
216
216
  <xref target='term-name2-1' />
217
- )
217
+ ) is a term
218
218
  </p>
219
219
  </clause>
220
220
  </sections>
@@ -234,12 +234,18 @@ RSpec.describe Asciidoctor::ISO do
234
234
 
235
235
  == Terms and Definitions
236
236
 
237
- === name
237
+ === name identity
238
+
239
+ [[name-check]]
240
+ === name check
238
241
 
239
242
  paragraph
240
243
 
241
- term:[name]
242
- term:[missing]
244
+ term:[name check] is a term
245
+
246
+ term:[name identity] is a term
247
+
248
+ Moreover, term:[missing] is a term
243
249
  XML
244
250
  end
245
251
  let(:output) do
@@ -267,16 +273,26 @@ RSpec.describe Asciidoctor::ISO do
267
273
  </p>
268
274
  </li>
269
275
  </ul>
270
- <term id='term-name'>
271
- <preferred>name</preferred>
276
+ <term id='term-name-identity'>
277
+ <preferred>name identity</preferred>
278
+ </term>
279
+ <term id='name-check'>
280
+ <preferred>name check</preferred>
272
281
  <definition>
273
282
  <p id='_'>paragraph</p>
274
283
  <p id='_'>
275
- <em>name</em>
284
+ <em>name check</em>
285
+ (
286
+ <xref target='name-check'/>
287
+ ) is a term
288
+ </p>
289
+ <p id='_'>
290
+ <em>name identity</em>
276
291
  (
277
- <xref target='term-name'/>
278
- )
279
- missing
292
+ <xref target='term-name-identity'/>
293
+ ) is a term
294
+ </p>
295
+ <p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term
280
296
  </p>
281
297
  </definition>
282
298
  </term>
@@ -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>
@@ -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