metanorma-iso 1.3.25 → 1.3.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/iso/base.rb +6 -0
- data/lib/asciidoctor/iso/biblio.rng +13 -3
- data/lib/asciidoctor/iso/front.rb +3 -155
- data/lib/asciidoctor/iso/front_id.rb +196 -0
- data/lib/asciidoctor/iso/isodoc.rng +17 -1
- data/lib/asciidoctor/iso/isostandard.rng +7 -1
- data/lib/asciidoctor/iso/term_lookup_cleanup.rb +5 -8
- data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
- data/lib/asciidoctor/iso/validate_style.rb +6 -5
- data/lib/isodoc/iso/base_convert.rb +1 -33
- data/lib/isodoc/iso/html/header.html +5 -1
- data/lib/isodoc/iso/html/html_iso_titlepage.html +9 -0
- data/lib/isodoc/iso/html/isodoc.scss +21 -0
- data/lib/isodoc/iso/html/style-human.scss +5 -1
- data/lib/isodoc/iso/html/style-iso.scss +5 -1
- data/lib/isodoc/iso/html/word_iso_titlepage.html +4 -4
- data/lib/isodoc/iso/html/wordstyle.scss +20 -6
- data/lib/isodoc/iso/iso.amendment.xsl +4597 -0
- data/lib/isodoc/iso/iso.international-standard.xsl +494 -283
- data/lib/isodoc/iso/metadata.rb +30 -26
- data/lib/isodoc/iso/pdf_convert.rb +9 -2
- data/lib/isodoc/iso/sections.rb +66 -0
- data/lib/isodoc/iso/sts_convert.rb +29 -0
- data/lib/metanorma-iso.rb +1 -0
- data/lib/metanorma/iso/processor.rb +4 -1
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +4 -1
- data/spec/asciidoctor-iso/amd_spec.rb +412 -4
- data/spec/asciidoctor-iso/base_spec.rb +15 -13
- data/spec/asciidoctor-iso/macros_spec.rb +15 -13
- data/spec/isodoc/amd_spec.rb +606 -0
- data/spec/isodoc/metadata_spec.rb +4 -2
- data/spec/isodoc/postproc_spec.rb +8 -8
- data/spec/isodoc/ref_spec.rb +1 -1
- data/spec/isodoc/section_spec.rb +28 -1
- data/spec/metanorma/processor_spec.rb +1 -1
- metadata +51 -4
@@ -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:
|
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/
|
105
|
-
<docidentifier type='iso-with-lang'>ISO/
|
106
|
-
<docidentifier type='iso-reference'>ISO/
|
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="
|
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>
|
166
|
+
<stagename>Third working draft</stagename>
|
167
167
|
</ext>
|
168
168
|
</bibdata>
|
169
169
|
<sections/>
|
@@ -288,7 +288,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
288
288
|
OUTPUT
|
289
289
|
end
|
290
290
|
|
291
|
-
it "defaults substage" do
|
291
|
+
it "defaults substage, defines iteration on stage 50, gives stage 50 on technical specification" do
|
292
292
|
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
293
293
|
= Document title
|
294
294
|
Author
|
@@ -300,12 +300,13 @@ RSpec.describe Asciidoctor::ISO do
|
|
300
300
|
:docstage: 50
|
301
301
|
:language: fr
|
302
302
|
:doctype: technical-specification
|
303
|
+
:iteration: 2
|
303
304
|
INPUT
|
304
305
|
<iso-standard xmlns="https://www.metanorma.org/ns/iso">
|
305
306
|
<bibdata type="standard">
|
306
|
-
<docidentifier type="iso">ISO/
|
307
|
-
<docidentifier type='iso-with-lang'>ISO/
|
308
|
-
<docidentifier type='iso-reference'>ISO/
|
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>
|
309
310
|
<docnumber>1000</docnumber>
|
310
311
|
<contributor>
|
311
312
|
<role type="author"/>
|
@@ -325,8 +326,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
325
326
|
<language>fr</language>
|
326
327
|
<script>Latn</script>
|
327
328
|
<status>
|
328
|
-
<stage abbreviation="
|
329
|
+
<stage abbreviation="D">50</stage>
|
329
330
|
<substage>00</substage>
|
331
|
+
<iteration>2</iteration>
|
330
332
|
</status>
|
331
333
|
<copyright>
|
332
334
|
<from>#{Date.today.year}</from>
|
@@ -347,7 +349,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
347
349
|
<structuredidentifier>
|
348
350
|
<project-number>ISO 1000</project-number>
|
349
351
|
</structuredidentifier>
|
350
|
-
<stagename>Final draft
|
352
|
+
<stagename>Final draft</stagename>
|
351
353
|
</ext>
|
352
354
|
</bibdata>
|
353
355
|
<sections/>
|
@@ -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>
|
@@ -238,8 +238,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
238
238
|
|
239
239
|
paragraph
|
240
240
|
|
241
|
-
term:[name]
|
242
|
-
|
241
|
+
term:[name] is a term
|
242
|
+
|
243
|
+
Moreover, term:[missing] is a term
|
243
244
|
XML
|
244
245
|
end
|
245
246
|
let(:output) do
|
@@ -272,11 +273,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
272
273
|
<definition>
|
273
274
|
<p id='_'>paragraph</p>
|
274
275
|
<p id='_'>
|
275
|
-
<em>name</em>
|
276
|
+
<em>name</em>
|
276
277
|
(
|
277
278
|
<xref target='term-name'/>
|
278
|
-
)
|
279
|
-
|
279
|
+
) is a term
|
280
|
+
</p>
|
281
|
+
<p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term
|
280
282
|
</p>
|
281
283
|
</definition>
|
282
284
|
</term>
|
@@ -0,0 +1,606 @@
|
|
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>  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>  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>  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  </b></span>
|
104
|
+
<div id="AN" class="Note"><p><span class="note_label">NOTE</span>  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  </b></span>
|
107
|
+
<div id="Anote1" class="Note"><p><span class="note_label">NOTE 1</span>  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>  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  Annex A.1</h2>
|
238
|
+
<div id="Q1">
|
239
|
+
<h3>A.1.1  Annex A.1a</h3>
|
240
|
+
</div>
|
241
|
+
</div>
|
242
|
+
<div id="Q2">
|
243
|
+
<h2>Appendix 1  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> </p>
|
346
|
+
</div>
|
347
|
+
<br/>
|
348
|
+
<div class='prefatory-section'>
|
349
|
+
<p> </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  Annex A.1</h2>
|
437
|
+
<div id='Q1'>
|
438
|
+
<h3>A.1.1  Annex A.1a</h3>
|
439
|
+
</div>
|
440
|
+
<div>
|
441
|
+
<h3>A.1.2  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", :authors=>[], :authors_affiliations=>{}, :createddate=>"2016-05-01", :docnumber=>"ISO/PreNWIP3 17301-1:2016/Amd.1", :docnumber_lang=>"ISO/PreNWIP3 17301-1:2016/Amd.1(E)", :docnumber_reference=>"ISO/PreNWIP3 17301-1:2016/Amd.1:2017(E)", :docnumeric=>"17301", :docsubtitle=>"Introduction Française — Titre Principal — Partie 1: Part du Titre", :docsubtitleamd=>"Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs d’échantillon et recommandations relatives aux conditions d’entreposage et de transport", :docsubtitleamdlabel=>"AMENDMENT 1", :docsubtitlecorrlabel=>"RECTIFICATIF TECHNIQUE 2", :docsubtitleintro=>"Introduction Française", :docsubtitlemain=>"Titre Principal", :docsubtitlepart=>"Part du Titre", :docsubtitlepartlabel=>"Partie 1", :doctitle=>"Introduction — Main Title — Title — Part 1: Title Part", :doctitleamd=>"Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions", :doctitleamdlabel=>"AMENDMENT 1", :doctitlecorrlabel=>"TECHNICAL CORRIGENDUM 2", :doctitleintro=>"Introduction", :doctitlemain=>"Main Title — Title", :doctitlepart=>"Title Part", :doctitlepartlabel=>"Part 1", :doctype=>"Amendment", :docyear=>"2017", :draft=>"0.3.4", :draftinfo=>" (draft 0.3.4, 2000-01-01)", :edition=>"2", :editorialgroup=>["A 1", "B 2", "C 3"], :ics=>"1, 2, 3", :keywords=>[], :obsoletes=>nil, :obsoletes_part=>nil, :publisher=>"International Organization for Standardization", :revdate=>"2000-01-01", :revdate_monthyear=>"January 2000", :sc=>"B 2", :secretariat=>"SECRETARIAT", :stage=>"10", :stage_int=>10, :stageabbr=>"NWIP", :statusabbr=>"PreNWIP3", :tc=>"A 1", :tc_docnumber=>[], :unpublished=>true, :wg=>"C 3"}
|
567
|
+
OUTPUT
|
568
|
+
end
|
569
|
+
|
570
|
+
it "processes middle title" do
|
571
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
572
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
573
|
+
<bibdata>
|
574
|
+
<title language='en' format='text/plain' type='title-intro'>Introduction</title>
|
575
|
+
<title language='en' format='text/plain' type='title-main'>Main Title — Title</title>
|
576
|
+
<title language='en' format='text/plain' type='title-part'>Title Part</title>
|
577
|
+
<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>
|
578
|
+
<ext>
|
579
|
+
<structuredidentifier>
|
580
|
+
<project-number part='1' amendment='1' corrigendum='2' origyr='2016-05-01'>17301</project-number>
|
581
|
+
</structuredidentifier>
|
582
|
+
</ext>
|
583
|
+
</bibdata>
|
584
|
+
<sections/>
|
585
|
+
</iso-standard>
|
586
|
+
INPUT
|
587
|
+
#{HTML_HDR}
|
588
|
+
<p class='zzSTDTitle1'>Introduction — Main Title — Title — </p>
|
589
|
+
<p class='zzSTDTitle2'>
|
590
|
+
Part 1:
|
591
|
+
<br/><b>Title Part</b>
|
592
|
+
</p>
|
593
|
+
<p class='zzSTDTitle2'>
|
594
|
+
AMENDMENT 1: Mass fraction of extraneous matter, milled rice
|
595
|
+
(nonglutinous), sample dividers and recommendations relating to storage
|
596
|
+
and transport conditions
|
597
|
+
</p>
|
598
|
+
<p class='zzSTDTitle2'>TECHNICAL CORRIGENDUM 2</p>
|
599
|
+
</div>
|
600
|
+
</body>
|
601
|
+
</html>
|
602
|
+
OUTPUT
|
603
|
+
end
|
604
|
+
|
605
|
+
|
606
|
+
end
|