metanorma-bsi 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of metanorma-bsi might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +43 -0
- data/.github/workflows/release_github_packages.yml +49 -0
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -8
- data/README.adoc +95 -11
- data/lib/asciidoctor/bsi/biblio.rng +1 -0
- data/lib/asciidoctor/bsi/bsi.rng +32 -4
- data/lib/asciidoctor/bsi/bsi_intro_en.xml +87 -61
- data/lib/asciidoctor/bsi/cleanup.rb +15 -8
- data/lib/asciidoctor/bsi/cleanup_ref.rb +10 -21
- data/lib/asciidoctor/bsi/converter.rb +7 -5
- data/lib/asciidoctor/bsi/front.rb +26 -5
- data/lib/asciidoctor/bsi/isodoc.rng +191 -3
- data/lib/asciidoctor/bsi/isostandard.rng +12 -0
- data/lib/asciidoctor/bsi/validate.rb +5 -6
- data/lib/asciidoctor/bsi/validate_list.rb +2 -2
- data/lib/isodoc/bsi/base_convert.rb +2 -1
- data/lib/isodoc/bsi/bsi.international-standard.xsl +3380 -2349
- data/lib/isodoc/bsi/html/htmlstyle.css +43 -22
- data/lib/isodoc/bsi/html/htmlstyle.scss +46 -22
- data/lib/isodoc/bsi/html_convert.rb +2 -2
- data/lib/isodoc/bsi/i18n-en.yaml +4 -4
- data/lib/isodoc/bsi/metadata.rb +2 -2
- data/lib/isodoc/bsi/presentation_xml_convert.rb +26 -5
- data/lib/isodoc/bsi/xref.rb +11 -4
- data/lib/metanorma/bsi/version.rb +1 -1
- data/metanorma-bsi.gemspec +2 -2
- data/spec/asciidoctor/base_spec.rb +564 -494
- data/spec/asciidoctor/blocks_spec.rb +192 -195
- data/spec/asciidoctor/cleanup_spec.rb +361 -361
- data/spec/asciidoctor/refs_spec.rb +8 -78
- data/spec/asciidoctor/section_spec.rb +227 -227
- data/spec/asciidoctor/validate_spec.rb +26 -1
- data/spec/isodoc/blocks_spec.rb +56 -21
- data/spec/isodoc/i18n_spec.rb +156 -234
- data/spec/isodoc/inline_spec.rb +7 -7
- data/spec/isodoc/iso_spec.rb +4 -4
- data/spec/isodoc/metadata_spec.rb +0 -1
- data/spec/isodoc/ref_spec.rb +7 -7
- data/spec/isodoc/section_spec.rb +400 -343
- data/spec/isodoc/terms_spec.rb +224 -225
- data/spec/isodoc/xref_spec.rb +1347 -1360
- data/spec/metanorma/processor_spec.rb +37 -40
- data/spec/spec_helper.rb +6 -4
- data/spec/vcr_cassettes/iso-639.yml +19 -19
- data/spec/vcr_cassettes/isobib_get_639_1967.yml +17 -17
- data/spec/vcr_cassettes/multistandard.yml +15 -193
- metadata +7 -5
data/spec/isodoc/section_spec.rb
CHANGED
@@ -70,160 +70,158 @@ RSpec.describe IsoDoc do
|
|
70
70
|
INPUT
|
71
71
|
|
72
72
|
presxml = <<~OUTPUT
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
<
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
<
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
<
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
<
|
109
|
-
|
110
|
-
|
111
|
-
<
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
<clause id="Q1" inline-header="false" obligation="normative">
|
120
|
-
<title depth="3">A.1.1<tab/>Annex A.1a</title>
|
121
|
-
</clause>
|
122
|
-
</clause>
|
123
|
-
<appendix id="Q2" inline-header="false" obligation="normative">
|
124
|
-
<title depth="2">Appendix 1<tab/>An Appendix</title>
|
125
|
-
</appendix>
|
126
|
-
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
127
|
-
<title depth="1">2<tab/>Normative References</title>
|
128
|
-
</references><clause id="S" obligation="informative">
|
129
|
-
<title depth="1">Bibliography</title>
|
130
|
-
<references id="T" obligation="informative" normative="false">
|
131
|
-
<title depth="2">Bibliography Subsection</title>
|
132
|
-
</references>
|
73
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
74
|
+
<preface>
|
75
|
+
<foreword obligation="informative" displayorder="1">
|
76
|
+
<title>Foreword</title>
|
77
|
+
<p id="A">This is a preamble</p>
|
78
|
+
</foreword>
|
79
|
+
<introduction id="B" obligation="informative" displayorder="2"><title depth="1">0<tab/>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
80
|
+
<title depth="2">0.1<tab/>Introduction Subsection</title>
|
81
|
+
</clause>
|
82
|
+
<p>This is patent boilerplate</p>
|
83
|
+
</introduction></preface><sections>
|
84
|
+
<clause id="D" obligation="normative" type="scope" displayorder="3">
|
85
|
+
<title depth="1">1<tab/>Scope</title>
|
86
|
+
<p id="E">Text</p>
|
87
|
+
</clause>
|
88
|
+
<clause id="H" obligation="normative" displayorder="5"><title depth="1">3<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
89
|
+
<title depth="2">3.1<tab/>Normal Terms</title>
|
90
|
+
<term id="J"><name>3.1.1</name>
|
91
|
+
<preferred>Term2</preferred>
|
92
|
+
</term>
|
93
|
+
</terms>
|
94
|
+
<definitions id="K" inline-header="true"><title>3.2</title>
|
95
|
+
<dl>
|
96
|
+
<dt>Symbol</dt>
|
97
|
+
<dd>Definition</dd>
|
98
|
+
</dl>
|
99
|
+
</definitions>
|
100
|
+
</clause>
|
101
|
+
<definitions id="L" displayorder="6"><title>4</title>
|
102
|
+
<dl>
|
103
|
+
<dt>Symbol</dt>
|
104
|
+
<dd>Definition</dd>
|
105
|
+
</dl>
|
106
|
+
</definitions>
|
107
|
+
<clause id="M" inline-header="false" obligation="normative" displayorder="7"><title depth="1">5<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
108
|
+
<title depth="2">5.1<tab/>Introduction</title>
|
109
|
+
</clause>
|
110
|
+
<clause id="O" inline-header="false" obligation="normative">
|
111
|
+
<title depth="2">5.2<tab/>Clause 4.2</title>
|
112
|
+
</clause></clause>
|
113
|
+
</sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
|
114
|
+
<title><strong>Annex A</strong><tab/>(normative)<br/><strong>Annex</strong></title>
|
115
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
116
|
+
<title depth="2">A.1<tab/>Annex A.1</title>
|
117
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
118
|
+
<title depth="3">A.1.1<tab/>Annex A.1a</title>
|
133
119
|
</clause>
|
134
|
-
|
135
|
-
|
120
|
+
</clause>
|
121
|
+
<appendix id="Q2" inline-header="false" obligation="normative">
|
122
|
+
<title depth="2">Appendix 1<tab/>An Appendix</title>
|
123
|
+
</appendix>
|
124
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true" displayorder="4">
|
125
|
+
<title depth="1">2<tab/>Normative References</title>
|
126
|
+
</references>
|
127
|
+
<clause id="S" obligation="informative" displayorder="9">
|
128
|
+
<title depth="1">Bibliography</title>
|
129
|
+
<references id="T" obligation="informative" normative="false">
|
130
|
+
<title depth="2">Bibliography Subsection</title>
|
131
|
+
</references>
|
132
|
+
</clause>
|
133
|
+
</bibliography>
|
134
|
+
</iso-standard>
|
136
135
|
OUTPUT
|
137
136
|
|
138
137
|
html = <<~OUTPUT
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
</span>
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
OUTPUT
|
138
|
+
<html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
|
139
|
+
<head/>
|
140
|
+
<body lang="en">
|
141
|
+
<div class="title-section">
|
142
|
+
<p> </p>
|
143
|
+
</div>
|
144
|
+
<br/>
|
145
|
+
<div class="prefatory-section">
|
146
|
+
<p> </p>
|
147
|
+
</div>
|
148
|
+
<br/>
|
149
|
+
<div class="main-section">
|
150
|
+
<br/>
|
151
|
+
#{IEC_TITLE}
|
152
|
+
<div>
|
153
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
154
|
+
<div class="boilerplate_legal"/>
|
155
|
+
<p id="A">This is a preamble</p>
|
156
|
+
</div>
|
157
|
+
<br/>
|
158
|
+
<div class="Section3" id="B">
|
159
|
+
<h1 class="IntroTitle">0 Introduction</h1>
|
160
|
+
<div id="C">
|
161
|
+
<h2>0.1 Introduction Subsection</h2>
|
162
|
+
</div>
|
163
|
+
<p>This is patent boilerplate</p>
|
164
|
+
</div>
|
165
|
+
#{IEC_TITLE1}
|
166
|
+
<div id="D">
|
167
|
+
<h1>1 Scope</h1>
|
168
|
+
<p id="E">Text</p>
|
169
|
+
</div>
|
170
|
+
<div>
|
171
|
+
<h1>2 Normative References</h1>
|
172
|
+
</div>
|
173
|
+
<div id="H"><h1>3 Terms, definitions, symbols and abbreviated terms</h1>
|
174
|
+
<div id="I">
|
175
|
+
<h2>3.1 Normal Terms</h2>
|
176
|
+
<p class="TermNum" id="J">3.1.1</p>
|
177
|
+
<p class="Terms" style="text-align:left;">Term2</p>
|
178
|
+
</div><div id="K"><span class='zzMoveToFollowing'>
|
179
|
+
<b>3.2 </b>
|
180
|
+
</span>
|
181
|
+
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
182
|
+
</div></div>
|
183
|
+
<div id="L" class="Symbols">
|
184
|
+
<h1>4</h1>
|
185
|
+
<dl>
|
186
|
+
<dt>
|
187
|
+
<p>Symbol</p>
|
188
|
+
</dt>
|
189
|
+
<dd>Definition</dd>
|
190
|
+
</dl>
|
191
|
+
</div>
|
192
|
+
<div id="M">
|
193
|
+
<h1>5 Clause 4</h1>
|
194
|
+
<div id="N">
|
195
|
+
<h2>5.1 Introduction</h2>
|
196
|
+
</div>
|
197
|
+
<div id="O">
|
198
|
+
<h2>5.2 Clause 4.2</h2>
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
<br/>
|
202
|
+
<div id="P" class="Section3">
|
203
|
+
<h1 class="Annex"><b>Annex A</b> (normative)<br/><b>Annex</b></h1>
|
204
|
+
<div id="Q">
|
205
|
+
<h2>A.1 Annex A.1</h2>
|
206
|
+
<div id="Q1">
|
207
|
+
<h3>A.1.1 Annex A.1a</h3>
|
208
|
+
</div>
|
209
|
+
</div>
|
210
|
+
<div id="Q2">
|
211
|
+
<h2>Appendix 1 An Appendix</h2>
|
212
|
+
</div>
|
213
|
+
</div>
|
214
|
+
<br/>
|
215
|
+
<div>
|
216
|
+
<h1 class="Section3">Bibliography</h1>
|
217
|
+
<div>
|
218
|
+
<h2 class="Section3">Bibliography Subsection</h2>
|
219
|
+
</div>
|
220
|
+
</div>
|
221
|
+
</div>
|
222
|
+
</body>
|
223
|
+
</html>
|
224
|
+
OUTPUT
|
227
225
|
|
228
226
|
expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
229
227
|
expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
@@ -231,111 +229,109 @@ OUTPUT
|
|
231
229
|
|
232
230
|
it "processes subclauses with and without titles" do
|
233
231
|
expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
<clause id="D1" obligation="normative">
|
239
|
-
|
240
|
-
|
241
|
-
<clause id="D2" obligation="normative">
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
INPUT
|
247
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
</iso-standard>
|
268
|
-
OUTPUT
|
269
|
-
|
270
|
-
|
232
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
233
|
+
<sections>
|
234
|
+
<clause id="D" obligation="normative">
|
235
|
+
<title>Scope</title>
|
236
|
+
<clause id="D1" obligation="normative">
|
237
|
+
<title>Scope 1</title>
|
238
|
+
</clause>
|
239
|
+
<clause id="D2" obligation="normative">
|
240
|
+
</clause>
|
241
|
+
</clause>
|
242
|
+
</sections>
|
243
|
+
</iso-standard>
|
244
|
+
INPUT
|
245
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
246
|
+
<sections>
|
247
|
+
<clause id='D' obligation='normative' displayorder="1">
|
248
|
+
<title depth='1'>
|
249
|
+
1
|
250
|
+
<tab/>
|
251
|
+
Scope
|
252
|
+
</title>
|
253
|
+
<clause id='D1' obligation='normative'>
|
254
|
+
<title depth='2'>
|
255
|
+
1.1
|
256
|
+
<tab/>
|
257
|
+
Scope 1
|
258
|
+
</title>
|
259
|
+
</clause>
|
260
|
+
<clause id='D2' obligation='normative' inline-header='true'>
|
261
|
+
<title>1.2</title>
|
262
|
+
</clause>
|
263
|
+
</clause>
|
264
|
+
</sections>
|
265
|
+
</iso-standard>
|
266
|
+
OUTPUT
|
267
|
+
end
|
271
268
|
|
272
269
|
it "processes simple terms & definitions" do
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
270
|
+
expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
271
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
272
|
+
<sections>
|
273
|
+
<terms id="H" obligation="normative"><title>1<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
274
|
+
<term id="J">
|
275
|
+
<name>1.1</name>
|
276
|
+
<preferred>Term2</preferred>
|
277
|
+
</term>
|
278
|
+
</terms>
|
279
|
+
</sections>
|
280
|
+
</iso-standard>
|
284
281
|
INPUT
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
</div>
|
290
|
-
#{IEC_TITLE1}
|
291
|
-
<div id="H"><h1>1 Terms, Definitions, Symbols and Abbreviated Terms</h1>
|
292
|
-
<p class="TermNum" id="J">1.1</p>
|
293
|
-
<p class="Terms" style="text-align:left;">Term2</p>
|
282
|
+
#{HTML_HDR}
|
283
|
+
<div id="">
|
284
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
285
|
+
<div class="boilerplate_legal"/>
|
294
286
|
</div>
|
287
|
+
#{IEC_TITLE1}
|
288
|
+
<div id="H"><h1>1 Terms, Definitions, Symbols and Abbreviated Terms</h1>
|
289
|
+
<p class="TermNum" id="J">1.1</p>
|
290
|
+
<p class="Terms" style="text-align:left;">Term2</p>
|
295
291
|
</div>
|
296
|
-
|
297
|
-
|
292
|
+
</div>
|
293
|
+
</body>
|
294
|
+
</html>
|
298
295
|
OUTPUT
|
299
296
|
end
|
300
297
|
|
301
|
-
|
298
|
+
it "processes inline section headers" do
|
302
299
|
expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
<clause id="N" inline-header="false" obligation="normative">
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
</iso-standard>
|
300
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
301
|
+
<sections>
|
302
|
+
<clause id="M" inline-header="false" obligation="normative"><title>1<tab/>Clause 4</title>
|
303
|
+
<clause id="N" inline-header="false" obligation="normative">
|
304
|
+
<title>1.1<tab/>Introduction</title>
|
305
|
+
</clause>
|
306
|
+
<clause id="O" inline-header="true" obligation="normative">
|
307
|
+
<title>1.2<tab/>Clause 4.2</title>
|
308
|
+
</clause></clause>
|
309
|
+
</sections>
|
310
|
+
</iso-standard>
|
315
311
|
INPUT
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
</div>
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
OUTPUT
|
335
|
-
|
312
|
+
#{HTML_HDR}
|
313
|
+
<div id="">
|
314
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
315
|
+
<div class="boilerplate_legal"/>
|
316
|
+
</div>
|
317
|
+
#{IEC_TITLE1}
|
318
|
+
<div id="M">
|
319
|
+
<h1>1 Clause 4</h1>
|
320
|
+
<div id="N">
|
321
|
+
<h2>1.1 Introduction</h2>
|
322
|
+
</div>
|
323
|
+
<div id="O">
|
324
|
+
<span class="zzMoveToFollowing"><b>1.2 Clause 4.2 </b></span>
|
325
|
+
</div>
|
326
|
+
</div>
|
327
|
+
</div>
|
328
|
+
</body>
|
329
|
+
</html>
|
330
|
+
OUTPUT
|
331
|
+
end
|
336
332
|
|
337
|
-
it "adds boilerplate to foreword" do
|
338
|
-
|
333
|
+
it "adds boilerplate to foreword" do
|
334
|
+
expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
339
335
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
340
336
|
<bibdata>
|
341
337
|
<ext><doctype>International Standard</doctype></ext>
|
@@ -348,22 +344,22 @@ OUTPUT
|
|
348
344
|
<sections/>
|
349
345
|
</iso-standard>
|
350
346
|
INPUT
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
</div>
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
OUTPUT
|
363
|
-
|
347
|
+
#{HTML_HDR}
|
348
|
+
<div id="">
|
349
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
350
|
+
<div class="boilerplate_legal">
|
351
|
+
<p>Boilerplate</p>
|
352
|
+
</div>
|
353
|
+
</div>
|
354
|
+
#{IEC_TITLE1}
|
355
|
+
</div>
|
356
|
+
</body>
|
357
|
+
</html>
|
358
|
+
OUTPUT
|
359
|
+
end
|
364
360
|
|
365
|
-
|
366
|
-
|
361
|
+
it "does not add boilerplate to foreword in amendments" do
|
362
|
+
expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
367
363
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
368
364
|
<bibdata>
|
369
365
|
<ext><doctype>Amendment</doctype></ext>
|
@@ -376,92 +372,153 @@ OUTPUT
|
|
376
372
|
<sections/>
|
377
373
|
</iso-standard>
|
378
374
|
INPUT
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
</div>
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
OUTPUT
|
388
|
-
|
375
|
+
#{HTML_HDR}
|
376
|
+
<div id="">
|
377
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
378
|
+
</div>
|
379
|
+
#{IEC_TITLE1}
|
380
|
+
</div>
|
381
|
+
</body>
|
382
|
+
</html>
|
383
|
+
OUTPUT
|
384
|
+
end
|
389
385
|
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
386
|
+
it "deals with unnumbered normative reference subheadings" do
|
387
|
+
input = <<~INPUT
|
388
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
389
|
+
<sections>
|
390
|
+
<clause id="D" obligation="normative" type="scope">
|
391
|
+
<title>Scope</title>
|
392
|
+
<p id="E">Text</p>
|
393
|
+
</clause>
|
394
|
+
</sections>
|
395
|
+
<bibliography>
|
396
|
+
<clause id="S" obligation="normative">
|
397
|
+
<title>Bibliography</title>
|
398
|
+
<references id="T" obligation="informative" normative="true" unnumbered="true">
|
399
|
+
<title>Bibliography Subsection</title>
|
400
|
+
</references>
|
401
|
+
</clause>
|
402
|
+
</bibliography>
|
403
|
+
</iso-standard>
|
404
|
+
INPUT
|
409
405
|
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
</iso-standard>
|
435
|
-
|
406
|
+
presxml = <<~PRESXML
|
407
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
408
|
+
<sections>
|
409
|
+
<clause id='D' obligation='normative' type='scope' displayorder="1">
|
410
|
+
<title depth='1'>
|
411
|
+
1
|
412
|
+
<tab/>
|
413
|
+
Scope
|
414
|
+
</title>
|
415
|
+
<p id='E'>Text</p>
|
416
|
+
</clause>
|
417
|
+
</sections>
|
418
|
+
<bibliography>
|
419
|
+
<clause id='S' obligation='normative' displayorder="2">
|
420
|
+
<title depth='1'>
|
421
|
+
2
|
422
|
+
<tab/>
|
423
|
+
Bibliography
|
424
|
+
</title>
|
425
|
+
<references id='T' obligation='informative' normative='true' unnumbered='true'>
|
426
|
+
<title depth='2'>Bibliography Subsection</title>
|
427
|
+
</references>
|
428
|
+
</clause>
|
429
|
+
</bibliography>
|
430
|
+
</iso-standard>
|
431
|
+
PRESXML
|
436
432
|
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
</html>
|
460
|
-
|
433
|
+
html = <<~HTML
|
434
|
+
#{HTML_HDR}
|
435
|
+
<div id=''>
|
436
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
437
|
+
<div class='boilerplate_legal'/>
|
438
|
+
</div>
|
439
|
+
<p class='zzSTDTitle1'>
|
440
|
+
<b/>
|
441
|
+
</p>
|
442
|
+
<p class='zzSTDTitle1'> </p>
|
443
|
+
<div id='D'>
|
444
|
+
<h1> 1   Scope </h1>
|
445
|
+
<p id='E'>Text</p>
|
446
|
+
</div>
|
447
|
+
<div>
|
448
|
+
<h1> 2   Bibliography </h1>
|
449
|
+
<div>
|
450
|
+
<h2 class='Section3'>Bibliography Subsection</h2>
|
451
|
+
</div>
|
452
|
+
</div>
|
453
|
+
</div>
|
454
|
+
</body>
|
455
|
+
</html>
|
456
|
+
HTML
|
457
|
+
|
458
|
+
expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
|
459
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
460
|
+
expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({})
|
461
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
462
|
+
end
|
463
|
+
|
464
|
+
it "renders related BSI references" do
|
465
|
+
input = <<~INPUT
|
466
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
467
|
+
<bibdata>
|
468
|
+
<relation type='related'>
|
469
|
+
<bibitem>
|
470
|
+
<title>--</title>
|
471
|
+
<docidentifier>Committee reference DEF/1</docidentifier>
|
472
|
+
</bibitem>
|
473
|
+
</relation>
|
474
|
+
<relation type='related'>
|
475
|
+
<bibitem>
|
476
|
+
<title>--</title>
|
477
|
+
<docidentifier>Draft for comment 20/30387670 DC</docidentifier>
|
478
|
+
</bibitem>
|
479
|
+
</relation>
|
480
|
+
</bibdata>
|
481
|
+
<preface>
|
482
|
+
<foreword/>
|
483
|
+
</preface>
|
484
|
+
<sections/>
|
485
|
+
</iso-standard>
|
486
|
+
INPUT
|
461
487
|
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
488
|
+
presxml = <<~PRESXML
|
489
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
490
|
+
<bibdata>
|
491
|
+
<relation type='related'>
|
492
|
+
<bibitem>
|
493
|
+
<title>--</title>
|
494
|
+
<docidentifier>Committee reference DEF/1</docidentifier>
|
495
|
+
</bibitem>
|
496
|
+
</relation>
|
497
|
+
<relation type='related'>
|
498
|
+
<bibitem>
|
499
|
+
<title>--</title>
|
500
|
+
<docidentifier>Draft for comment 20/30387670 DC</docidentifier>
|
501
|
+
</bibitem>
|
502
|
+
</relation>
|
503
|
+
</bibdata>
|
504
|
+
<preface>
|
505
|
+
<clause type='related-refs'>
|
506
|
+
<p>
|
507
|
+
The following BSI references relate to the work on this document:
|
508
|
+
<br/>
|
509
|
+
Committee reference DEF/1
|
510
|
+
<br/>
|
511
|
+
Draft for comment 20/30387670 DC
|
512
|
+
</p>
|
513
|
+
</clause>
|
514
|
+
<foreword displayorder="1"/>
|
515
|
+
</preface>
|
516
|
+
<sections/>
|
517
|
+
</iso-standard>
|
518
|
+
PRESXML
|
519
|
+
expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
|
520
|
+
.convert("test", input, true)
|
521
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, "")))
|
522
|
+
.to be_equivalent_to xmlpp(presxml)
|
523
|
+
end
|
467
524
|
end
|