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.

Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +43 -0
  3. data/.github/workflows/release_github_packages.yml +49 -0
  4. data/.hound.yml +3 -1
  5. data/.rubocop.yml +4 -8
  6. data/README.adoc +95 -11
  7. data/lib/asciidoctor/bsi/biblio.rng +1 -0
  8. data/lib/asciidoctor/bsi/bsi.rng +32 -4
  9. data/lib/asciidoctor/bsi/bsi_intro_en.xml +87 -61
  10. data/lib/asciidoctor/bsi/cleanup.rb +15 -8
  11. data/lib/asciidoctor/bsi/cleanup_ref.rb +10 -21
  12. data/lib/asciidoctor/bsi/converter.rb +7 -5
  13. data/lib/asciidoctor/bsi/front.rb +26 -5
  14. data/lib/asciidoctor/bsi/isodoc.rng +191 -3
  15. data/lib/asciidoctor/bsi/isostandard.rng +12 -0
  16. data/lib/asciidoctor/bsi/validate.rb +5 -6
  17. data/lib/asciidoctor/bsi/validate_list.rb +2 -2
  18. data/lib/isodoc/bsi/base_convert.rb +2 -1
  19. data/lib/isodoc/bsi/bsi.international-standard.xsl +3380 -2349
  20. data/lib/isodoc/bsi/html/htmlstyle.css +43 -22
  21. data/lib/isodoc/bsi/html/htmlstyle.scss +46 -22
  22. data/lib/isodoc/bsi/html_convert.rb +2 -2
  23. data/lib/isodoc/bsi/i18n-en.yaml +4 -4
  24. data/lib/isodoc/bsi/metadata.rb +2 -2
  25. data/lib/isodoc/bsi/presentation_xml_convert.rb +26 -5
  26. data/lib/isodoc/bsi/xref.rb +11 -4
  27. data/lib/metanorma/bsi/version.rb +1 -1
  28. data/metanorma-bsi.gemspec +2 -2
  29. data/spec/asciidoctor/base_spec.rb +564 -494
  30. data/spec/asciidoctor/blocks_spec.rb +192 -195
  31. data/spec/asciidoctor/cleanup_spec.rb +361 -361
  32. data/spec/asciidoctor/refs_spec.rb +8 -78
  33. data/spec/asciidoctor/section_spec.rb +227 -227
  34. data/spec/asciidoctor/validate_spec.rb +26 -1
  35. data/spec/isodoc/blocks_spec.rb +56 -21
  36. data/spec/isodoc/i18n_spec.rb +156 -234
  37. data/spec/isodoc/inline_spec.rb +7 -7
  38. data/spec/isodoc/iso_spec.rb +4 -4
  39. data/spec/isodoc/metadata_spec.rb +0 -1
  40. data/spec/isodoc/ref_spec.rb +7 -7
  41. data/spec/isodoc/section_spec.rb +400 -343
  42. data/spec/isodoc/terms_spec.rb +224 -225
  43. data/spec/isodoc/xref_spec.rb +1347 -1360
  44. data/spec/metanorma/processor_spec.rb +37 -40
  45. data/spec/spec_helper.rb +6 -4
  46. data/spec/vcr_cassettes/iso-639.yml +19 -19
  47. data/spec/vcr_cassettes/isobib_get_639_1967.yml +17 -17
  48. data/spec/vcr_cassettes/multistandard.yml +15 -193
  49. metadata +7 -5
@@ -70,160 +70,158 @@ RSpec.describe IsoDoc do
70
70
  INPUT
71
71
 
72
72
  presxml = <<~OUTPUT
73
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
74
- <preface>
75
- <foreword obligation="informative">
76
- <title>Foreword</title>
77
- <p id="A">This is a preamble</p>
78
- </foreword>
79
- <introduction id="B" obligation="informative"><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">
85
- <title depth="1">1<tab/>Scope</title>
86
- <p id="E">Text</p>
87
- </clause>
88
-
89
- <clause id="H" obligation="normative"><title depth="1">3<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
90
- <title depth="2">3.1<tab/>Normal Terms</title>
91
- <term id="J"><name>3.1.1</name>
92
- <preferred>Term2</preferred>
93
- </term>
94
- </terms>
95
- <definitions id="K" inline-header='true'><title>3.2</title>
96
- <dl>
97
- <dt>Symbol</dt>
98
- <dd>Definition</dd>
99
- </dl>
100
- </definitions>
101
- </clause>
102
- <definitions id="L"><title>4</title>
103
- <dl>
104
- <dt>Symbol</dt>
105
- <dd>Definition</dd>
106
- </dl>
107
- </definitions>
108
- <clause id="M" inline-header="false" obligation="normative"><title depth="1">5<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
109
- <title depth="2">5.1<tab/>Introduction</title>
110
- </clause>
111
- <clause id="O" inline-header="false" obligation="normative">
112
- <title depth="2">5.2<tab/>Clause 4.2</title>
113
- </clause></clause>
114
-
115
- </sections><annex id="P" inline-header="false" obligation="normative">
116
- <title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
117
- <clause id="Q" inline-header="false" obligation="normative">
118
- <title depth="2">A.1<tab/>Annex A.1</title>
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
- </bibliography>
135
- </iso-standard>
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
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
140
- <head/>
141
- <body lang="en">
142
- <div class="title-section">
143
- <p>&#160;</p>
144
- </div>
145
- <br/>
146
- <div class="prefatory-section">
147
- <p>&#160;</p>
148
- </div>
149
- <br/>
150
- <div class="main-section">
151
- <br/>
152
- #{IEC_TITLE}
153
- <div>
154
- <h1 class="ForewordTitle">FOREWORD</h1>
155
- <div class="boilerplate_legal"/>
156
- <p id="A">This is a preamble</p>
157
- </div>
158
- <br/>
159
- <div class="Section3" id="B">
160
- <h1 class="IntroTitle">0&#8195;Introduction</h1>
161
- <div id="C">
162
- <h2>0.1&#8195;Introduction Subsection</h2>
163
- </div>
164
- <p>This is patent boilerplate</p>
165
- </div>
166
- #{IEC_TITLE1}
167
- <div id="D">
168
- <h1>1&#8195;Scope</h1>
169
- <p id="E">Text</p>
170
- </div>
171
- <div>
172
- <h1>2&#8195;Normative References</h1>
173
- </div>
174
- <div id="H"><h1>3&#8195;Terms, definitions, symbols and abbreviated terms</h1>
175
- <div id="I">
176
- <h2>3.1&#8195;Normal Terms</h2>
177
- <p class="TermNum" id="J">3.1.1</p>
178
- <p class="Terms" style="text-align:left;">Term2</p>
179
- </div><div id="K"><span class='zzMoveToFollowing'>
180
- <b>3.2&#8195;</b>
181
- </span>
182
- <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
183
- </div></div>
184
- <div id="L" class="Symbols">
185
- <h1>4</h1>
186
- <dl>
187
- <dt>
188
- <p>Symbol</p>
189
- </dt>
190
- <dd>Definition</dd>
191
- </dl>
192
- </div>
193
- <div id="M">
194
- <h1>5&#8195;Clause 4</h1>
195
- <div id="N">
196
- <h2>5.1&#8195;Introduction</h2>
197
- </div>
198
- <div id="O">
199
- <h2>5.2&#8195;Clause 4.2</h2>
200
- </div>
201
- </div>
202
- <br/>
203
- <div id="P" class="Section3">
204
- <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
205
- <div id="Q">
206
- <h2>A.1&#8195;Annex A.1</h2>
207
- <div id="Q1">
208
- <h3>A.1.1&#8195;Annex A.1a</h3>
209
- </div>
210
- </div>
211
- <div id="Q2">
212
- <h2>Appendix 1&#8195;An Appendix</h2>
213
- </div>
214
-
215
- </div>
216
- <br/>
217
- <div>
218
- <h1 class="Section3">Bibliography</h1>
219
- <div>
220
- <h2 class="Section3">Bibliography Subsection</h2>
221
- </div>
222
- </div>
223
- </div>
224
- </body>
225
- </html>
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>&#160;</p>
143
+ </div>
144
+ <br/>
145
+ <div class="prefatory-section">
146
+ <p>&#160;</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&#8195;Introduction</h1>
160
+ <div id="C">
161
+ <h2>0.1&#8195;Introduction Subsection</h2>
162
+ </div>
163
+ <p>This is patent boilerplate</p>
164
+ </div>
165
+ #{IEC_TITLE1}
166
+ <div id="D">
167
+ <h1>1&#8195;Scope</h1>
168
+ <p id="E">Text</p>
169
+ </div>
170
+ <div>
171
+ <h1>2&#8195;Normative References</h1>
172
+ </div>
173
+ <div id="H"><h1>3&#8195;Terms, definitions, symbols and abbreviated terms</h1>
174
+ <div id="I">
175
+ <h2>3.1&#8195;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&#8195;</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&#8195;Clause 4</h1>
194
+ <div id="N">
195
+ <h2>5.1&#8195;Introduction</h2>
196
+ </div>
197
+ <div id="O">
198
+ <h2>5.2&#8195;Clause 4.2</h2>
199
+ </div>
200
+ </div>
201
+ <br/>
202
+ <div id="P" class="Section3">
203
+ <h1 class="Annex"><b>Annex A</b>&#8195;(normative)<br/><b>Annex</b></h1>
204
+ <div id="Q">
205
+ <h2>A.1&#8195;Annex A.1</h2>
206
+ <div id="Q1">
207
+ <h3>A.1.1&#8195;Annex A.1a</h3>
208
+ </div>
209
+ </div>
210
+ <div id="Q2">
211
+ <h2>Appendix 1&#8195;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
- <iso-standard xmlns="http://riboseinc.com/isoxml">
235
- <sections>
236
- <clause id="D" obligation="normative">
237
- <title>Scope</title>
238
- <clause id="D1" obligation="normative">
239
- <title>Scope 1</title>
240
- </clause>
241
- <clause id="D2" obligation="normative">
242
- </clause>
243
- </clause>
244
- </sections>
245
- </iso-standard>
246
- INPUT
247
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
248
- <sections>
249
- <clause id='D' obligation='normative'>
250
- <title depth='1'>
251
- 1
252
- <tab/>
253
- Scope
254
- </title>
255
- <clause id='D1' obligation='normative'>
256
- <title depth='2'>
257
- 1.1
258
- <tab/>
259
- Scope 1
260
- </title>
261
- </clause>
262
- <clause id='D2' obligation='normative' inline-header='true'>
263
- <title>1.2</title>
264
- </clause>
265
- </clause>
266
- </sections>
267
- </iso-standard>
268
- OUTPUT
269
- end
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
- expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
274
- <iso-standard xmlns="http://riboseinc.com/isoxml">
275
- <sections>
276
- <terms id="H" obligation="normative"><title>1<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
277
- <term id="J">
278
- <name>1.1</name>
279
- <preferred>Term2</preferred>
280
- </term>
281
- </terms>
282
- </sections>
283
- </iso-standard>
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
- #{HTML_HDR}
286
- <div id="">
287
- <h1 class="ForewordTitle">FOREWORD</h1>
288
- <div class="boilerplate_legal"/>
289
- </div>
290
- #{IEC_TITLE1}
291
- <div id="H"><h1>1&#8195;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&#8195;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
- </body>
297
- </html>
292
+ </div>
293
+ </body>
294
+ </html>
298
295
  OUTPUT
299
296
  end
300
297
 
301
- it "processes inline section headers" do
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
- <iso-standard xmlns="http://riboseinc.com/isoxml">
304
- <sections>
305
- <clause id="M" inline-header="false" obligation="normative"><title>1<tab/>Clause 4</title>
306
- <clause id="N" inline-header="false" obligation="normative">
307
- <title>1.1<tab/>Introduction</title>
308
- </clause>
309
- <clause id="O" inline-header="true" obligation="normative">
310
- <title>1.2<tab/>Clause 4.2</title>
311
- </clause></clause>
312
-
313
- </sections>
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
- #{HTML_HDR}
317
- <div id="">
318
- <h1 class="ForewordTitle">FOREWORD</h1>
319
- <div class="boilerplate_legal"/>
320
- </div>
321
- #{IEC_TITLE1}
322
- <div id="M">
323
- <h1>1&#8195;Clause 4</h1>
324
- <div id="N">
325
- <h2>1.1&#8195;Introduction</h2>
326
- </div>
327
- <div id="O">
328
- <span class="zzMoveToFollowing"><b>1.2&#8195;Clause 4.2&#8195;</b></span>
329
- </div>
330
- </div>
331
- </div>
332
- </body>
333
- </html>
334
- OUTPUT
335
- end
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&#8195;Clause 4</h1>
320
+ <div id="N">
321
+ <h2>1.1&#8195;Introduction</h2>
322
+ </div>
323
+ <div id="O">
324
+ <span class="zzMoveToFollowing"><b>1.2&#8195;Clause 4.2&#8195;</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
- expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
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
- #{HTML_HDR}
352
- <div id="">
353
- <h1 class="ForewordTitle">FOREWORD</h1>
354
- <div class="boilerplate_legal">
355
- <p>Boilerplate</p>
356
- </div>
357
- </div>
358
- #{IEC_TITLE1}
359
- </div>
360
- </body>
361
- </html>
362
- OUTPUT
363
- end
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
- it "does not add boilerplate to foreword in amendments" do
366
- expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
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
- #{HTML_HDR}
380
- <div id="">
381
- <h1 class="ForewordTitle">FOREWORD</h1>
382
- </div>
383
- #{IEC_TITLE1}
384
- </div>
385
- </body>
386
- </html>
387
- OUTPUT
388
- end
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
- it "deals with unnumbered normative reference subheadings" do
391
- input = <<~INPUT
392
- <iso-standard xmlns="http://riboseinc.com/isoxml">
393
- <sections>
394
- <clause id="D" obligation="normative" type="scope">
395
- <title>Scope</title>
396
- <p id="E">Text</p>
397
- </clause>
398
- </sections>
399
- <bibliography>
400
- <clause id="S" obligation="normative">
401
- <title>Bibliography</title>
402
- <references id="T" obligation="informative" normative="true" unnumbered="true">
403
- <title>Bibliography Subsection</title>
404
- </references>
405
- </clause>
406
- </bibliography>
407
- </iso-standard>
408
- INPUT
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
- presxml = <<~PRESXML
411
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
412
- <sections>
413
- <clause id='D' obligation='normative' type='scope'>
414
- <title depth='1'>
415
- 1
416
- <tab/>
417
- Scope
418
- </title>
419
- <p id='E'>Text</p>
420
- </clause>
421
- </sections>
422
- <bibliography>
423
- <clause id='S' obligation='normative'>
424
- <title depth='1'>
425
- 2
426
- <tab/>
427
- Bibliography
428
- </title>
429
- <references id='T' obligation='informative' normative='true' unnumbered='true'>
430
- <title depth='2'>Bibliography Subsection</title>
431
- </references>
432
- </clause>
433
- </bibliography>
434
- </iso-standard>
435
- PRESXML
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
- html = <<~HTML
438
- #{HTML_HDR}
439
- <div id=''>
440
- <h1 class='ForewordTitle'>FOREWORD</h1>
441
- <div class='boilerplate_legal'/>
442
- </div>
443
- <p class='zzSTDTitle1'>
444
- <b/>
445
- </p>
446
- <p class='zzSTDTitle1'>&#160;</p>
447
- <div id='D'>
448
- <h1> 1 &#8195; Scope </h1>
449
- <p id='E'>Text</p>
450
- </div>
451
- <div>
452
- <h1> 2 &#8195; Bibliography </h1>
453
- <div>
454
- <h2 class='Section3'>Bibliography Subsection</h2>
455
- </div>
456
- </div>
457
- </div>
458
- </body>
459
- </html>
460
- HTML
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'>&#160;</p>
443
+ <div id='D'>
444
+ <h1> 1 &#8195; Scope </h1>
445
+ <p id='E'>Text</p>
446
+ </div>
447
+ <div>
448
+ <h1> 2 &#8195; 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
- expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
463
- .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
464
- expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({})
465
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
466
- end
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