metanorma-bsi 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.hound.yml +3 -0
- data/.rubocop.yml +14 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/LICENSE +25 -0
- data/README.adoc +199 -0
- data/Rakefile +8 -0
- data/bin/rspec +18 -0
- data/lib/asciidoctor/bsi/basicdoc.rng +1131 -0
- data/lib/asciidoctor/bsi/biblio.rng +1235 -0
- data/lib/asciidoctor/bsi/bsi.rng +120 -0
- data/lib/asciidoctor/bsi/bsi_intro_en.xml +105 -0
- data/lib/asciidoctor/bsi/cleanup.rb +78 -0
- data/lib/asciidoctor/bsi/cleanup_ref.rb +183 -0
- data/lib/asciidoctor/bsi/converter.rb +83 -0
- data/lib/asciidoctor/bsi/front.rb +67 -0
- data/lib/asciidoctor/bsi/isodoc.rng +1870 -0
- data/lib/asciidoctor/bsi/isostandard.rng +477 -0
- data/lib/asciidoctor/bsi/reqt.rng +194 -0
- data/lib/asciidoctor/bsi/validate.rb +224 -0
- data/lib/asciidoctor/bsi/validate_list.rb +72 -0
- data/lib/asciidoctor/bsi/validate_requirement.rb +163 -0
- data/lib/isodoc/bsi/base_convert.rb +91 -0
- data/lib/isodoc/bsi/bsi.international-standard.xsl +6540 -0
- data/lib/isodoc/bsi/html/html_bsi_intro.html +8 -0
- data/lib/isodoc/bsi/html/html_bsi_titlepage.html +50 -0
- data/lib/isodoc/bsi/html/htmlstyle.css +968 -0
- data/lib/isodoc/bsi/html/htmlstyle.scss +699 -0
- data/lib/isodoc/bsi/html_convert.rb +56 -0
- data/lib/isodoc/bsi/i18n-en.yaml +56 -0
- data/lib/isodoc/bsi/i18n.rb +15 -0
- data/lib/isodoc/bsi/init.rb +24 -0
- data/lib/isodoc/bsi/metadata.rb +33 -0
- data/lib/isodoc/bsi/pdf_convert.rb +17 -0
- data/lib/isodoc/bsi/presentation_xml_convert.rb +72 -0
- data/lib/isodoc/bsi/sts_convert.rb +30 -0
- data/lib/isodoc/bsi/xref.rb +134 -0
- data/lib/metanorma-bsi.rb +15 -0
- data/lib/metanorma/bsi.rb +6 -0
- data/lib/metanorma/bsi/processor.rb +51 -0
- data/lib/metanorma/bsi/version.rb +6 -0
- data/metanorma-bsi.gemspec +47 -0
- data/spec/asciidoctor/base_spec.rb +778 -0
- data/spec/asciidoctor/blocks_spec.rb +553 -0
- data/spec/asciidoctor/cleanup_spec.rb +547 -0
- data/spec/asciidoctor/inline_spec.rb +176 -0
- data/spec/asciidoctor/lists_spec.rb +194 -0
- data/spec/asciidoctor/refs_spec.rb +318 -0
- data/spec/asciidoctor/section_spec.rb +382 -0
- data/spec/asciidoctor/validate_spec.rb +858 -0
- data/spec/assets/header.html +7 -0
- data/spec/assets/html.css +2 -0
- data/spec/assets/iso.xml +71 -0
- data/spec/assets/rice_image1.png +0 -0
- data/spec/assets/word.css +2 -0
- data/spec/assets/wordintro.html +4 -0
- data/spec/assets/xref_error.adoc +7 -0
- data/spec/isodoc/blocks_spec.rb +259 -0
- data/spec/isodoc/i18n_spec.rb +442 -0
- data/spec/isodoc/inline_spec.rb +287 -0
- data/spec/isodoc/iso_spec.rb +116 -0
- data/spec/isodoc/metadata_spec.rb +262 -0
- data/spec/isodoc/postproc_spec.rb +137 -0
- data/spec/isodoc/ref_spec.rb +376 -0
- data/spec/isodoc/section_spec.rb +467 -0
- data/spec/isodoc/terms_spec.rb +246 -0
- data/spec/isodoc/xref_spec.rb +1730 -0
- data/spec/metanorma/processor_spec.rb +76 -0
- data/spec/spec_helper.rb +291 -0
- data/spec/vcr_cassettes/iso-639.yml +182 -0
- data/spec/vcr_cassettes/isobib_get_639_1967.yml +136 -0
- data/spec/vcr_cassettes/multistandard.yml +352 -0
- metadata +343 -0
data/spec/assets/iso.xml
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
<iec-standard xmlns="https://www.metanorma.org/ns/iec">
|
2
|
+
<bibdata type="standard">
|
3
|
+
<title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
|
4
|
+
<title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
|
5
|
+
<title type="main" language="en" format="text/plain">Specifications and test methods</title>
|
6
|
+
<title type="title-part" language="en" format="text/plain">Rice</title>
|
7
|
+
<title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
|
8
|
+
<title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
|
9
|
+
<title type="title-part" language="fr" format="text/plain">Riz</title>
|
10
|
+
<docidentifier type="iso">ISO/PreCD3 17301-1</docidentifier>
|
11
|
+
<docidentifier type="iso-tc">17301</docidentifier>
|
12
|
+
<docnumber>1730</docnumber>
|
13
|
+
<date type="published"><on>2011</on></date>
|
14
|
+
<date type="accessed"><on>2012</on></date>
|
15
|
+
<date type="created"><from>2010</from><to>2011</to></date>
|
16
|
+
<date type="activated"><on>2013</on></date>
|
17
|
+
<date type="obsoleted"><on>2014</on></date>
|
18
|
+
<edition>2</edition>
|
19
|
+
<version>
|
20
|
+
<revision-date>2016-05-01</revision-date>
|
21
|
+
<draft>0.4</draft>
|
22
|
+
</version>
|
23
|
+
<contributor>
|
24
|
+
<role type="author"/>
|
25
|
+
<organization>
|
26
|
+
<name>International Organization for Standardization</name>
|
27
|
+
<abbreviation>ISO</abbreviation>
|
28
|
+
</organization>
|
29
|
+
</contributor>
|
30
|
+
<contributor>
|
31
|
+
<role type="publisher"/>
|
32
|
+
<organization>
|
33
|
+
<name>International Organization for Standardization</name>
|
34
|
+
<abbreviation>ISO</abbreviation>
|
35
|
+
</organization>
|
36
|
+
</contributor>
|
37
|
+
<language>en</language>
|
38
|
+
<script>Latn</script>
|
39
|
+
<status>
|
40
|
+
<stage abbreviation="CD">35</stage>
|
41
|
+
<substage abbreviation="3CD">20</substage>
|
42
|
+
<iteration>3</iteration>
|
43
|
+
</status>
|
44
|
+
<copyright>
|
45
|
+
<from>2016</from>
|
46
|
+
<owner>
|
47
|
+
<organization>
|
48
|
+
<abbreviation>ISO</abbreviation>
|
49
|
+
</organization>
|
50
|
+
</owner>
|
51
|
+
</copyright>
|
52
|
+
<ext>
|
53
|
+
<doctype>international-standard</doctype>
|
54
|
+
<editorialgroup>
|
55
|
+
<technical-committee number="34">Food products</technical-committee>
|
56
|
+
<subcommittee number="4">Cereals and pulses</subcommittee>
|
57
|
+
<workgroup number="3">Rice Group</workgroup>
|
58
|
+
<secretariat>GB</secretariat>
|
59
|
+
</editorialgroup>
|
60
|
+
<structuredidentifier>
|
61
|
+
<project-number part="1">ISO/PreCD3 17301</project-number>
|
62
|
+
</structuredidentifier>
|
63
|
+
</ext>
|
64
|
+
</bibdata>
|
65
|
+
<foreword>
|
66
|
+
<note>
|
67
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
68
|
+
</note>
|
69
|
+
</foreword>
|
70
|
+
</iec-standard>
|
71
|
+
|
Binary file
|
@@ -0,0 +1,259 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe IsoDoc::BSI do
|
4
|
+
it "processes notes" do
|
5
|
+
expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
|
+
<preface><foreword>
|
8
|
+
<note id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a"><name>NOTE</name>
|
9
|
+
<p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
|
10
|
+
<p id="_e94663cc-2473-4ccc-9a72-983a74d989f3">Para 2.</p>
|
11
|
+
</note>
|
12
|
+
</foreword></preface>
|
13
|
+
</iso-standard>
|
14
|
+
INPUT
|
15
|
+
#{HTML_HDR}
|
16
|
+
<div>
|
17
|
+
<h1 class='ForewordTitle'>FOREWORD</h1>
|
18
|
+
<div class='boilerplate_legal'/>
|
19
|
+
<div id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' class='Note'>
|
20
|
+
<p>
|
21
|
+
<span class='note_label'>NOTE</span>
|
22
|
+
 Only use paddy or parboiled rice for the determination of husked
|
23
|
+
rice yield.
|
24
|
+
</p>
|
25
|
+
<p id='_e94663cc-2473-4ccc-9a72-983a74d989f3'>Para 2.</p>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
#{IEC_TITLE1}
|
29
|
+
</div>
|
30
|
+
</body>
|
31
|
+
</html>
|
32
|
+
OUTPUT
|
33
|
+
end
|
34
|
+
|
35
|
+
it "processes commentaries" do
|
36
|
+
input = <<~INPUT
|
37
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
38
|
+
<sections>
|
39
|
+
<clause id='reag2' inline-header='false' obligation='normative'>
|
40
|
+
<title>Reagents</title>
|
41
|
+
<admonition id='A1' type='commentary' target='reag'>
|
42
|
+
<p id='p2'>This is a commentary on the reagents</p>
|
43
|
+
</admonition>
|
44
|
+
<admonition id='A2' type='commentary' target='reag2'>
|
45
|
+
<p id='p2'>This is a commentary on the reagents</p>
|
46
|
+
</admonition>
|
47
|
+
<admonition id='A3' type='commentary' target='reag2'>
|
48
|
+
<p id='p2'>This is a commentary on the reagents</p>
|
49
|
+
</admonition>
|
50
|
+
<table id='table2'>
|
51
|
+
<name>Reagents in use</name>
|
52
|
+
<tbody>
|
53
|
+
<tr>
|
54
|
+
<td valign='top' align='left'>A</td>
|
55
|
+
<td valign='top' align='left'>B</td>
|
56
|
+
</tr>
|
57
|
+
</tbody>
|
58
|
+
</table>
|
59
|
+
</clause>
|
60
|
+
<clause id='reag3' inline-header='false' obligation='normative'>
|
61
|
+
<title>Reagents</title>
|
62
|
+
<admonition id='A4' type='commentary' target='table3'>
|
63
|
+
<p id='p3'>This is a commentary on the reagents</p>
|
64
|
+
</admonition>
|
65
|
+
<table id='table3'>
|
66
|
+
<name>Reagents in use</name>
|
67
|
+
<tbody>
|
68
|
+
<tr>
|
69
|
+
<td valign='top' align='left'>A</td>
|
70
|
+
<td valign='top' align='left'>B</td>
|
71
|
+
</tr>
|
72
|
+
</tbody>
|
73
|
+
</table>
|
74
|
+
</clause>
|
75
|
+
</sections>
|
76
|
+
</iso-standard>
|
77
|
+
INPUT
|
78
|
+
|
79
|
+
presxml = <<~OUTPUT
|
80
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
81
|
+
<sections>
|
82
|
+
<clause id="reag2" inline-header="false" obligation="normative">
|
83
|
+
<title depth="1">1<tab/>Reagents</title>
|
84
|
+
<admonition id="A1" type="commentary" target="reag"><name>COMMENTARY ON ???</name>
|
85
|
+
<p id="p2">This is a commentary on the reagents</p>
|
86
|
+
</admonition>
|
87
|
+
<admonition id="A2" type="commentary" target="reag2"><name>COMMENTARY 1 ON CLAUSE 1</name>
|
88
|
+
<p id="p2">This is a commentary on the reagents</p>
|
89
|
+
</admonition>
|
90
|
+
<admonition id="A3" type="commentary" target="reag2"><name>COMMENTARY 2 ON CLAUSE 1</name>
|
91
|
+
<p id="p2">This is a commentary on the reagents</p>
|
92
|
+
</admonition>
|
93
|
+
<table id="table2">
|
94
|
+
<name>Table 1 — Reagents in use</name>
|
95
|
+
<tbody>
|
96
|
+
<tr>
|
97
|
+
<td valign="top" align="left">A</td>
|
98
|
+
<td valign="top" align="left">B</td>
|
99
|
+
</tr>
|
100
|
+
</tbody>
|
101
|
+
</table>
|
102
|
+
</clause>
|
103
|
+
<clause id="reag3" inline-header="false" obligation="normative">
|
104
|
+
<title depth="1">2<tab/>Reagents</title>
|
105
|
+
<admonition id="A4" type="commentary" target="table3"><name>COMMENTARY ON TABLE 2</name>
|
106
|
+
<p id="p3">This is a commentary on the reagents</p>
|
107
|
+
</admonition>
|
108
|
+
<table id="table3">
|
109
|
+
<name>Table 2 — Reagents in use</name>
|
110
|
+
<tbody>
|
111
|
+
<tr>
|
112
|
+
<td valign="top" align="left">A</td>
|
113
|
+
<td valign="top" align="left">B</td>
|
114
|
+
</tr>
|
115
|
+
</tbody>
|
116
|
+
</table>
|
117
|
+
</clause>
|
118
|
+
</sections>
|
119
|
+
</iso-standard>
|
120
|
+
OUTPUT
|
121
|
+
|
122
|
+
html = <<~OUTPUT
|
123
|
+
#{HTML_HDR}
|
124
|
+
<div id=''>
|
125
|
+
<h1 class='ForewordTitle'>FOREWORD</h1>
|
126
|
+
<div class='boilerplate_legal'/>
|
127
|
+
</div>
|
128
|
+
<p class='zzSTDTitle1'>
|
129
|
+
<b/>
|
130
|
+
</p>
|
131
|
+
<p class='zzSTDTitle1'> </p>
|
132
|
+
<div id='reag2'>
|
133
|
+
<h1>1 Reagents</h1>
|
134
|
+
<p>
|
135
|
+
<span class='note_label'>COMMENTARY ON ???</span>
|
136
|
+
</p>
|
137
|
+
<p id='p2'>This is a commentary on the reagents</p>
|
138
|
+
<div id='A1' class='Admonition'>
|
139
|
+
<p>This is a commentary on the reagents</p>
|
140
|
+
</div>
|
141
|
+
<p>
|
142
|
+
<span class='note_label'>COMMENTARY 1 ON CLAUSE 1</span>
|
143
|
+
</p>
|
144
|
+
<p id='p2'>This is a commentary on the reagents</p>
|
145
|
+
<div id='A2' class='Admonition'>
|
146
|
+
<p>This is a commentary on the reagents</p>
|
147
|
+
</div>
|
148
|
+
<p>
|
149
|
+
<span class='note_label'>COMMENTARY 2 ON CLAUSE 1</span>
|
150
|
+
</p>
|
151
|
+
<p id='p2'>This is a commentary on the reagents</p>
|
152
|
+
<div id='A3' class='Admonition'>
|
153
|
+
<p>This is a commentary on the reagents</p>
|
154
|
+
</div>
|
155
|
+
<p class='TableTitle' style='text-align:center;'>Table 1 — Reagents in use</p>
|
156
|
+
<table id='table2' class='MsoISOTable' style='border-width:1px;border-spacing:0;'>
|
157
|
+
<tbody>
|
158
|
+
<tr>
|
159
|
+
<td style='text-align:left;vertical-align:top;border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>A</td>
|
160
|
+
<td style='text-align:left;vertical-align:top;border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>B</td>
|
161
|
+
</tr>
|
162
|
+
</tbody>
|
163
|
+
</table>
|
164
|
+
</div>
|
165
|
+
<div id='reag3'>
|
166
|
+
<h1>2 Reagents</h1>
|
167
|
+
<p>
|
168
|
+
<span class='note_label'>COMMENTARY ON TABLE 2</span>
|
169
|
+
</p>
|
170
|
+
<p id='p3'>This is a commentary on the reagents</p>
|
171
|
+
<div id='A4' class='Admonition'>
|
172
|
+
<p>This is a commentary on the reagents</p>
|
173
|
+
</div>
|
174
|
+
<p class='TableTitle' style='text-align:center;'>Table 2 — Reagents in use</p>
|
175
|
+
<table id='table3' class='MsoISOTable' style='border-width:1px;border-spacing:0;'>
|
176
|
+
<tbody>
|
177
|
+
<tr>
|
178
|
+
<td style='text-align:left;vertical-align:top;border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>A</td>
|
179
|
+
<td style='text-align:left;vertical-align:top;border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>B</td>
|
180
|
+
</tr>
|
181
|
+
</tbody>
|
182
|
+
</table>
|
183
|
+
</div>
|
184
|
+
</div>
|
185
|
+
</body>
|
186
|
+
</html>
|
187
|
+
OUTPUT
|
188
|
+
expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
|
189
|
+
.convert("test", input, true)))
|
190
|
+
.to be_equivalent_to xmlpp(presxml)
|
191
|
+
expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({})
|
192
|
+
.convert("test", presxml, true)))
|
193
|
+
.to be_equivalent_to xmlpp(html)
|
194
|
+
end
|
195
|
+
|
196
|
+
it "processes admonitions" do
|
197
|
+
expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({})
|
198
|
+
.convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
199
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
200
|
+
<preface><foreword>
|
201
|
+
<admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution">
|
202
|
+
<p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
|
203
|
+
<p id="_e94663cc-2473-4ccc-9a72-983a74d989f3">Para 2.</p>
|
204
|
+
</admonition>
|
205
|
+
</foreword></preface>
|
206
|
+
</iso-standard>
|
207
|
+
INPUT
|
208
|
+
#{HTML_HDR}
|
209
|
+
<div>
|
210
|
+
<h1 class='ForewordTitle'>FOREWORD</h1>
|
211
|
+
<div class='boilerplate_legal'/>
|
212
|
+
<div id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' class='Admonition'>
|
213
|
+
<p>
|
214
|
+
<b>CAUTION</b>. Only use paddy or parboiled rice for the
|
215
|
+
determination of husked rice yield.
|
216
|
+
</p>
|
217
|
+
<p id='_e94663cc-2473-4ccc-9a72-983a74d989f3'>Para 2.</p>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
#{IEC_TITLE1}
|
221
|
+
</div>
|
222
|
+
</body>
|
223
|
+
</html>
|
224
|
+
OUTPUT
|
225
|
+
end
|
226
|
+
|
227
|
+
it "processes admonitions with titles" do
|
228
|
+
expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
229
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
230
|
+
<preface><foreword>
|
231
|
+
<admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution">
|
232
|
+
<name>Title</name>
|
233
|
+
<ul>
|
234
|
+
<li>List</li>
|
235
|
+
</ul>
|
236
|
+
<p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
|
237
|
+
</admonition>
|
238
|
+
</foreword></preface>
|
239
|
+
</iso-standard>
|
240
|
+
INPUT
|
241
|
+
#{HTML_HDR}
|
242
|
+
<div>
|
243
|
+
<h1 class='ForewordTitle'>FOREWORD</h1>
|
244
|
+
<div class='boilerplate_legal'/>
|
245
|
+
<div id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' class='Admonition'>
|
246
|
+
<p><b>Title</b>.</p>
|
247
|
+
<ul>
|
248
|
+
<li>List</li>
|
249
|
+
</ul>
|
250
|
+
<p id='_e94663cc-2473-4ccc-9a72-983a74d989f2'>Only use paddy or parboiled rice for the determination of husked rice yield.</p>
|
251
|
+
</div>
|
252
|
+
</div>
|
253
|
+
#{IEC_TITLE1}
|
254
|
+
</div>
|
255
|
+
</body>
|
256
|
+
</html>
|
257
|
+
OUTPUT
|
258
|
+
end
|
259
|
+
end
|
@@ -0,0 +1,442 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe IsoDoc do
|
4
|
+
it "processes English" do
|
5
|
+
input = <<~INPUT
|
6
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
|
+
<bibdata>
|
8
|
+
<docnumber>1</docnumber>
|
9
|
+
<language>en</language>
|
10
|
+
<ext>
|
11
|
+
<doctype>international-standard</doctype>
|
12
|
+
<horizontal>true</horizontal>
|
13
|
+
<function>emc</function>
|
14
|
+
</ext>
|
15
|
+
</bibdata>
|
16
|
+
<preface>
|
17
|
+
<foreword obligation="informative">
|
18
|
+
<title>Foreword</title>
|
19
|
+
<p id="A">This is a preamble</p>
|
20
|
+
</foreword>
|
21
|
+
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
22
|
+
<title>Introduction Subsection</title>
|
23
|
+
</clause>
|
24
|
+
<p>This is patent boilerplate</p>
|
25
|
+
</introduction></preface><sections>
|
26
|
+
<clause id="D" obligation="normative" type="scope">
|
27
|
+
<title>Scope</title>
|
28
|
+
<p id="E">Text</p>
|
29
|
+
</clause>
|
30
|
+
|
31
|
+
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
32
|
+
<title>Normal Terms</title>
|
33
|
+
<term id="J">
|
34
|
+
<preferred>Term2</preferred>
|
35
|
+
</term>
|
36
|
+
</terms>
|
37
|
+
<definitions id="K">
|
38
|
+
<dl>
|
39
|
+
<dt>Symbol</dt>
|
40
|
+
<dd>Definition</dd>
|
41
|
+
</dl>
|
42
|
+
</definitions>
|
43
|
+
</clause>
|
44
|
+
<definitions id="L">
|
45
|
+
<dl>
|
46
|
+
<dt>Symbol</dt>
|
47
|
+
<dd>Definition</dd>
|
48
|
+
</dl>
|
49
|
+
</definitions>
|
50
|
+
<clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
51
|
+
<title>Introduction</title>
|
52
|
+
</clause>
|
53
|
+
<clause id="O" inline-header="false" obligation="normative">
|
54
|
+
<title>Clause 4.2</title>
|
55
|
+
</clause></clause>
|
56
|
+
|
57
|
+
</sections><annex id="P" inline-header="false" obligation="normative">
|
58
|
+
<title>Annex</title>
|
59
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
60
|
+
<title>Annex A.1</title>
|
61
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
62
|
+
<title>Annex A.1a</title>
|
63
|
+
</clause>
|
64
|
+
</clause>
|
65
|
+
<appendix id="Q2" inline-header="false" obligation="normative">
|
66
|
+
<title>An Appendix</title>
|
67
|
+
</appendix>
|
68
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
69
|
+
<title>Normative References</title>
|
70
|
+
</references><clause id="S" obligation="informative">
|
71
|
+
<title>Bibliography</title>
|
72
|
+
<references id="T" obligation="informative" normative="false">
|
73
|
+
<title>Bibliography Subsection</title>
|
74
|
+
</references>
|
75
|
+
</clause>
|
76
|
+
</bibliography>
|
77
|
+
</iso-standard>
|
78
|
+
INPUT
|
79
|
+
|
80
|
+
presxml = <<~OUTPUT
|
81
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
82
|
+
<bibdata>
|
83
|
+
<docnumber>1</docnumber>
|
84
|
+
<language current="true">en</language>
|
85
|
+
<ext>
|
86
|
+
<doctype language=''>international-standard</doctype>
|
87
|
+
<doctype language='en'>International Standard</doctype>
|
88
|
+
<horizontal>true</horizontal>
|
89
|
+
<function>emc</function>
|
90
|
+
</ext>
|
91
|
+
</bibdata>
|
92
|
+
<preface>
|
93
|
+
<foreword obligation="informative">
|
94
|
+
<title>Foreword</title>
|
95
|
+
<p id="A">This is a preamble</p>
|
96
|
+
</foreword>
|
97
|
+
<introduction id="B" obligation="informative"><title depth="1">0<tab/>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
98
|
+
<title depth="2">0.1<tab/>Introduction Subsection</title>
|
99
|
+
</clause>
|
100
|
+
<p>This is patent boilerplate</p>
|
101
|
+
</introduction></preface><sections>
|
102
|
+
<clause id="D" obligation="normative" type="scope">
|
103
|
+
<title depth="1">1<tab/>Scope</title>
|
104
|
+
<p id="E">Text</p>
|
105
|
+
</clause>
|
106
|
+
|
107
|
+
<clause id="H" obligation="normative"><title depth="1">3<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
108
|
+
<title depth="2">3.1<tab/>Normal Terms</title>
|
109
|
+
<term id="J"><name>3.1.1</name>
|
110
|
+
<preferred>Term2</preferred>
|
111
|
+
</term>
|
112
|
+
</terms>
|
113
|
+
<definitions id="K" inline-header='true'><title>3.2</title>
|
114
|
+
<dl>
|
115
|
+
<dt>Symbol</dt>
|
116
|
+
<dd>Definition</dd>
|
117
|
+
</dl>
|
118
|
+
</definitions>
|
119
|
+
</clause>
|
120
|
+
<definitions id="L"><title>4</title>
|
121
|
+
<dl>
|
122
|
+
<dt>Symbol</dt>
|
123
|
+
<dd>Definition</dd>
|
124
|
+
</dl>
|
125
|
+
</definitions>
|
126
|
+
<clause id="M" inline-header="false" obligation="normative"><title depth="1">5<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
127
|
+
<title depth="2">5.1<tab/>Introduction</title>
|
128
|
+
</clause>
|
129
|
+
<clause id="O" inline-header="false" obligation="normative">
|
130
|
+
<title depth="2">5.2<tab/>Clause 4.2</title>
|
131
|
+
</clause></clause>
|
132
|
+
|
133
|
+
</sections><annex id="P" inline-header="false" obligation="normative">
|
134
|
+
<title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
|
135
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
136
|
+
<title depth="2">A.1<tab/>Annex A.1</title>
|
137
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
138
|
+
<title depth="3">A.1.1<tab/>Annex A.1a</title>
|
139
|
+
</clause>
|
140
|
+
</clause>
|
141
|
+
<appendix id="Q2" inline-header="false" obligation="normative">
|
142
|
+
<title depth="2">Appendix 1<tab/>An Appendix</title>
|
143
|
+
</appendix>
|
144
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
145
|
+
<title depth="1">2<tab/>Normative References</title>
|
146
|
+
</references><clause id="S" obligation="informative">
|
147
|
+
<title depth="1">Bibliography</title>
|
148
|
+
<references id="T" obligation="informative" normative="false">
|
149
|
+
<title depth="2">Bibliography Subsection</title>
|
150
|
+
</references>
|
151
|
+
</clause>
|
152
|
+
</bibliography>
|
153
|
+
</iso-standard>
|
154
|
+
OUTPUT
|
155
|
+
|
156
|
+
html = <<~OUTPUT
|
157
|
+
#{HTML_HDR}
|
158
|
+
<div>
|
159
|
+
<h1 class="ForewordTitle">FOREWORD</h1>
|
160
|
+
<div class="boilerplate_legal"/>
|
161
|
+
<p id="A">This is a preamble</p>
|
162
|
+
</div>
|
163
|
+
<br/>
|
164
|
+
<div class="Section3" id="B">
|
165
|
+
<h1 class="IntroTitle">0 Introduction</h1>
|
166
|
+
<div id="C"><h2>0.1 Introduction Subsection</h2>
|
167
|
+
|
168
|
+
</div>
|
169
|
+
<p>This is patent boilerplate</p>
|
170
|
+
</div>
|
171
|
+
#{IEC_TITLE1}
|
172
|
+
<div id="D">
|
173
|
+
<h1>1 Scope</h1>
|
174
|
+
<p id="E">Text</p>
|
175
|
+
</div>
|
176
|
+
<div>
|
177
|
+
<h1>2 Normative References</h1>
|
178
|
+
</div>
|
179
|
+
<div id="H"><h1>3 Terms, definitions, symbols and abbreviated terms</h1>
|
180
|
+
<div id="I"><h2>3.1 Normal Terms</h2>
|
181
|
+
|
182
|
+
<p class="TermNum" id="J">3.1.1</p>
|
183
|
+
<p class="Terms" style="text-align:left;">Term2</p>
|
184
|
+
|
185
|
+
</div><div id="K"><span class='zzMoveToFollowing'>
|
186
|
+
<b>3.2 </b>
|
187
|
+
</span>
|
188
|
+
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
189
|
+
</div></div>
|
190
|
+
<div id="L" class="Symbols">
|
191
|
+
<h1>4</h1>
|
192
|
+
<dl>
|
193
|
+
<dt>
|
194
|
+
<p>Symbol</p>
|
195
|
+
</dt>
|
196
|
+
<dd>Definition</dd>
|
197
|
+
</dl>
|
198
|
+
</div>
|
199
|
+
<div id="M">
|
200
|
+
<h1>5 Clause 4</h1>
|
201
|
+
<div id="N"><h2>5.1 Introduction</h2>
|
202
|
+
|
203
|
+
</div>
|
204
|
+
<div id="O"><h2>5.2 Clause 4.2</h2>
|
205
|
+
|
206
|
+
</div>
|
207
|
+
</div>
|
208
|
+
<br/>
|
209
|
+
<div id="P" class="Section3">
|
210
|
+
<h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
|
211
|
+
<div id="Q"><h2>A.1 Annex A.1</h2>
|
212
|
+
|
213
|
+
<div id="Q1"><h3>A.1.1 Annex A.1a</h3>
|
214
|
+
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
<div id="Q2"><h2>Appendix 1 An Appendix</h2>
|
218
|
+
|
219
|
+
</div>
|
220
|
+
</div>
|
221
|
+
<br/>
|
222
|
+
<div>
|
223
|
+
<h1 class="Section3">Bibliography</h1>
|
224
|
+
<div>
|
225
|
+
<h2 class="Section3">Bibliography Subsection</h2>
|
226
|
+
</div>
|
227
|
+
</div>
|
228
|
+
</div>
|
229
|
+
</body>
|
230
|
+
</html>
|
231
|
+
OUTPUT
|
232
|
+
expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
|
233
|
+
expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
234
|
+
end
|
235
|
+
|
236
|
+
it "defaults to English" do
|
237
|
+
expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
238
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
239
|
+
<bibdata>
|
240
|
+
<language>tlh</language>
|
241
|
+
</bibdata>
|
242
|
+
<preface>
|
243
|
+
<foreword obligation="informative">
|
244
|
+
<title>Foreword</title>
|
245
|
+
<p id="A">This is a preamble</p>
|
246
|
+
</foreword>
|
247
|
+
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
248
|
+
<title>Introduction Subsection</title>
|
249
|
+
</clause>
|
250
|
+
<p>This is patent boilerplate</p>
|
251
|
+
</introduction></preface><sections>
|
252
|
+
<clause id="D" obligation="normative" type="scope">
|
253
|
+
<title>Scope</title>
|
254
|
+
<p id="E">Text</p>
|
255
|
+
</clause>
|
256
|
+
|
257
|
+
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
258
|
+
<title>Normal Terms</title>
|
259
|
+
<term id="J">
|
260
|
+
<preferred>Term2</preferred>
|
261
|
+
</term>
|
262
|
+
</terms>
|
263
|
+
<definitions id="K">
|
264
|
+
<dl>
|
265
|
+
<dt>Symbol</dt>
|
266
|
+
<dd>Definition</dd>
|
267
|
+
</dl>
|
268
|
+
</definitions>
|
269
|
+
</clause>
|
270
|
+
<definitions id="L">
|
271
|
+
<dl>
|
272
|
+
<dt>Symbol</dt>
|
273
|
+
<dd>Definition</dd>
|
274
|
+
</dl>
|
275
|
+
</definitions>
|
276
|
+
<clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
277
|
+
<title>Introduction</title>
|
278
|
+
</clause>
|
279
|
+
<clause id="O" inline-header="false" obligation="normative">
|
280
|
+
<title>Clause 4.2</title>
|
281
|
+
</clause></clause>
|
282
|
+
|
283
|
+
</sections><annex id="P" inline-header="false" obligation="normative">
|
284
|
+
<title>Annex</title>
|
285
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
286
|
+
<title>Annex A.1</title>
|
287
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
288
|
+
<title>Annex A.1a</title>
|
289
|
+
</clause>
|
290
|
+
</clause>
|
291
|
+
<appendix id="Q2" inline-header="false" obligation="normative">
|
292
|
+
<title>An Appendix</title>
|
293
|
+
</appendix>
|
294
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
295
|
+
<title>Normative References</title>
|
296
|
+
</references><clause id="S" obligation="informative">
|
297
|
+
<title>Bibliography</title>
|
298
|
+
<references id="T" obligation="informative" normative="false">
|
299
|
+
<title>Bibliography Subsection</title>
|
300
|
+
</references>
|
301
|
+
</clause>
|
302
|
+
</bibliography>
|
303
|
+
</iso-standard>
|
304
|
+
INPUT
|
305
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
306
|
+
<bibdata>
|
307
|
+
<language current="true">tlh</language>
|
308
|
+
</bibdata>
|
309
|
+
<preface>
|
310
|
+
<foreword obligation='informative'>
|
311
|
+
<title>Foreword</title>
|
312
|
+
<p id='A'>This is a preamble</p>
|
313
|
+
</foreword>
|
314
|
+
<introduction id='B' obligation='informative'>
|
315
|
+
<title depth='1'>
|
316
|
+
0
|
317
|
+
<tab/>
|
318
|
+
Introduction
|
319
|
+
</title>
|
320
|
+
<clause id='C' inline-header='false' obligation='informative'>
|
321
|
+
<title depth='2'>
|
322
|
+
0.1
|
323
|
+
<tab/>
|
324
|
+
Introduction Subsection
|
325
|
+
</title>
|
326
|
+
</clause>
|
327
|
+
<p>This is patent boilerplate</p>
|
328
|
+
</introduction>
|
329
|
+
</preface>
|
330
|
+
<sections>
|
331
|
+
<clause id='D' obligation='normative' type="scope">
|
332
|
+
<title depth='1'>
|
333
|
+
1
|
334
|
+
<tab/>
|
335
|
+
Scope
|
336
|
+
</title>
|
337
|
+
<p id='E'>Text</p>
|
338
|
+
</clause>
|
339
|
+
<clause id='H' obligation='normative'>
|
340
|
+
<title depth='1'>
|
341
|
+
3
|
342
|
+
<tab/>
|
343
|
+
Terms, definitions, symbols and abbreviated terms
|
344
|
+
</title>
|
345
|
+
<terms id='I' obligation='normative'>
|
346
|
+
<title depth='2'>
|
347
|
+
3.1
|
348
|
+
<tab/>
|
349
|
+
Normal Terms
|
350
|
+
</title>
|
351
|
+
<term id='J'>
|
352
|
+
<name>3.1.1</name>
|
353
|
+
<preferred>Term2</preferred>
|
354
|
+
</term>
|
355
|
+
</terms>
|
356
|
+
<definitions id='K' inline-header='true'>
|
357
|
+
<title>3.2</title>
|
358
|
+
<dl>
|
359
|
+
<dt>Symbol</dt>
|
360
|
+
<dd>Definition</dd>
|
361
|
+
</dl>
|
362
|
+
</definitions>
|
363
|
+
</clause>
|
364
|
+
<definitions id='L'>
|
365
|
+
<title>4</title>
|
366
|
+
<dl>
|
367
|
+
<dt>Symbol</dt>
|
368
|
+
<dd>Definition</dd>
|
369
|
+
</dl>
|
370
|
+
</definitions>
|
371
|
+
<clause id='M' inline-header='false' obligation='normative'>
|
372
|
+
<title depth='1'>
|
373
|
+
5
|
374
|
+
<tab/>
|
375
|
+
Clause 4
|
376
|
+
</title>
|
377
|
+
<clause id='N' inline-header='false' obligation='normative'>
|
378
|
+
<title depth='2'>
|
379
|
+
5.1
|
380
|
+
<tab/>
|
381
|
+
Introduction
|
382
|
+
</title>
|
383
|
+
</clause>
|
384
|
+
<clause id='O' inline-header='false' obligation='normative'>
|
385
|
+
<title depth='2'>
|
386
|
+
5.2
|
387
|
+
<tab/>
|
388
|
+
Clause 4.2
|
389
|
+
</title>
|
390
|
+
</clause>
|
391
|
+
</clause>
|
392
|
+
</sections>
|
393
|
+
<annex id='P' inline-header='false' obligation='normative'>
|
394
|
+
<title>
|
395
|
+
<strong>Annex A</strong>
|
396
|
+
<br/>
|
397
|
+
(normative)
|
398
|
+
<br/>
|
399
|
+
<br/>
|
400
|
+
<strong>Annex</strong>
|
401
|
+
</title>
|
402
|
+
<clause id='Q' inline-header='false' obligation='normative'>
|
403
|
+
<title depth='2'>
|
404
|
+
A.1
|
405
|
+
<tab/>
|
406
|
+
Annex A.1
|
407
|
+
</title>
|
408
|
+
<clause id='Q1' inline-header='false' obligation='normative'>
|
409
|
+
<title depth='3'>
|
410
|
+
A.1.1
|
411
|
+
<tab/>
|
412
|
+
Annex A.1a
|
413
|
+
</title>
|
414
|
+
</clause>
|
415
|
+
</clause>
|
416
|
+
<appendix id='Q2' inline-header='false' obligation='normative'>
|
417
|
+
<title depth='2'>
|
418
|
+
Appendix 1
|
419
|
+
<tab/>
|
420
|
+
An Appendix
|
421
|
+
</title>
|
422
|
+
</appendix>
|
423
|
+
</annex>
|
424
|
+
<bibliography>
|
425
|
+
<references id='R' obligation='informative' normative='true'>
|
426
|
+
<title depth='1'>
|
427
|
+
2
|
428
|
+
<tab/>
|
429
|
+
Normative References
|
430
|
+
</title>
|
431
|
+
</references>
|
432
|
+
<clause id='S' obligation='informative'>
|
433
|
+
<title depth='1'>Bibliography</title>
|
434
|
+
<references id='T' obligation='informative' normative='false'>
|
435
|
+
<title depth='2'>Bibliography Subsection</title>
|
436
|
+
</references>
|
437
|
+
</clause>
|
438
|
+
</bibliography>
|
439
|
+
</iso-standard>
|
440
|
+
OUTPUT
|
441
|
+
end
|
442
|
+
end
|