metanorma-iso 1.8.4 → 1.8.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -318,7 +318,7 @@ RSpec.describe IsoDoc do
318
318
  <?xml version='1.0'?>
319
319
  <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
320
320
  <preface>
321
- <foreword>
321
+ <foreword displayorder="1">
322
322
  <p>
323
323
  <eref bibitemid="IEV" citeas="IEV" type="inline">
324
324
  <locality type="clause">
@@ -372,7 +372,7 @@ RSpec.describe IsoDoc do
372
372
  </foreword>
373
373
  </preface>
374
374
  <bibliography>
375
- <references id="_normative_references" normative="true" obligation="informative">
375
+ <references id="_normative_references" normative="true" obligation="informative" displayorder="2">
376
376
  <title depth="1">1<tab/>
377
377
  Normative References</title>
378
378
  <bibitem id="ISO712" type="standard">
@@ -177,8 +177,8 @@ RSpec.describe IsoDoc::Iso do
177
177
  OUTPUT
178
178
  end
179
179
 
180
- it "processes examples (Presentation XML)" do
181
- output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)
180
+ it "processes examples" do
181
+ input = <<~INPUT
182
182
  <iso-standard xmlns="http://riboseinc.com/isoxml">
183
183
  <preface>
184
184
  <foreword>
@@ -190,11 +190,11 @@ RSpec.describe IsoDoc::Iso do
190
190
  </preface>
191
191
  </iso-standard>
192
192
  INPUT
193
- expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
193
+ presxml = <<~OUTPUT
194
194
  <?xml version='1.0'?>
195
195
  <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
196
196
  <preface>
197
- <foreword>
197
+ <foreword displayorder="1">
198
198
  <example id="samplecode">
199
199
  <name>EXAMPLE — Title</name>
200
200
  <p>Hello</p>
@@ -203,22 +203,8 @@ RSpec.describe IsoDoc::Iso do
203
203
  </preface>
204
204
  </iso-standard>
205
205
  OUTPUT
206
- end
207
206
 
208
- it "processes examples (HTML)" do
209
- output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
210
- <iso-standard xmlns="http://riboseinc.com/isoxml">
211
- <preface>
212
- <foreword>
213
- <example id="samplecode">
214
- <name>EXAMPLE — Title</name>
215
- <p>Hello</p>
216
- </example>
217
- </foreword>
218
- </preface>
219
- </iso-standard>
220
- INPUT
221
- expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
207
+ html = <<~OUTPUT
222
208
  #{HTML_HDR}
223
209
  <br/>
224
210
  <div>
@@ -232,10 +218,49 @@ RSpec.describe IsoDoc::Iso do
232
218
  </body>
233
219
  </html>
234
220
  OUTPUT
221
+
222
+ word = <<~OUTPUT
223
+ <body lang="EN-US" link="blue" vlink="#954F72">
224
+ <div class="WordSection1">
225
+ <p>&#160;</p>
226
+ </div>
227
+ <p>
228
+ <br clear="all" class="section"/>
229
+ </p>
230
+ <div class="WordSection2">
231
+ <p>
232
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
233
+ </p>
234
+ <div>
235
+ <h1 class="ForewordTitle">Foreword</h1>
236
+ <div id="samplecode" class="example">
237
+ <p><span class="example_label">EXAMPLE&#160;&#8212; Title</span><span style="mso-tab-count:1">&#160; </span>Hello</p>
238
+ </div>
239
+ </div>
240
+ <p>&#160;</p>
241
+ </div>
242
+ <p>
243
+ <br clear="all" class="section"/>
244
+ </p>
245
+ <div class="WordSection3">
246
+ <p class="zzSTDTitle1"/>
247
+ </div>
248
+ <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
249
+ <div class="colophon"/>
250
+ </body>
251
+ OUTPUT
252
+ expect(IsoDoc::Iso::PresentationXMLConvert.new({})
253
+ .convert("test", input, true)).to be_equivalent_to xmlpp(presxml)
254
+ expect(IsoDoc::Iso::HtmlConvert.new({})
255
+ .convert("test", presxml, true)).to be_equivalent_to xmlpp(html)
256
+ output = IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
257
+ expect(xmlpp(output
258
+ .sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
259
+ .to be_equivalent_to xmlpp(word)
235
260
  end
236
261
 
237
- it "processes sequences of examples (Presentation XML)" do
238
- output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)
262
+ it "processes sequences of examples" do
263
+ input = <<~INPUT
239
264
  <iso-standard xmlns="http://riboseinc.com/isoxml">
240
265
  <preface>
241
266
  <foreword>
@@ -250,11 +275,11 @@ RSpec.describe IsoDoc::Iso do
250
275
  </preface>
251
276
  </iso-standard>
252
277
  INPUT
253
- expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
278
+ presxml = <<~OUTPUT
254
279
  <?xml version='1.0'?>
255
280
  <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
256
281
  <preface>
257
- <foreword>
282
+ <foreword displayorder="1">
258
283
  <example id="samplecode">
259
284
  <name>EXAMPLE 1</name>
260
285
  <quote>Hello</quote>
@@ -267,26 +292,7 @@ RSpec.describe IsoDoc::Iso do
267
292
  </preface>
268
293
  </iso-standard>
269
294
  OUTPUT
270
- end
271
-
272
- it "processes sequences of examples (HTML)" do
273
- output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
274
- <iso-standard xmlns="http://riboseinc.com/isoxml">
275
- <preface>
276
- <foreword>
277
- <example id="samplecode">
278
- <name>EXAMPLE 1</name>
279
- <quote>Hello</quote>
280
- </example>
281
- <example id="samplecode2">
282
- <name>EXAMPLE 2 — Title</name>
283
- <p>Hello</p>
284
- </example>
285
- </foreword>
286
- </preface>
287
- </iso-standard>
288
- INPUT
289
- expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
295
+ html = <<~OUTPUT
290
296
  #{HTML_HDR}
291
297
  <br/>
292
298
  <div>
@@ -304,105 +310,47 @@ RSpec.describe IsoDoc::Iso do
304
310
  </body>
305
311
  </html>
306
312
  OUTPUT
307
- end
308
-
309
- it "processes examples (Word)" do
310
- output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true)
311
- <iso-standard xmlns="http://riboseinc.com/isoxml">
312
- <preface>
313
- <foreword>
314
- <example id="samplecode">
315
- <name>EXAMPLE — Title</name>
316
- <p>Hello</p>
317
- </example>
318
- </foreword>
319
- </preface>
320
- </iso-standard>
321
- INPUT
322
- expect(xmlpp(output.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
323
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
324
- <body lang="EN-US" link="blue" vlink="#954F72">
325
- <div class="WordSection1">
326
- <p>&#160;</p>
327
- </div>
313
+ word = <<~OUTPUT
314
+ <body lang="EN-US" link="blue" vlink="#954F72">
315
+ <div class="WordSection1">
316
+ <p>&#160;</p>
317
+ </div>
318
+ <p>
319
+ <br clear="all" class="section"/>
320
+ </p>
321
+ <div class="WordSection2">
328
322
  <p>
329
- <br clear="all" class="section"/>
323
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
330
324
  </p>
331
- <div class="WordSection2">
332
- <p>
333
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
334
- </p>
335
- <div>
336
- <h1 class="ForewordTitle">Foreword</h1>
337
- <div id="samplecode" class="example">
338
- <p><span class="example_label">EXAMPLE&#160;&#8212; Title</span><span style="mso-tab-count:1">&#160; </span>Hello</p>
339
- </div>
325
+ <div>
326
+ <h1 class="ForewordTitle">Foreword</h1>
327
+ <div id="samplecode" class="example">
328
+ <p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">&#160; </span></p>
329
+ <div class="Quote">Hello</div>
340
330
  </div>
341
- <p>&#160;</p>
342
- </div>
343
- <p>
344
- <br clear="all" class="section"/>
345
- </p>
346
- <div class="WordSection3">
347
- <p class="zzSTDTitle1"/>
348
- </div>
349
- <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
350
- <div class="colophon"/>
351
- </body>
352
- OUTPUT
353
- end
354
-
355
- it "processes sequences of examples (Word)" do
356
- output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true)
357
- <iso-standard xmlns="http://riboseinc.com/isoxml">
358
- <preface>
359
- <foreword>
360
- <example id="samplecode">
361
- <name>EXAMPLE 1</name>
362
- <quote>Hello</quote>
363
- </example>
364
- <example id="samplecode2">
365
- <name>EXAMPLE 2 — Title</name>
366
- <p>Hello</p>
367
- </example>
368
- </foreword>
369
- </preface>
370
- </iso-standard>
371
- INPUT
372
- expect(xmlpp(output.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
373
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
374
- <body lang="EN-US" link="blue" vlink="#954F72">
375
- <div class="WordSection1">
376
- <p>&#160;</p>
377
- </div>
378
- <p>
379
- <br clear="all" class="section"/>
380
- </p>
381
- <div class="WordSection2">
382
- <p>
383
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
384
- </p>
385
- <div>
386
- <h1 class="ForewordTitle">Foreword</h1>
387
- <div id="samplecode" class="example">
388
- <p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">&#160; </span></p>
389
- <div class="Quote">Hello</div>
390
- </div>
391
- <div id="samplecode2" class="example">
392
- <p><span class="example_label">EXAMPLE 2&#160;&#8212; Title</span><span style="mso-tab-count:1">&#160; </span>Hello</p>
393
- </div>
331
+ <div id="samplecode2" class="example">
332
+ <p><span class="example_label">EXAMPLE 2&#160;&#8212; Title</span><span style="mso-tab-count:1">&#160; </span>Hello</p>
394
333
  </div>
395
- <p>&#160;</p>
396
334
  </div>
397
- <p>
398
- <br clear="all" class="section"/>
399
- </p>
400
- <div class="WordSection3">
401
- <p class="zzSTDTitle1"/>
402
- </div>
403
- <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
404
- <div class="colophon"/>
405
- </body>
406
- OUTPUT
335
+ <p>&#160;</p>
336
+ </div>
337
+ <p>
338
+ <br clear="all" class="section"/>
339
+ </p>
340
+ <div class="WordSection3">
341
+ <p class="zzSTDTitle1"/>
342
+ </div>
343
+ <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
344
+ <div class="colophon"/>
345
+ </body>
346
+ OUTPUT
347
+ expect(IsoDoc::Iso::PresentationXMLConvert.new({})
348
+ .convert("test", input, true)).to be_equivalent_to xmlpp(presxml)
349
+ expect(IsoDoc::Iso::HtmlConvert.new({})
350
+ .convert("test", presxml, true)).to be_equivalent_to xmlpp(html)
351
+ output = IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
352
+ expect(xmlpp(output
353
+ .sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
354
+ .to be_equivalent_to xmlpp(word)
407
355
  end
408
356
  end
@@ -148,6 +148,9 @@ RSpec.describe IsoDoc do
148
148
  An Appendix</title>
149
149
  </appendix>
150
150
  </annex>
151
+ <bibliography>
152
+ <references id="R" normative="false"><title>Bibliography</title></references>
153
+ </bibliography>
151
154
  </iso-standard>
152
155
  INPUT
153
156
 
@@ -163,7 +166,7 @@ RSpec.describe IsoDoc do
163
166
  </p>
164
167
  <div class="Section3">
165
168
  <a id="P" name="P"/>
166
- <h1 class="Annex">Annex</h1>
169
+ <p class="ANNEX">Annex</p>
167
170
  <div>
168
171
  <a id="Q" name="Q"/>
169
172
  <p class="h2Annex">A.1
@@ -177,6 +180,12 @@ RSpec.describe IsoDoc do
177
180
  An Appendix</p>
178
181
  </div>
179
182
  </div>
183
+ <p class='MsoNormal'>
184
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
185
+ </p>
186
+ <div>
187
+ <p class='BiblioTitle'>Bibliography</p>
188
+ </div>
180
189
  </div>
181
190
  OUTPUT
182
191
  end
@@ -227,9 +236,9 @@ RSpec.describe IsoDoc do
227
236
  <p class="TermNum">
228
237
  <a id="paddy1" name="paddy1"/>1.1</p>
229
238
  <p class="Terms" style="text-align:left;">paddy</p>
230
- <p class="MsoNormal">
239
+ <p class="Definition">
231
240
  <a id="_eb29b35e-123e-4d1c-b50b-2714d41e747f" name="_eb29b35e-123e-4d1c-b50b-2714d41e747f"/>rice retaining its husk after threshing</p>
232
- <p class="MsoNormal">[SOURCE:
241
+ <p class="Source">[SOURCE:
233
242
  <a href="#ISO7301">ISO 7301:2011, 3.1</a>
234
243
  , modified — The term &quot;cargo rice&quot; is shown as deprecated, and Note 1 to entry is not included here]</p>
235
244
  </div>
@@ -297,8 +306,9 @@ RSpec.describe IsoDoc do
297
306
  <p class="MsoToc1">
298
307
  <span lang="EN-GB" xml:lang="EN-GB">
299
308
  <span style="mso-element:field-begin"/>
300
- <span style="mso-spacerun:yes"> </span>TOC
301
- \o &quot;1-3&quot; \h \z \u
309
+ <span style='mso-spacerun:yes'>&#xA0;</span>
310
+ TOC \o "1-3" \h \z \t "Heading 1;1;ANNEX;1;Biblio Title;1;Foreword
311
+ Title;1;Intro Title;1"
302
312
  <span style="mso-element:field-separator"/></span>
303
313
  <span class="MsoHyperlink">
304
314
  <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
@@ -658,14 +668,14 @@ RSpec.describe IsoDoc do
658
668
  </p>
659
669
  <div class="Section3">
660
670
  <a id="P" name="P"/>
661
- <div class="example">
671
+ <div class="Example">
662
672
  <a id="_63112cbc-cde0-435f-9553-e0b8c4f5851c" name="_63112cbc-cde0-435f-9553-e0b8c4f5851c"/>
663
- <p class="example">
673
+ <p class="Example">
664
674
  <span style="mso-tab-count:1">  </span>'1M', '01M', and '0001M' all describe the calendar month January.</p>
665
675
  </div>
666
- <div class="example">
676
+ <div class="Example">
667
677
  <a id="_63112cbc-cde0-435f-9553-e0b8c4f5851d" name="_63112cbc-cde0-435f-9553-e0b8c4f5851d"/>
668
- <p class="example">
678
+ <p class="Example">
669
679
  <span style="mso-tab-count:1">  </span>'2M', '02M', and '0002M' all describe the calendar month February.</p>
670
680
  </div>
671
681
  </div>
@@ -726,7 +736,6 @@ RSpec.describe IsoDoc do
726
736
  </tr>
727
737
  </table>
728
738
  </div>
729
- <p class="FigureTitle" style="text-align:center;"/>
730
739
  </div>
731
740
  </div>
732
741
  </div>
@@ -155,7 +155,7 @@ RSpec.describe IsoDoc do
155
155
  <language current="true">en</language>
156
156
  </bibdata>
157
157
  <preface>
158
- <foreword>
158
+ <foreword displayorder="1">
159
159
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
160
160
  <eref bibitemid="ISO712">ISO 712</eref>
161
161
  <eref bibitemid="ISBN">[1]</eref>
@@ -168,7 +168,7 @@ RSpec.describe IsoDoc do
168
168
  </foreword>
169
169
  </preface>
170
170
  <bibliography>
171
- <references id="_normative_references" normative="true" obligation="informative">
171
+ <references id="_normative_references" normative="true" obligation="informative" displayorder="2">
172
172
  <title depth="1">1<tab/>Normative References</title>
173
173
  <p>The following documents are referred to in the text in such a way that
174
174
  some or all of their content constitutes requirements of this document.
@@ -231,14 +231,14 @@ RSpec.describe IsoDoc do
231
231
 
232
232
  <link target="http://www.icc.or.at"/>
233
233
  )</formattedref>
234
- <docidentifier type="ICC">167</docidentifier>
234
+ <docidentifier type="ICC">ICC 167</docidentifier>
235
235
  </bibitem>
236
236
  <note>
237
237
  <name>NOTE</name>
238
238
  <p>This is an annotation of ISO 20483:2013-2014</p>
239
239
  </note>
240
240
  </references>
241
- <references id="_bibliography" normative="false" obligation="informative">
241
+ <references id="_bibliography" normative="false" obligation="informative" displayorder="3">
242
242
  <title depth="1">Bibliography</title>
243
243
  <bibitem id="ISBN" type="ISBN">
244
244
  <title format="text/plain">Chemicals for analytical laboratory use</title>
@@ -294,7 +294,7 @@ RSpec.describe IsoDoc do
294
294
  </bibitem>
295
295
  <bibitem id="ref11">
296
296
  <title>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</title>
297
- <docidentifier type="IETF">RFC 10</docidentifier>
297
+ <docidentifier type="IETF">IETF RFC 10</docidentifier>
298
298
  </bibitem>
299
299
  <bibitem id="ref12">
300
300
  <formattedref format="application/x-isodoc+xml">CitationWorks. 2019.
@@ -302,7 +302,7 @@ RSpec.describe IsoDoc do
302
302
  <em>How to cite a reference</em>
303
303
  .</formattedref>
304
304
  <docidentifier type="metanorma">[Citn]</docidentifier>
305
- <docidentifier type="IETF">RFC 20</docidentifier>
305
+ <docidentifier type="IETF">IETF RFC 20</docidentifier>
306
306
  </bibitem>
307
307
  </references>
308
308
  </bibliography>
@@ -86,100 +86,86 @@ RSpec.describe IsoDoc do
86
86
  INPUT
87
87
 
88
88
  presxml = <<~OUTPUT
89
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
90
- <preface>
91
- <foreword obligation='informative'>
92
- <title>Foreword</title>
93
- <p id='A'>This is a preamble</p>
94
- </foreword>
95
- <introduction id='B' obligation='informative'>
96
- <title depth='1'>0<tab/>Introduction</title>
97
- <clause id='C' inline-header='false' obligation='informative'>
98
- <title depth='2'>0.1<tab/>Introduction Subsection</title>
89
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
90
+ <preface>
91
+ <foreword obligation="informative" displayorder="1">
92
+ <title>Foreword</title>
93
+ <p id="A">This is a preamble</p>
94
+ </foreword>
95
+ <introduction id="B" obligation="informative" displayorder="2">
96
+ <title depth="1">0<tab/>Introduction</title>
97
+ <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>
102
+ </preface>
103
+ <sections>
104
+ <clause id="D" obligation="normative" type="scope" displayorder="3">
105
+ <title depth="1">1<tab/>Scope</title>
106
+ <p id="E">Text</p>
99
107
  </clause>
100
- <p>This is patent boilerplate</p>
101
- </introduction>
102
- </preface>
103
- <sections>
104
- <clause id='D' obligation='normative' type="scope">
105
- <title depth='1'>1<tab/>Scope</title>
106
- <p id='E'>Text</p>
107
- </clause>
108
- <clause id='H' obligation='normative'>
109
- <title depth='1'>3<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
110
- <terms id='I' obligation='normative'>
111
- <title depth='2'>3.1<tab/>Normal Terms</title>
112
- <term id='J'>
113
- <name>3.1.1</name>
114
- <preferred>Term2</preferred>
115
- </term>
116
- </terms>
117
- <definitions id='K' inline-header='true'>
118
- <title>3.2</title>
108
+ <clause id="H" obligation="normative" displayorder="5">
109
+ <title depth="1">3<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
110
+ <terms id="I" obligation="normative">
111
+ <title depth="2">3.1<tab/>Normal Terms</title>
112
+ <term id="J"><name>3.1.1</name>
113
+ <preferred>Term2</preferred>
114
+ </term>
115
+ </terms>
116
+ <definitions id="K" inline-header="true"><title>3.2</title>
117
+ <dl>
118
+ <dt>Symbol</dt>
119
+ <dd>Definition</dd>
120
+ </dl>
121
+ </definitions>
122
+ </clause>
123
+ <definitions id="L" displayorder="6"><title>4</title>
119
124
  <dl>
120
125
  <dt>Symbol</dt>
121
126
  <dd>Definition</dd>
122
127
  </dl>
123
128
  </definitions>
124
- </clause>
125
- <definitions id='L'>
126
- <title>4</title>
127
- <dl>
128
- <dt>Symbol</dt>
129
- <dd>Definition</dd>
130
- </dl>
131
- </definitions>
132
- <clause id='M' inline-header='false' obligation='normative'>
133
- <title depth='1'>5<tab/>Clause 4</title>
134
- <clause id='N' inline-header='false' obligation='normative'>
135
- <title depth='2'>5.1<tab/>Introduction</title>
136
- </clause>
137
- <clause id='O' inline-header='false' obligation='normative'>
138
- <title depth='2'>5.2<tab/>Clause 4.2</title>
139
- </clause>
140
- </clause>
141
- </sections>
142
- <annex id='P' inline-header='false' obligation='normative'>
143
- <title>
144
- <strong>Annex A</strong>
145
- <br/>
146
- (normative)
147
- <br/>
148
- <br/>
149
- <strong>Annex</strong>
150
- </title>
151
- <clause id='Q' inline-header='false' obligation='normative'>
152
- <title depth='2'>A.1<tab/>Annex A.1</title>
153
- <clause id='Q1' inline-header='false' obligation='normative'>
154
- <title depth='3'>A.1.1<tab/>Annex A.1a</title>
129
+ <clause id="M" inline-header="false" obligation="normative" displayorder="7">
130
+ <title depth="1">5<tab/>Clause 4</title>
131
+ <clause id="N" inline-header="false" obligation="normative">
132
+ <title depth="2">5.1<tab/>Introduction</title>
133
+ </clause>
134
+ <clause id="O" inline-header="false" obligation="normative">
135
+ <title depth="2">5.2<tab/>Clause 4.2</title>
136
+ </clause>
155
137
  </clause>
156
- </clause>
157
- <appendix id='Q2' inline-header='false' obligation='normative'>
158
- <title depth='2'>Appendix 1<tab/>An Appendix</title>
159
- <clause id='Q2a' inline-header='false' obligation='normative'>
160
- <title depth='3'>
161
- Appendix 1.1
162
- <tab/>
163
- Appendix subclause
164
- </title>
138
+ </sections>
139
+ <annex id="P" inline-header="false" obligation="normative" displayorder="8">
140
+ <title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
141
+ <clause id="Q" inline-header="false" obligation="normative">
142
+ <title depth="2">A.1<tab/>Annex A.1</title>
143
+ <clause id="Q1" inline-header="false" obligation="normative">
144
+ <title depth="3">A.1.1<tab/>Annex A.1a</title>
145
+ </clause>
165
146
  </clause>
166
- </appendix>
167
- <references id='Q3' normative='false'>
168
- <title depth='2'>A.2<tab/>Annex Bibliography</title>
169
- </references>
170
- </annex>
171
- <bibliography>
172
- <references id='R' obligation='informative' normative='true'>
173
- <title depth='1'>2<tab/>Normative References</title>
174
- </references>
175
- <clause id='S' obligation='informative'>
176
- <title depth='1'>Bibliography</title>
177
- <references id='T' obligation='informative' normative='false'>
178
- <title depth='2'>Bibliography Subsection</title>
147
+ <appendix id="Q2" inline-header="false" obligation="normative">
148
+ <title depth="2">Appendix 1<tab/>An Appendix</title>
149
+ <clause id="Q2a" inline-header="false" obligation="normative">
150
+ <title depth="3">Appendix 1.1<tab/>Appendix subclause</title>
151
+ </clause>
152
+ </appendix>
153
+ <references id="Q3" normative="false">
154
+ <title depth="2">A.2<tab/>Annex Bibliography</title>
179
155
  </references>
180
- </clause>
181
- </bibliography>
182
- </iso-standard>
156
+ </annex>
157
+ <bibliography>
158
+ <references id="R" normative="true" obligation="informative" displayorder="4">
159
+ <title depth="1">2<tab/>Normative References</title>
160
+ </references>
161
+ <clause id="S" obligation="informative" displayorder="9">
162
+ <title depth="1">Bibliography</title>
163
+ <references id="T" normative="false" obligation="informative">
164
+ <title depth="2">Bibliography Subsection</title>
165
+ </references>
166
+ </clause>
167
+ </bibliography>
168
+ </iso-standard>
183
169
  OUTPUT
184
170
 
185
171
  html = <<~OUTPUT
@@ -259,7 +245,7 @@ RSpec.describe IsoDoc do
259
245
  <div id="Q2">
260
246
  <h2>Appendix 1&#160; An Appendix</h2>
261
247
  <div id="Q2a">
262
- <h3>Appendix 1.1 &#160; Appendix subclause </h3>
248
+ <h3>Appendix 1.1&#160; Appendix subclause</h3>
263
249
  </div>
264
250
  </div>
265
251
  <div>
@@ -281,7 +267,7 @@ RSpec.describe IsoDoc do
281
267
  word = <<~OUTPUT
282
268
  <body lang="EN-US" link="blue" vlink="#954F72">
283
269
  <div class="WordSection1">
284
- <p> </p>
270
+ <p>&#160;</p>
285
271
  </div>
286
272
  <p>
287
273
  <br class="section" clear="all"/>
@@ -292,7 +278,7 @@ RSpec.describe IsoDoc do
292
278
  </p>
293
279
  <div>
294
280
  <h1 class="ForewordTitle">Foreword</h1>
295
- <p id="A">This is a preamble</p>
281
+ <p id="A" class='ForewordText'>This is a preamble</p>
296
282
  </div>
297
283
  <p>
298
284
  <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
@@ -308,7 +294,7 @@ RSpec.describe IsoDoc do
308
294
  </div>
309
295
  <p>This is patent boilerplate</p>
310
296
  </div>
311
- <p> </p>
297
+ <p>&#160;</p>
312
298
  </div>
313
299
  <p>
314
300
  <br class="section" clear="all"/>
@@ -383,7 +369,6 @@ RSpec.describe IsoDoc do
383
369
  </p>
384
370
  <div class="Section3" id="P">
385
371
  <h1 class="Annex">
386
- <b>Annex A</b>
387
372
  <br/>(normative)
388
373
  <br/>
389
374
  <br/>
@@ -409,7 +394,7 @@ RSpec.describe IsoDoc do
409
394
  </div>
410
395
  </div>
411
396
  <div>
412
- <h2 class="Section3">A.2
397
+ <h2 class="BiblioTitle">A.2
413
398
  <span style="mso-tab-count:1">&#160; </span>
414
399
  Annex Bibliography</h2>
415
400
  </div>
@@ -418,9 +403,9 @@ RSpec.describe IsoDoc do
418
403
  <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
419
404
  </p>
420
405
  <div>
421
- <h1 class="Section3">Bibliography</h1>
406
+ <h1 class="BiblioTitle">Bibliography</h1>
422
407
  <div>
423
- <h2 class="Section3">Bibliography Subsection</h2>
408
+ <h2 class="BiblioTitle">Bibliography Subsection</h2>
424
409
  </div>
425
410
  </div>
426
411
  </div>
@@ -428,12 +413,16 @@ RSpec.describe IsoDoc do
428
413
  <div class="colophon"/>
429
414
  </body>
430
415
  OUTPUT
431
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)))
416
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
417
+ .convert("test", input, true)))
432
418
  .to be_equivalent_to xmlpp(presxml)
433
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true)))
419
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
420
+ .convert("test", presxml, true)))
434
421
  .to be_equivalent_to xmlpp(html)
435
- expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
436
- .sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(word)
422
+ expect(xmlpp(IsoDoc::Iso::WordConvert.new({})
423
+ .convert("test", presxml, true)
424
+ .sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>")))
425
+ .to be_equivalent_to xmlpp(word)
437
426
  end
438
427
 
439
428
  it "processes subclauses with and without titles" do
@@ -455,7 +444,7 @@ RSpec.describe IsoDoc do
455
444
  presxml = <<~OUTPUT
456
445
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
457
446
  <sections>
458
- <clause id='D' obligation='normative'>
447
+ <clause id='D' obligation='normative' displayorder="1">
459
448
  <title depth='1'>1<tab/>Scope</title>
460
449
  <clause id='D1' obligation='normative'>
461
450
  <title depth='2'>1.1<tab/>Scope 1</title>
@@ -497,38 +486,42 @@ RSpec.describe IsoDoc do
497
486
  </body>
498
487
  </html>
499
488
  OUTPUT
500
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)))
489
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
490
+ .convert("test", input, true)))
501
491
  .to be_equivalent_to xmlpp(presxml)
502
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true)))
492
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
493
+ .convert("test", presxml, true)))
503
494
  .to be_equivalent_to xmlpp(html)
504
495
  end
505
496
 
506
497
  it "processes simple terms & definitions" do
507
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
508
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
509
- <iso-standard xmlns="http://riboseinc.com/isoxml">
510
- <sections>
511
- <terms id="H" obligation="normative">
512
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
513
- <term id="J">
514
- <name>1.1</name>
515
- <preferred>Term2</preferred>
516
- </term>
517
- </terms>
518
- </sections>
519
- </iso-standard>
520
- INPUT
521
- #{HTML_HDR}
522
- <p class="zzSTDTitle1"/>
523
- <div id="H">
524
- <h1>Terms, Definitions, Symbols and Abbreviated Terms</h1>
525
- <p class="TermNum" id="J">1.1</p>
526
- <p class="Terms" style="text-align:left;">Term2</p>
527
- </div>
498
+ input = <<~INPUT
499
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
500
+ <sections>
501
+ <terms id="H" obligation="normative">
502
+ <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
503
+ <term id="J">
504
+ <name>1.1</name>
505
+ <preferred>Term2</preferred>
506
+ </term>
507
+ </terms>
508
+ </sections>
509
+ </iso-standard>
510
+ INPUT
511
+ output = <<~OUTPUT
512
+ #{HTML_HDR}
513
+ <p class="zzSTDTitle1"/>
514
+ <div id="H">
515
+ <h1>Terms, Definitions, Symbols and Abbreviated Terms</h1>
516
+ <p class="TermNum" id="J">1.1</p>
517
+ <p class="Terms" style="text-align:left;">Term2</p>
528
518
  </div>
529
- </body>
530
- </html>
531
- OUTPUT
519
+ </div>
520
+ </body>
521
+ </html>
522
+ OUTPUT
523
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
524
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
532
525
  end
533
526
 
534
527
  it "processes inline section headers" do
@@ -686,191 +679,193 @@ RSpec.describe IsoDoc do
686
679
  </bipm-standard>
687
680
  INPUT
688
681
  presxml = <<~OUTPUT
689
- <iso-standard xmlns='https://open.ribose.com/standards/bipm' type='presentation'>
690
- <bibdata>
691
- <language current='true'>en</language>
692
- <script current='true'>Latn</script>
693
- </bibdata>
694
- <sections>
695
- <clause id='A'>
696
- <title>1</title>
697
- <bookmark id='_'/>
698
- <bookmark id='_'/>
699
- <bookmark id='_'/>
700
- <bookmark id='_'/>
701
- <bookmark id='_'/>
702
- <clause id='B' inline-header='true'>
703
- <title>1.1</title>
704
- <bookmark id='_'/>
705
- <bookmark id='_'/>
706
- <bookmark id='_'/>
707
- <bookmark id='_'/>
708
- </clause>
709
- </clause>
710
- </sections>
711
- <indexsect id='_'>
712
- <title>Index</title>
713
- <ul>
714
- <li>
715
- <em>Dasein</em>
716
- , see
717
- <em>Eman</em>
718
- cipation, &#xEA;tre
719
- </li>
720
- <li>
721
- &#xE9;long&#xE9;,
722
- <xref target='_' pagenumber='true'>Clause 1</xref>
723
- </li>
724
- <li>
725
- <em>Eman</em>
726
- cipation,
727
- <xref target='_' pagenumber='true'>Clause 1</xref>
728
- ,
729
- <xref target='_' pagenumber='true'>1.1</xref>
730
- <ul>
731
- <li>
732
- dans la France,
733
- <xref target='_' pagenumber='true'>Clause 1</xref>
734
- <ul>
735
- <li>
736
- &#xE0; Paris,
737
- <xref target='_' pagenumber='true'>1.1</xref>
738
- </li>
739
- <li>
740
- en Bretagne,
741
- <xref target='_' pagenumber='true'>Clause 1</xref>
742
- </li>
743
- </ul>
744
- </li>
745
- <li>
746
- dans les &#xC9;tats-Unis,
747
- <xref target='_' pagenumber='true'>1.1</xref>
748
- </li>
749
- </ul>
750
- </li>
751
- <li>
752
- &#xEA;tre
753
- <ul>
754
- <li>
755
- Husserl, see zebra, see also
756
- <em>Eman</em>
757
- cipation, zebra
758
- <ul>
759
- <li>
760
- en allemand,
761
- <xref target='_' pagenumber='true'>Clause 1</xref>
762
- </li>
763
- </ul>
764
- </li>
765
- </ul>
766
- </li>
767
- <li>
768
- zebra,
769
- <xref target='_' pagenumber='true'>1.1</xref>
770
- </li>
771
- </ul>
772
- </indexsect>
773
- </iso-standard>
682
+ <iso-standard xmlns='https://open.ribose.com/standards/bipm' type='presentation'>
683
+ <bibdata>
684
+ <language current='true'>en</language>
685
+ <script current='true'>Latn</script>
686
+ </bibdata>
687
+ <sections>
688
+ <clause id='A' displayorder="1">
689
+ <title>1</title>
690
+ <bookmark id='_'/>
691
+ <bookmark id='_'/>
692
+ <bookmark id='_'/>
693
+ <bookmark id='_'/>
694
+ <bookmark id='_'/>
695
+ <clause id='B' inline-header='true'>
696
+ <title>1.1</title>
697
+ <bookmark id='_'/>
698
+ <bookmark id='_'/>
699
+ <bookmark id='_'/>
700
+ <bookmark id='_'/>
701
+ </clause>
702
+ </clause>
703
+ </sections>
704
+ <indexsect id='_'>
705
+ <title>Index</title>
706
+ <ul>
707
+ <li>
708
+ <em>Dasein</em>
709
+ , see
710
+ <em>Eman</em>
711
+ cipation, &#xEA;tre
712
+ </li>
713
+ <li>
714
+ &#xE9;long&#xE9;,
715
+ <xref target='_' pagenumber='true'>Clause 1</xref>
716
+ </li>
717
+ <li>
718
+ <em>Eman</em>
719
+ cipation,
720
+ <xref target='_' pagenumber='true'>Clause 1</xref>
721
+ ,
722
+ <xref target='_' pagenumber='true'>1.1</xref>
723
+ <ul>
724
+ <li>
725
+ dans la France,
726
+ <xref target='_' pagenumber='true'>Clause 1</xref>
727
+ <ul>
728
+ <li>
729
+ &#xE0; Paris,
730
+ <xref target='_' pagenumber='true'>1.1</xref>
731
+ </li>
732
+ <li>
733
+ en Bretagne,
734
+ <xref target='_' pagenumber='true'>Clause 1</xref>
735
+ </li>
736
+ </ul>
737
+ </li>
738
+ <li>
739
+ dans les &#xC9;tats-Unis,
740
+ <xref target='_' pagenumber='true'>1.1</xref>
741
+ </li>
742
+ </ul>
743
+ </li>
744
+ <li>
745
+ &#xEA;tre
746
+ <ul>
747
+ <li>
748
+ Husserl, see zebra, see also
749
+ <em>Eman</em>
750
+ cipation, zebra
751
+ <ul>
752
+ <li>
753
+ en allemand,
754
+ <xref target='_' pagenumber='true'>Clause 1</xref>
755
+ </li>
756
+ </ul>
757
+ </li>
758
+ </ul>
759
+ </li>
760
+ <li>
761
+ zebra,
762
+ <xref target='_' pagenumber='true'>1.1</xref>
763
+ </li>
764
+ </ul>
765
+ </indexsect>
766
+ </iso-standard>
774
767
  OUTPUT
775
768
  html = <<~OUTPUT
776
- <html lang='en'>
777
- <head/>
778
- <body lang='en'>
779
- <div class='title-section'>
780
- <p>&#160;</p>
781
- </div>
782
- <br/>
783
- <div class='prefatory-section'>
784
- <p>&#160;</p>
785
- </div>
786
- <br/>
787
- <div class='main-section'>
788
- <p class='zzSTDTitle1'/>
789
- <div id='A'>
790
- <h1>1</h1>
791
- <a id='_'/>
792
- <a id='_'/>
793
- <a id='_'/>
794
- <a id='_'/>
795
- <a id='_'/>
796
- <div id='B'>
797
- <span class='zzMoveToFollowing'>
798
- <b>1.1&#160; </b>
799
- </span>
800
- <a id='_'/>
801
- <a id='_'/>
802
- <a id='_'/>
803
- <a id='_'/>
804
- </div>
805
- </div>
806
- <div id='_'>
807
- <h1>Index</h1>
808
- <ul>
809
- <li>
810
- <i>Dasein</i>
811
- , see
812
- <i>Eman</i>
813
- cipation, &#234;tre
814
- </li>
815
- <li>
816
- &#233;long&#233;,
817
- <a href='#_'>Clause 1</a>
818
- </li>
819
- <li>
820
- <i>Eman</i>
821
- cipation,
822
- <a href='#_'>Clause 1</a>
823
- ,
824
- <a href='#_'>1.1</a>
825
- <ul>
826
- <li>
827
- dans la France,
828
- <a href='#_'>Clause 1</a>
829
- <ul>
830
- <li>
831
- &#224; Paris,
832
- <a href='#_'>1.1</a>
833
- </li>
834
- <li>
835
- en Bretagne,
836
- <a href='#_'>Clause 1</a>
837
- </li>
838
- </ul>
839
- </li>
840
- <li>
841
- dans les &#201;tats-Unis,
842
- <a href='#_'>1.1</a>
843
- </li>
844
- </ul>
845
- </li>
846
- <li>
847
- &#234;tre
848
- <ul>
849
- <li>
850
- Husserl, see zebra, see also
851
- <i>Eman</i>
852
- cipation, zebra
853
- <ul>
854
- <li>
855
- en allemand,
856
- <a href='#_'>Clause 1</a>
857
- </li>
858
- </ul>
859
- </li>
860
- </ul>
861
- </li>
862
- <li>
863
- zebra,
864
- <a href='#_'>1.1</a>
865
- </li>
866
- </ul>
867
- </div>
868
- </div>
869
- </body>
870
- </html>
769
+ <html lang='en'>
770
+ <head/>
771
+ <body lang='en'>
772
+ <div class='title-section'>
773
+ <p>&#160;</p>
774
+ </div>
775
+ <br/>
776
+ <div class='prefatory-section'>
777
+ <p>&#160;</p>
778
+ </div>
779
+ <br/>
780
+ <div class='main-section'>
781
+ <p class='zzSTDTitle1'/>
782
+ <div id='A'>
783
+ <h1>1</h1>
784
+ <a id='_'/>
785
+ <a id='_'/>
786
+ <a id='_'/>
787
+ <a id='_'/>
788
+ <a id='_'/>
789
+ <div id='B'>
790
+ <span class='zzMoveToFollowing'>
791
+ <b>1.1&#160; </b>
792
+ </span>
793
+ <a id='_'/>
794
+ <a id='_'/>
795
+ <a id='_'/>
796
+ <a id='_'/>
797
+ </div>
798
+ </div>
799
+ <div id='_'>
800
+ <h1>Index</h1>
801
+ <ul>
802
+ <li>
803
+ <i>Dasein</i>
804
+ , see
805
+ <i>Eman</i>
806
+ cipation, &#234;tre
807
+ </li>
808
+ <li>
809
+ &#233;long&#233;,
810
+ <a href='#_'>Clause 1</a>
811
+ </li>
812
+ <li>
813
+ <i>Eman</i>
814
+ cipation,
815
+ <a href='#_'>Clause 1</a>
816
+ ,
817
+ <a href='#_'>1.1</a>
818
+ <ul>
819
+ <li>
820
+ dans la France,
821
+ <a href='#_'>Clause 1</a>
822
+ <ul>
823
+ <li>
824
+ &#224; Paris,
825
+ <a href='#_'>1.1</a>
826
+ </li>
827
+ <li>
828
+ en Bretagne,
829
+ <a href='#_'>Clause 1</a>
830
+ </li>
831
+ </ul>
832
+ </li>
833
+ <li>
834
+ dans les &#201;tats-Unis,
835
+ <a href='#_'>1.1</a>
836
+ </li>
837
+ </ul>
838
+ </li>
839
+ <li>
840
+ &#234;tre
841
+ <ul>
842
+ <li>
843
+ Husserl, see zebra, see also
844
+ <i>Eman</i>
845
+ cipation, zebra
846
+ <ul>
847
+ <li>
848
+ en allemand,
849
+ <a href='#_'>Clause 1</a>
850
+ </li>
851
+ </ul>
852
+ </li>
853
+ </ul>
854
+ </li>
855
+ <li>
856
+ zebra,
857
+ <a href='#_'>1.1</a>
858
+ </li>
859
+ </ul>
860
+ </div>
861
+ </div>
862
+ </body>
863
+ </html>
871
864
  OUTPUT
872
- expect(xmlpp(strip_guid(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)
873
- .gsub(%r{<localized-strings>.*</localized-strings>}m, "")))).to be_equivalent_to xmlpp(presxml)
865
+ expect(xmlpp(strip_guid(IsoDoc::Iso::PresentationXMLConvert.new({})
866
+ .convert("test", input, true)
867
+ .gsub(%r{<localized-strings>.*</localized-strings>}m, ""))))
868
+ .to be_equivalent_to xmlpp(presxml)
874
869
  expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
875
870
  .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
876
871
  end