metanorma-iso 1.4.3 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/asciidoctor/iso/base.rb +8 -19
  3. data/lib/asciidoctor/iso/cleanup.rb +2 -3
  4. data/lib/asciidoctor/iso/front.rb +0 -1
  5. data/lib/asciidoctor/iso/front_id.rb +1 -1
  6. data/lib/asciidoctor/iso/isodoc.rng +12 -6
  7. data/lib/asciidoctor/iso/section.rb +5 -11
  8. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +0 -1
  9. data/lib/asciidoctor/iso/validate_section.rb +30 -44
  10. data/lib/isodoc/iso/base_convert.rb +3 -64
  11. data/lib/isodoc/iso/html_convert.rb +2 -1
  12. data/lib/{asciidoctor → isodoc}/iso/i18n-en.yaml +0 -0
  13. data/lib/{asciidoctor → isodoc}/iso/i18n-fr.yaml +0 -0
  14. data/lib/{asciidoctor → isodoc}/iso/i18n-zh-Hans.yaml +0 -0
  15. data/lib/isodoc/iso/i18n.rb +19 -0
  16. data/lib/isodoc/iso/init.rb +33 -0
  17. data/lib/isodoc/iso/metadata.rb +1 -1
  18. data/lib/isodoc/iso/presentation_xml_convert.rb +99 -1
  19. data/lib/isodoc/iso/sections.rb +3 -8
  20. data/lib/isodoc/iso/word_convert.rb +2 -1
  21. data/lib/isodoc/iso/xref.rb +2 -0
  22. data/lib/metanorma/iso/version.rb +1 -1
  23. data/metanorma-iso.gemspec +2 -2
  24. data/spec/asciidoctor-iso/cleanup_spec.rb +4 -4
  25. data/spec/asciidoctor-iso/inline_spec.rb +1 -1
  26. data/spec/asciidoctor-iso/refs_spec.rb +3 -3
  27. data/spec/asciidoctor-iso/section_spec.rb +9 -6
  28. data/spec/asciidoctor-iso/validate_spec.rb +13 -21
  29. data/spec/isodoc/amd_spec.rb +309 -153
  30. data/spec/isodoc/blocks_spec.rb +362 -28
  31. data/spec/isodoc/i18n_spec.rb +468 -108
  32. data/spec/isodoc/inline_spec.rb +99 -31
  33. data/spec/isodoc/iso_spec.rb +95 -29
  34. data/spec/isodoc/postproc_spec.rb +114 -149
  35. data/spec/isodoc/ref_spec.rb +175 -3
  36. data/spec/isodoc/section_spec.rb +148 -82
  37. data/spec/isodoc/table_spec.rb +142 -5
  38. data/spec/isodoc/terms_spec.rb +78 -53
  39. data/spec/isodoc/xref_spec.rb +831 -658
  40. data/spec/metanorma/processor_spec.rb +2 -1
  41. metadata +11 -9
@@ -1,8 +1,8 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
- it "processes IsoXML bibliographies" do
5
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
4
+ it "processes IsoXML bibliographies (Presentation XML)" do
5
+ input = <<~INPUT
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <bibdata>
8
8
  <language>en</language>
@@ -120,6 +120,176 @@ RSpec.describe IsoDoc do
120
120
  </bibliography>
121
121
  </iso-standard>
122
122
  INPUT
123
+ presxml = <<~OUTPUT
124
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
125
+ <bibdata>
126
+ <language>en</language>
127
+ </bibdata>
128
+ <preface>
129
+ <foreword>
130
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
131
+ <eref bibitemid='ISO712'>ISO 712</eref>
132
+ <eref bibitemid='ISBN'>[1]</eref>
133
+ <eref bibitemid='ISSN'>[2]</eref>
134
+ <eref bibitemid='ISO16634'>ISO 16634:--</eref>
135
+ <eref bibitemid='ref1'>ICC 167</eref>
136
+ <eref bibitemid='ref10'>[10]</eref>
137
+ <eref bibitemid='ref12'>Citn</eref>
138
+ </p>
139
+ </foreword>
140
+ </preface>
141
+ <bibliography>
142
+ <references id='_normative_references' obligation='informative' normative='true'>
143
+ <title depth='1'>1<tab/>Normative References</title>
144
+ <p>
145
+ The following documents are referred to in the text in such a way that
146
+ some or all of their content constitutes requirements of this document.
147
+ For dated references, only the edition cited applies. For undated
148
+ references, the latest edition of the referenced document (including any
149
+ amendments) applies.
150
+ </p>
151
+ <bibitem id='ISO712' type='standard'>
152
+ <title format='text/plain'>Cereals or cereal products</title>
153
+ <title type='main' format='text/plain'>Cereals and cereal products</title>
154
+ <docidentifier type='ISO'>ISO 712</docidentifier>
155
+ <contributor>
156
+ <role type='publisher'/>
157
+ <organization>
158
+ <name>International Organization for Standardization</name>
159
+ </organization>
160
+ </contributor>
161
+ </bibitem>
162
+ <bibitem id='ISO16634' type='standard'>
163
+ <title language='x' format='text/plain'>
164
+ Cereals, pulses, milled cereal products, xxxx, oilseeds and animal
165
+ feeding stuffs
166
+ </title>
167
+ <title language='en' format='text/plain'>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</title>
168
+ <docidentifier type='ISO'>ISO 16634:-- (all parts)</docidentifier>
169
+ <date type='published'>
170
+ <on>--</on>
171
+ </date>
172
+ <contributor>
173
+ <role type='publisher'/>
174
+ <organization>
175
+ <abbreviation>ISO</abbreviation>
176
+ </organization>
177
+ </contributor>
178
+ <note format='text/plain' reference='1' type='ISO DATE'>Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
179
+ <extent type='part'>
180
+ <referenceFrom>all</referenceFrom>
181
+ </extent>
182
+ </bibitem>
183
+ <bibitem id='ISO20483' type='standard'>
184
+ <title format='text/plain'>Cereals and pulses</title>
185
+ <docidentifier type='ISO'>ISO 20483:2013-2014</docidentifier>
186
+ <date type='published'>
187
+ <from>2013</from>
188
+ <to>2014</to>
189
+ </date>
190
+ <contributor>
191
+ <role type='publisher'/>
192
+ <organization>
193
+ <name>International Organization for Standardization</name>
194
+ </organization>
195
+ </contributor>
196
+ </bibitem>
197
+ <bibitem id='ref1'>
198
+ <formattedref format='application/x-isodoc+xml'>
199
+ <smallcap>Standard No I.C.C 167</smallcap>
200
+ .
201
+ <em>
202
+ Determination of the protein content in cereal and cereal products
203
+ for food and animal feeding stuffs according to the Dumas combustion
204
+ method
205
+ </em>
206
+ (see
207
+ <link target='http://www.icc.or.at'/>
208
+ )
209
+ </formattedref>
210
+ <docidentifier type='ICC'>167</docidentifier>
211
+ </bibitem>
212
+ <note>
213
+ <name>NOTE</name>
214
+ <p>This is an annotation of ISO 20483:2013-2014</p>
215
+ </note>
216
+ </references>
217
+ <references id='_bibliography' obligation='informative' normative='false'>
218
+ <title depth="1">Bibliography</title>
219
+ <bibitem id='ISBN' type='ISBN'>
220
+ <title format='text/plain'>Chemicals for analytical laboratory use</title>
221
+ <docidentifier type='ISBN'>ISBN</docidentifier>
222
+ <docidentifier type='metanorma'>[1]</docidentifier>
223
+ <contributor>
224
+ <role type='publisher'/>
225
+ <organization>
226
+ <abbreviation>ISBN</abbreviation>
227
+ </organization>
228
+ </contributor>
229
+ </bibitem>
230
+ <bibitem id='ISSN' type='ISSN'>
231
+ <title format='text/plain'>Instruments for analytical laboratory use</title>
232
+ <docidentifier type='ISSN'>ISSN</docidentifier>
233
+ <docidentifier type='metanorma'>[2]</docidentifier>
234
+ <contributor>
235
+ <role type='publisher'/>
236
+ <organization>
237
+ <abbreviation>ISSN</abbreviation>
238
+ </organization>
239
+ </contributor>
240
+ </bibitem>
241
+ <note>
242
+ <name>NOTE</name>
243
+ <p>This is an annotation of document ISSN.</p>
244
+ </note>
245
+ <note>
246
+ <name>NOTE</name>
247
+ <p>This is another annotation of document ISSN.</p>
248
+ </note>
249
+ <bibitem id='ISO3696' type='standard'>
250
+ <title format='text/plain'>Water for analytical laboratory use</title>
251
+ <docidentifier type='ISO'>ISO 3696</docidentifier>
252
+ <contributor>
253
+ <role type='publisher'/>
254
+ <organization>
255
+ <abbreviation>ISO</abbreviation>
256
+ </organization>
257
+ </contributor>
258
+ </bibitem>
259
+ <bibitem id='ref10'>
260
+ <formattedref format='application/x-isodoc+xml'>
261
+ <smallcap>Standard No I.C.C 167</smallcap>
262
+ .
263
+ <em>
264
+ Determination of the protein content in cereal and cereal products
265
+ for food and animal feeding stuffs according to the Dumas combustion
266
+ method
267
+ </em>
268
+ (see
269
+ <link target='http://www.icc.or.at'/>
270
+ )
271
+ </formattedref>
272
+ <docidentifier type='metanorma'>[10]</docidentifier>
273
+ </bibitem>
274
+ <bibitem id='ref11'>
275
+ <title>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</title>
276
+ <docidentifier type='IETF'>RFC 10</docidentifier>
277
+ </bibitem>
278
+ <bibitem id='ref12'>
279
+ <formattedref format='application/x-isodoc+xml'>
280
+ CitationWorks. 2019.
281
+ <em>How to cite a reference</em>
282
+ .
283
+ </formattedref>
284
+ <docidentifier type='metanorma'>[Citn]</docidentifier>
285
+ <docidentifier type='IETF'>RFC 20</docidentifier>
286
+ </bibitem>
287
+ </references>
288
+ </bibliography>
289
+ </iso-standard>
290
+ OUTPUT
291
+
292
+ html = <<~OUTPUT
123
293
  #{HTML_HDR}
124
294
  <br/>
125
295
  <div>
@@ -136,7 +306,7 @@ RSpec.describe IsoDoc do
136
306
  </div>
137
307
  <p class="zzSTDTitle1"/>
138
308
  <div>
139
- <h1>1&#160; Normative references</h1>
309
+ <h1>1&#160; Normative References</h1>
140
310
  <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
141
311
  <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
142
312
  <p id="ISO16634" class="NormRef">ISO 16634:-- (all parts)<a class="FootnoteRef" href="#fn:1"><sup>1</sup></a>, <i>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i></p>
@@ -169,6 +339,8 @@ RSpec.describe IsoDoc do
169
339
  </body>
170
340
  </html>
171
341
  OUTPUT
342
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
343
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
172
344
  end
173
345
 
174
346
  end
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
4
  it "processes section names" do
5
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ input = <<~INPUT
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <preface>
8
8
  <foreword obligation="informative">
@@ -14,7 +14,7 @@ RSpec.describe IsoDoc do
14
14
  </clause>
15
15
  <p>This is patent boilerplate</p>
16
16
  </introduction></preface><sections>
17
- <clause id="D" obligation="normative">
17
+ <clause id="D" obligation="normative" type="scope">
18
18
  <title>Scope</title>
19
19
  <p id="E">Text</p>
20
20
  </clause>
@@ -68,6 +68,98 @@ RSpec.describe IsoDoc do
68
68
  </bibliography>
69
69
  </iso-standard>
70
70
  INPUT
71
+
72
+ presxml = <<~OUTPUT
73
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
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'>
80
+ <title depth='1'>0<tab/>Introduction</title>
81
+ <clause id='C' inline-header='false' obligation='informative'>
82
+ <title depth='2'>0.1<tab/>Introduction Subsection</title>
83
+ </clause>
84
+ <p>This is patent boilerplate</p>
85
+ </introduction>
86
+ </preface>
87
+ <sections>
88
+ <clause id='D' obligation='normative' type="scope">
89
+ <title depth='1'>1<tab/>Scope</title>
90
+ <p id='E'>Text</p>
91
+ </clause>
92
+ <clause id='H' obligation='normative'>
93
+ <title depth='1'>3<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
94
+ <terms id='I' obligation='normative'>
95
+ <title depth='2'>3.1<tab/>Normal Terms</title>
96
+ <term id='J'>
97
+ <name>3.1.1</name>
98
+ <preferred>Term2</preferred>
99
+ </term>
100
+ </terms>
101
+ <definitions id='K' inline-header='true'>
102
+ <title>3.2</title>
103
+ <dl>
104
+ <dt>Symbol</dt>
105
+ <dd>Definition</dd>
106
+ </dl>
107
+ </definitions>
108
+ </clause>
109
+ <definitions id='L'>
110
+ <title>4</title>
111
+ <dl>
112
+ <dt>Symbol</dt>
113
+ <dd>Definition</dd>
114
+ </dl>
115
+ </definitions>
116
+ <clause id='M' inline-header='false' obligation='normative'>
117
+ <title depth='1'>5<tab/>Clause 4</title>
118
+ <clause id='N' inline-header='false' obligation='normative'>
119
+ <title depth='2'>5.1<tab/>Introduction</title>
120
+ </clause>
121
+ <clause id='O' inline-header='false' obligation='normative'>
122
+ <title depth='2'>5.2<tab/>Clause 4.2</title>
123
+ </clause>
124
+ </clause>
125
+ </sections>
126
+ <annex id='P' inline-header='false' obligation='normative'>
127
+ <title>
128
+ <strong>Annex A</strong>
129
+ <br/>
130
+ (normative)
131
+ <br/>
132
+ <br/>
133
+ <strong>Annex</strong>
134
+ </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
+ <references id='Q3' normative='false'>
145
+ <title depth='2'>A.2<tab/>Annex Bibliography</title>
146
+ </references>
147
+ </annex>
148
+ <bibliography>
149
+ <references id='R' obligation='informative' normative='true'>
150
+ <title depth='1'>2<tab/>Normative References</title>
151
+ </references>
152
+ <clause id='S' obligation='informative'>
153
+ <title depth='1'>Bibliography</title>
154
+ <references id='T' obligation='informative' normative='false'>
155
+ <title depth='2'>Bibliography Subsection</title>
156
+ </references>
157
+ </clause>
158
+ </bibliography>
159
+ </iso-standard>
160
+ OUTPUT
161
+
162
+ html = <<~OUTPUT
71
163
  #{HTML_HDR}
72
164
  <br/>
73
165
  <div>
@@ -88,7 +180,7 @@ RSpec.describe IsoDoc do
88
180
  <p id="E">Text</p>
89
181
  </div>
90
182
  <div>
91
- <h1>2&#160; Normative references</h1>
183
+ <h1>2&#160; Normative References</h1>
92
184
  </div>
93
185
  <div id="H"><h1>3&#160; Terms, Definitions, Symbols and Abbreviated Terms</h1>
94
186
  <div id="I">
@@ -96,11 +188,13 @@ RSpec.describe IsoDoc do
96
188
  <p class="TermNum" id="J">3.1.1</p>
97
189
  <p class="Terms" style="text-align:left;">Term2</p>
98
190
 
99
- </div><div id="K"><h2>3.2&#160; Symbols and abbreviated terms</h2>
191
+ </div><div id="K"><span class='zzMoveToFollowing'>
192
+ <b>3.2&#160; </b>
193
+ </span>
100
194
  <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
101
195
  </div></div>
102
196
  <div id="L" class="Symbols">
103
- <h1>4&#160; Symbols and abbreviated terms</h1>
197
+ <h1>4</h1>
104
198
  <dl>
105
199
  <dt>
106
200
  <p>Symbol</p>
@@ -130,7 +224,7 @@ RSpec.describe IsoDoc do
130
224
  <h2>Appendix 1&#160; An Appendix</h2>
131
225
  </div>
132
226
  <div>
133
- <h2>A.2&#160; Annex Bibliography</h2>
227
+ <h2 class="Section3">A.2&#160; Annex Bibliography</h2>
134
228
  </div>
135
229
 
136
230
  </div>
@@ -145,74 +239,8 @@ RSpec.describe IsoDoc do
145
239
  </body>
146
240
  </html>
147
241
  OUTPUT
148
- end
149
-
150
- it "processes section names (Word)" do
151
- expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
152
- <iso-standard xmlns="http://riboseinc.com/isoxml">
153
- <preface>
154
- <foreword obligation="informative">
155
- <title>Foreword</title>
156
- <p id="A">This is a preamble</p>
157
- </foreword>
158
- <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
159
- <title>Introduction Subsection</title>
160
- </clause>
161
- <p>This is patent boilerplate</p>
162
- </introduction></preface><sections>
163
- <clause id="D" obligation="normative">
164
- <title>Scope</title>
165
- <p id="E">Text</p>
166
- </clause>
167
-
168
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
169
- <title>Normal Terms</title>
170
- <term id="J">
171
- <preferred>Term2</preferred>
172
- </term>
173
- </terms>
174
- <definitions id="K">
175
- <dl>
176
- <dt>Symbol</dt>
177
- <dd>Definition</dd>
178
- </dl>
179
- </definitions>
180
- </clause>
181
- <definitions id="L">
182
- <dl>
183
- <dt>Symbol</dt>
184
- <dd>Definition</dd>
185
- </dl>
186
- </definitions>
187
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
188
- <title>Introduction</title>
189
- </clause>
190
- <clause id="O" inline-header="false" obligation="normative">
191
- <title>Clause 4.2</title>
192
- </clause></clause>
193
242
 
194
- </sections><annex id="P" inline-header="false" obligation="normative">
195
- <title>Annex</title>
196
- <clause id="Q" inline-header="false" obligation="normative">
197
- <title>Annex A.1</title>
198
- <clause id="Q1" inline-header="false" obligation="normative">
199
- <title>Annex A.1a</title>
200
- </clause>
201
- </clause>
202
- <appendix id="Q2" inline-header="false" obligation="normative">
203
- <title>An Appendix</title>
204
- </appendix>
205
- </annex><bibliography><references id="R" obligation="informative" normative="true">
206
- <title>Normative References</title>
207
- </references><clause id="S" obligation="informative">
208
- <title>Bibliography</title>
209
- <references id="T" obligation="informative" normative="false">
210
- <title>Bibliography Subsection</title>
211
- </references>
212
- </clause>
213
- </bibliography>
214
- </iso-standard>
215
- INPUT
243
+ word = <<~OUTPUT
216
244
  <body lang="EN-US" link="blue" vlink="#954F72">
217
245
  <div class="WordSection1">
218
246
  <p>&#160;</p>
@@ -242,7 +270,7 @@ OUTPUT
242
270
  <p id="E">Text</p>
243
271
  </div>
244
272
  <div>
245
- <h1>2<span style="mso-tab-count:1">&#160; </span>Normative references</h1>
273
+ <h1>2<span style="mso-tab-count:1">&#160; </span>Normative References</h1>
246
274
  </div>
247
275
  <div id="H"><h1>3<span style="mso-tab-count:1">&#160; </span>Terms, Definitions, Symbols and Abbreviated Terms</h1>
248
276
  <div id="I">
@@ -250,11 +278,17 @@ OUTPUT
250
278
  <p class="TermNum" id="J">3.1.1</p>
251
279
  <p class="Terms" style="text-align:left;">Term2</p>
252
280
 
253
- </div><div id="K"><h2>3.2<span style="mso-tab-count:1">&#160; </span>Symbols and abbreviated terms</h2>
281
+ </div><div id="K">
282
+ <span class='zzMoveToFollowing'>
283
+ <b>
284
+ 3.2
285
+ <span style='mso-tab-count:1'>&#160; </span>
286
+ </b>
287
+ </span>
254
288
  <table class="dl"><tr><td valign="top" align="left"><p align="left" style="margin-left:0pt;text-align:left;">Symbol</p></td><td valign="top">Definition</td></tr></table>
255
289
  </div></div>
256
290
  <div id="L" class="Symbols">
257
- <h1>4<span style="mso-tab-count:1">&#160; </span>Symbols and abbreviated terms</h1>
291
+ <h1>4</h1>
258
292
  <table class="dl">
259
293
  <tr>
260
294
  <td valign="top" align="left">
@@ -284,6 +318,13 @@ OUTPUT
284
318
  </div>
285
319
  <div id="Q2">
286
320
  <h2>Appendix 1<span style="mso-tab-count:1">&#160; </span>An Appendix</h2>
321
+ </div>
322
+ <div>
323
+ <h2 class='Section3'>
324
+ A.2
325
+ <span style='mso-tab-count:1'>&#160; </span>
326
+ Annex Bibliography
327
+ </h2>
287
328
  </div>
288
329
  </div>
289
330
  <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
@@ -298,10 +339,13 @@ OUTPUT
298
339
  <div class="colophon"/>
299
340
  </body>
300
341
  OUTPUT
342
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
343
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
344
+ expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true).sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(word)
301
345
  end
302
346
 
303
347
  it "processes subclauses with and without titles" do
304
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
348
+ input = <<~INPUT
305
349
  <iso-standard xmlns="http://riboseinc.com/isoxml">
306
350
  <sections>
307
351
  <clause id="D" obligation="normative">
@@ -315,6 +359,24 @@ OUTPUT
315
359
  </sections>
316
360
  </iso-standard>
317
361
  INPUT
362
+
363
+ presxml = <<~OUTPUT
364
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
365
+ <sections>
366
+ <clause id='D' obligation='normative'>
367
+ <title depth='1'>1<tab/>Scope</title>
368
+ <clause id='D1' obligation='normative'>
369
+ <title depth='2'>1.1<tab/>Scope 1</title>
370
+ </clause>
371
+ <clause id='D2' obligation='normative' inline-header="true">
372
+ <title>1.2</title>
373
+ </clause>
374
+ </clause>
375
+ </sections>
376
+ </iso-standard>
377
+ OUTPUT
378
+
379
+ html = <<~OUTPUT
318
380
  <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
319
381
  <head/>
320
382
  <body lang='en'>
@@ -343,6 +405,8 @@ INPUT
343
405
  </body>
344
406
  </html>
345
407
  OUTPUT
408
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
409
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
346
410
  end
347
411
 
348
412
  it "processes simple terms & definitions" do
@@ -350,7 +414,7 @@ OUTPUT
350
414
  <iso-standard xmlns="http://riboseinc.com/isoxml">
351
415
  <sections>
352
416
  <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
353
- <term id="J">
417
+ <term id="J"><name>1.1</name>
354
418
  <preferred>Term2</preferred>
355
419
  </term>
356
420
  </terms>
@@ -359,7 +423,7 @@ OUTPUT
359
423
  INPUT
360
424
  #{HTML_HDR}
361
425
  <p class="zzSTDTitle1"/>
362
- <div id="H"><h1>1&#160; Terms, Definitions, Symbols and Abbreviated Terms</h1>
426
+ <div id="H"><h1>Terms, Definitions, Symbols and Abbreviated Terms</h1>
363
427
  <p class="TermNum" id="J">1.1</p>
364
428
  <p class="Terms" style="text-align:left;">Term2</p>
365
429
  </div>
@@ -378,6 +442,7 @@ OUTPUT
378
442
  </clause>
379
443
  <clause id="O" inline-header="true" obligation="normative">
380
444
  <title>Clause 4.2</title>
445
+ <p>Hello</p>
381
446
  </clause></clause>
382
447
 
383
448
  </sections>
@@ -386,12 +451,13 @@ OUTPUT
386
451
  #{HTML_HDR}
387
452
  <p class="zzSTDTitle1"/>
388
453
  <div id="M">
389
- <h1>1&#160; Clause 4</h1>
454
+ <h1>Clause 4</h1>
390
455
  <div id="N">
391
- <h2>1.1&#160; Introduction</h2>
456
+ <h2>Introduction</h2>
392
457
  </div>
393
458
  <div id="O">
394
- <span class="zzMoveToFollowing"><b>1.2&#160; Clause 4.2&#160; </b></span>
459
+ <span class="zzMoveToFollowing"><b>Clause 4.2&#160; </b></span>
460
+ <p>Hello</p>
395
461
  </div>
396
462
  </div>
397
463
  </div>