metanorma-iso 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/iso/html/header-dis.html +111 -29
- data/lib/isodoc/iso/html/isodoc-dis.css +65 -64
- data/lib/isodoc/iso/html/isodoc-dis.scss +65 -64
- data/lib/isodoc/iso/html/style-human.css +1 -2
- data/lib/isodoc/iso/html/style-human.scss +0 -1
- data/lib/isodoc/iso/html/style-iso.css +1 -2
- data/lib/isodoc/iso/html/style-iso.scss +0 -1
- data/lib/isodoc/iso/html/wordstyle-dis.css +10 -4
- data/lib/isodoc/iso/html/wordstyle-dis.scss +10 -4
- data/lib/isodoc/iso/i18n-en.yaml +4 -4
- data/lib/isodoc/iso/iso.amendment.xsl +205 -37
- data/lib/isodoc/iso/iso.international-standard.xsl +205 -37
- data/lib/isodoc/iso/presentation_bibdata.rb +13 -9
- data/lib/isodoc/iso/presentation_xml_convert.rb +5 -3
- data/lib/isodoc/iso/word_convert.rb +6 -4
- data/lib/isodoc/iso/word_dis_cleanup.rb +24 -3
- data/lib/isodoc/iso/word_dis_convert.rb +4 -1
- data/lib/metanorma/iso/base.rb +2 -1
- data/lib/metanorma/iso/biblio.rng +5 -0
- data/lib/metanorma/iso/isodoc.rng +46 -12
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +5 -2
- metadata +4 -87
- data/.github/workflows/automerge.yml +0 -31
- data/.github/workflows/rake.yml +0 -15
- data/.github/workflows/release.yml +0 -24
- data/.github/workflows/ubuntu.yml +0 -41
- data/Rakefile +0 -8
- data/bin/rspec +0 -17
- data/spec/assets/header.html +0 -7
- data/spec/assets/html.css +0 -2
- data/spec/assets/htmlcover.html +0 -4
- data/spec/assets/htmlintro.html +0 -5
- data/spec/assets/i18n.yaml +0 -2
- data/spec/assets/iso.adoc +0 -10
- data/spec/assets/iso.headless.html +0 -33
- data/spec/assets/iso.xml +0 -71
- data/spec/assets/rice_image1.png +0 -0
- data/spec/assets/scripts.html +0 -3
- data/spec/assets/std.css +0 -2
- data/spec/assets/word.css +0 -2
- data/spec/assets/wordcover.html +0 -3
- data/spec/assets/wordintro.html +0 -4
- data/spec/examples/103_01_02.html +0 -247
- data/spec/examples/english.yaml +0 -69
- data/spec/examples/iso_123_.xml +0 -45
- data/spec/examples/iso_123_all_parts.xml +0 -45
- data/spec/examples/iso_123_no_year_note.xml +0 -46
- data/spec/examples/iso_124_.xml +0 -41
- data/spec/examples/iso_216_.xml +0 -47
- data/spec/examples/iso_iec_12382_.xml +0 -48
- data/spec/examples/rice.adoc +0 -714
- data/spec/examples/rice.preview.html +0 -1870
- data/spec/examples/rice.sh +0 -4
- data/spec/examples/rice_img/1000-1_ed2amd3fig1a.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig1b.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig2.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig3.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig4.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig5_f.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figA.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figA1.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figA2.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figTab1.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figTab2.png +0 -0
- data/spec/examples/rice_img/1001_ed2amd3fig1.png +0 -0
- data/spec/examples/rice_img/ISO_1213_1.png +0 -0
- data/spec/examples/rice_img/SL1000-1_ed2amd3fig1.png +0 -0
- data/spec/examples/rice_img/rice_image1.png +0 -0
- data/spec/examples/rice_img/rice_image2.png +0 -0
- data/spec/examples/rice_img/rice_image3_1.png +0 -0
- data/spec/examples/rice_img/rice_image3_2.png +0 -0
- data/spec/examples/rice_img/rice_image3_3.png +0 -0
- data/spec/isodoc/amd_spec.rb +0 -986
- data/spec/isodoc/blocks_spec.rb +0 -1174
- data/spec/isodoc/i18n_spec.rb +0 -1579
- data/spec/isodoc/inline_spec.rb +0 -1060
- data/spec/isodoc/iso_spec.rb +0 -255
- data/spec/isodoc/metadata_spec.rb +0 -701
- data/spec/isodoc/postproc_spec.rb +0 -1089
- data/spec/isodoc/ref_spec.rb +0 -439
- data/spec/isodoc/section_spec.rb +0 -998
- data/spec/isodoc/table_spec.rb +0 -420
- data/spec/isodoc/terms_spec.rb +0 -314
- data/spec/isodoc/word_dis_spec.rb +0 -2064
- data/spec/isodoc/xref_spec.rb +0 -1747
- data/spec/metanorma/amd_spec.rb +0 -724
- data/spec/metanorma/base_spec.rb +0 -1384
- data/spec/metanorma/blank_spec.rb +0 -38
- data/spec/metanorma/blocks_spec.rb +0 -624
- data/spec/metanorma/cleanup_spec.rb +0 -1645
- data/spec/metanorma/inline_spec.rb +0 -203
- data/spec/metanorma/lists_spec.rb +0 -197
- data/spec/metanorma/macros_spec.rb +0 -99
- data/spec/metanorma/processor_spec.rb +0 -161
- data/spec/metanorma/refs_spec.rb +0 -672
- data/spec/metanorma/section_spec.rb +0 -492
- data/spec/metanorma/table_spec.rb +0 -329
- data/spec/metanorma/validate_spec.rb +0 -2153
- data/spec/relaton/render_spec.rb +0 -568
- data/spec/requirements/requirement_components_spec.rb +0 -610
- data/spec/requirements/requirements_spec.rb +0 -1596
- data/spec/requirements/xref_spec.rb +0 -1211
- data/spec/spec_helper.rb +0 -313
- data/spec/vcr_cassettes/docrels.yml +0 -385
- data/spec/vcr_cassettes/withdrawn_iso.yml +0 -295
@@ -1,2064 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "fileutils"
|
3
|
-
|
4
|
-
RSpec.describe IsoDoc do
|
5
|
-
it "maps styles for DIS" do
|
6
|
-
FileUtils.rm_f "test.doc"
|
7
|
-
IsoDoc::Iso::WordConvert
|
8
|
-
.new({})
|
9
|
-
.convert("test", <<~"INPUT", false)
|
10
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
11
|
-
<bibdata>
|
12
|
-
<status><stage>30</stage></status>
|
13
|
-
</bibdata>
|
14
|
-
<sections>
|
15
|
-
<terms id="A">
|
16
|
-
<term id="B">
|
17
|
-
<preferred><expression><name>First</name></expression></preferred>
|
18
|
-
<admitted><expression><name>Second</name></expression></admitted>
|
19
|
-
</term>
|
20
|
-
</terms>
|
21
|
-
</sections>
|
22
|
-
</iso-standard>
|
23
|
-
INPUT
|
24
|
-
expect(File.exist?("test.doc")).to be true
|
25
|
-
html = File.read("test.doc", encoding: "UTF-8")
|
26
|
-
expect(html).to include 'class="AltTerms"'
|
27
|
-
expect(html).not_to include 'class="AdmittedTerm"'
|
28
|
-
|
29
|
-
FileUtils.rm_f "test.doc"
|
30
|
-
IsoDoc::Iso::WordConvert
|
31
|
-
.new({})
|
32
|
-
.convert("test", <<~"INPUT", false)
|
33
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
34
|
-
<bibdata>
|
35
|
-
<status><stage>50</stage></status>
|
36
|
-
</bibdata>
|
37
|
-
<sections>
|
38
|
-
<terms id="A">
|
39
|
-
<term id="B">
|
40
|
-
<preferred><expression><name>First</name></expression></preferred>
|
41
|
-
<admitted><expression><name>Second</name></expression></admitted>
|
42
|
-
</term>
|
43
|
-
</terms>
|
44
|
-
</sections>
|
45
|
-
</iso-standard>
|
46
|
-
INPUT
|
47
|
-
expect(File.exist?("test.doc")).to be true
|
48
|
-
html = File.read("test.doc", encoding: "UTF-8")
|
49
|
-
expect(html).not_to include 'class="AltTerms"'
|
50
|
-
expect(html).to include 'class="AdmittedTerm"'
|
51
|
-
|
52
|
-
FileUtils.rm_f "test.doc"
|
53
|
-
IsoDoc::Iso::WordConvert
|
54
|
-
.new({ isowordtemplate: "simple" })
|
55
|
-
.convert("test", <<~"INPUT", false)
|
56
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
57
|
-
<bibdata>
|
58
|
-
<status><stage>50</stage></status>
|
59
|
-
</bibdata>
|
60
|
-
<sections>
|
61
|
-
<terms id="A">
|
62
|
-
<term id="B">
|
63
|
-
<preferred><expression><name>First</name></expression></preferred>
|
64
|
-
<admitted><expression><name>Second</name></expression></admitted>
|
65
|
-
</term>
|
66
|
-
</terms>
|
67
|
-
</sections>
|
68
|
-
</iso-standard>
|
69
|
-
INPUT
|
70
|
-
expect(File.exist?("test.doc")).to be true
|
71
|
-
html = File.read("test.doc", encoding: "UTF-8")
|
72
|
-
expect(html).to include 'class="AltTerms"'
|
73
|
-
expect(html).not_to include 'class="AdmittedTerm"'
|
74
|
-
|
75
|
-
FileUtils.rm_f "test.doc"
|
76
|
-
IsoDoc::Iso::WordConvert
|
77
|
-
.new({ isowordtemplate: "dis" })
|
78
|
-
.convert("test", <<~"INPUT", false)
|
79
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
80
|
-
<bibdata>
|
81
|
-
<status><stage>30</stage></status>
|
82
|
-
</bibdata>
|
83
|
-
<sections>
|
84
|
-
<terms id="A">
|
85
|
-
<term id="B">
|
86
|
-
<preferred><expression><name>First</name></expression></preferred>
|
87
|
-
<admitted><expression><name>Second</name></expression></admitted>
|
88
|
-
</term>
|
89
|
-
</terms>
|
90
|
-
</sections>
|
91
|
-
</iso-standard>
|
92
|
-
INPUT
|
93
|
-
expect(File.exist?("test.doc")).to be true
|
94
|
-
html = File.read("test.doc", encoding: "UTF-8")
|
95
|
-
expect(html).not_to include 'class="AltTerms"'
|
96
|
-
expect(html).to include 'class="AdmittedTerm"'
|
97
|
-
end
|
98
|
-
|
99
|
-
it "deals with span" do
|
100
|
-
input = <<~INPUT
|
101
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
102
|
-
<bibdata>
|
103
|
-
<status><stage>30</stage></status>
|
104
|
-
</bibdata>
|
105
|
-
<sections>
|
106
|
-
<clause id="A"><p><span class="C"><em>H</em> I</em></span></p></clause>
|
107
|
-
</sections>
|
108
|
-
</iso-standard>
|
109
|
-
INPUT
|
110
|
-
word = <<~OUTPUT
|
111
|
-
<div class='WordSection3'>
|
112
|
-
<p class='zzSTDTitle1'/>
|
113
|
-
<div id='A'>
|
114
|
-
<h1/>
|
115
|
-
<p>
|
116
|
-
<i>H</i>
|
117
|
-
I
|
118
|
-
</p>
|
119
|
-
</div>
|
120
|
-
</div>
|
121
|
-
OUTPUT
|
122
|
-
output = IsoDoc::Iso::WordConvert.new({}).convert("test", input, true)
|
123
|
-
expect(xmlpp(Nokogiri::XML(output)
|
124
|
-
.at("//div[@class = 'WordSection3']").to_xml))
|
125
|
-
.to be_equivalent_to xmlpp(word)
|
126
|
-
|
127
|
-
input = <<~INPUT
|
128
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
129
|
-
<bibdata>
|
130
|
-
<status><stage>50</stage></status>
|
131
|
-
</bibdata>
|
132
|
-
<sections>
|
133
|
-
<clause id="A"><p><span class="C"><em>H</em> I</em></span></p></clause>
|
134
|
-
</sections>
|
135
|
-
</iso-standard>
|
136
|
-
INPUT
|
137
|
-
word = <<~OUTPUT
|
138
|
-
<div class='WordSection3'>
|
139
|
-
<p class='zzSTDTitle'/>
|
140
|
-
<div id='A'>
|
141
|
-
<h1/>
|
142
|
-
<p>
|
143
|
-
<span class='C'>
|
144
|
-
<i>H</i>
|
145
|
-
I
|
146
|
-
</span>
|
147
|
-
</p>
|
148
|
-
</div>
|
149
|
-
</div>
|
150
|
-
OUTPUT
|
151
|
-
output = IsoDoc::Iso::WordConvert.new({}).convert("test", input, true)
|
152
|
-
expect(xmlpp(Nokogiri::XML(output)
|
153
|
-
.at("//div[@class = 'WordSection3']").to_xml))
|
154
|
-
.to be_equivalent_to xmlpp(word)
|
155
|
-
end
|
156
|
-
|
157
|
-
it "deals with foreword and intro" do
|
158
|
-
input = <<~INPUT
|
159
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
160
|
-
<bibdata>
|
161
|
-
<status><stage>30</stage></status>
|
162
|
-
</bibdata>
|
163
|
-
<preface>
|
164
|
-
<foreword><title>Foreword</title><p>Para</p></foreword>
|
165
|
-
<introduction><title>Foreword</title><p>Para</p></introduction>
|
166
|
-
</preface>
|
167
|
-
</iso-standard>
|
168
|
-
INPUT
|
169
|
-
word = <<~OUTPUT
|
170
|
-
<div class='WordSection2'>
|
171
|
-
<div style='mso-element:para-border-div;border:solid windowtext 1.0pt; border-bottom-alt:solid windowtext .5pt;mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt: solid windowtext .5pt;mso-border-right-alt:solid windowtext .5pt;padding:1.0pt 4.0pt 0cm 4.0pt; margin-left:5.1pt;margin-right:5.1pt'>
|
172
|
-
<div>
|
173
|
-
<a name='boilerplate-copyright-destination' id='boilerplate-copyright-destination'/>
|
174
|
-
</div>
|
175
|
-
</div>
|
176
|
-
<p class='zzContents' style='margin-top:0cm'>
|
177
|
-
<span lang='EN-GB' xml:lang='EN-GB'>Contents</span>
|
178
|
-
</p>
|
179
|
-
<p class='MsoNormal'>
|
180
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
181
|
-
</p>
|
182
|
-
<div>
|
183
|
-
<p class='ForewordTitle'>Foreword</p>
|
184
|
-
<p class='ForewordText'>Para</p>
|
185
|
-
</div>
|
186
|
-
<p class='MsoNormal'>
|
187
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
188
|
-
</p>
|
189
|
-
<div class='Section3' id=''>
|
190
|
-
<p class='IntroTitle'>Foreword</p>
|
191
|
-
<p class='MsoNormal'>Para</p>
|
192
|
-
</div>
|
193
|
-
<p class='MsoNormal'> </p>
|
194
|
-
</div>
|
195
|
-
OUTPUT
|
196
|
-
FileUtils.rm_f "test.doc"
|
197
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
198
|
-
expect(File.exist?("test.doc")).to be true
|
199
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
200
|
-
.sub(/^.*<html/m, "<html")
|
201
|
-
.sub(/<\/html>.*$/m, "</html>")
|
202
|
-
doc = Nokogiri::XML(output)
|
203
|
-
.xpath("//xmlns:p[@class = 'MsoToc1']").each(&:remove)
|
204
|
-
.at("//xmlns:div[@class = 'WordSection2']")
|
205
|
-
expect(xmlpp(doc.to_xml))
|
206
|
-
.to be_equivalent_to xmlpp(word)
|
207
|
-
|
208
|
-
input = <<~INPUT
|
209
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
210
|
-
<bibdata>
|
211
|
-
<status><stage>50</stage></status>
|
212
|
-
</bibdata>
|
213
|
-
<preface>
|
214
|
-
<foreword><title>Foreword</title><p>Para</p></foreword>
|
215
|
-
<introduction><title>Foreword</title><p>Para</p></introduction>
|
216
|
-
</preface>
|
217
|
-
</iso-standard>
|
218
|
-
INPUT
|
219
|
-
word = <<~OUTPUT
|
220
|
-
<div class='WordSection2'>
|
221
|
-
<div>
|
222
|
-
<a name='boilerplate-copyright-destination' id='boilerplate-copyright-destination'/>
|
223
|
-
</div>
|
224
|
-
<p class='zzContents'>
|
225
|
-
<span lang='EN-GB' xml:lang='EN-GB'>Contents</span>
|
226
|
-
</p>
|
227
|
-
<p class='MsoBodyText'>
|
228
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
229
|
-
</p>
|
230
|
-
<div>
|
231
|
-
<p class='ForewordTitle'>Foreword</p>
|
232
|
-
<p class='ForewordText'>Para</p>
|
233
|
-
</div>
|
234
|
-
<p class='MsoBodyText'>
|
235
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
236
|
-
</p>
|
237
|
-
<div class='Section3' id=''>
|
238
|
-
<p class='IntroTitle'>Foreword</p>
|
239
|
-
<p class='MsoBodyText'>Para</p>
|
240
|
-
</div>
|
241
|
-
<p class='MsoBodyText'> </p>
|
242
|
-
</div>
|
243
|
-
OUTPUT
|
244
|
-
FileUtils.rm_f "test.doc"
|
245
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
246
|
-
expect(File.exist?("test.doc")).to be true
|
247
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
248
|
-
.sub(/^.*<html/m, "<html")
|
249
|
-
.sub(/<\/html>.*$/m, "</html>")
|
250
|
-
doc = Nokogiri::XML(output)
|
251
|
-
.xpath("//xmlns:p[@class = 'MsoToc1']").each(&:remove)
|
252
|
-
.at("//xmlns:div[@class = 'WordSection2']")
|
253
|
-
expect(xmlpp(doc.to_xml))
|
254
|
-
.to be_equivalent_to xmlpp(word)
|
255
|
-
end
|
256
|
-
|
257
|
-
it "formats references" do
|
258
|
-
input = <<~INPUT
|
259
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
260
|
-
<bibdata>
|
261
|
-
<status><stage>50</stage></status>
|
262
|
-
</bibdata>
|
263
|
-
<bibliography>
|
264
|
-
<references id="_normative_references" normative="true" obligation="informative">
|
265
|
-
<title>Normative References</title>
|
266
|
-
<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>
|
267
|
-
<bibitem id="ISO712" type="standard">
|
268
|
-
<formattedref>ALUFFI, Paolo, ed. (2022). <em><span class="std_class">Facets of Algebraic Geometry: A Collection in Honor of William Fulton's 80th Birthday</span></em>, 1st edition. Cambridge, UK: CUP.</formattedref>
|
269
|
-
<docidentifier type="ISO">ISO/IEC 712-3:2022</docidentifier>
|
270
|
-
</bibitem>
|
271
|
-
</references>
|
272
|
-
</bibliography>
|
273
|
-
</iso-standard>
|
274
|
-
INPUT
|
275
|
-
word = <<~OUTPUT
|
276
|
-
<div class='WordSection3'>
|
277
|
-
<p class='zzSTDTitle'/>
|
278
|
-
<div>
|
279
|
-
<h1>Normative References</h1>
|
280
|
-
<p class='MsoBodyText'>
|
281
|
-
The following documents are referred to in the text in such a way that
|
282
|
-
some or all of their content constitutes requirements of this document.
|
283
|
-
For dated references, only the edition cited applies. For undated
|
284
|
-
references, the latest edition of the referenced document (including any
|
285
|
-
amendments) applies.
|
286
|
-
</p>
|
287
|
-
<p class='RefNorm'>
|
288
|
-
<a name='ISO712' id='ISO712'/>
|
289
|
-
<span class='stdpublisher'>ISO/IEC</span> <span class='stddocNumber'>712</span>-<span class='stddocPartNumber'>3</span>:<span class='stdyear'>2022</span>, ALUFFI, Paolo, ed. (2022).
|
290
|
-
<i>
|
291
|
-
<span class='std_class'>
|
292
|
-
Facets of Algebraic Geometry: A Collection in Honor of William
|
293
|
-
Fulton's 80th Birthday
|
294
|
-
</span>
|
295
|
-
</i>
|
296
|
-
, 1st edition. Cambridge, UK: CUP.
|
297
|
-
</p>
|
298
|
-
</div>
|
299
|
-
</div>
|
300
|
-
OUTPUT
|
301
|
-
FileUtils.rm_f "test.doc"
|
302
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
303
|
-
expect(File.exist?("test.doc")).to be true
|
304
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
305
|
-
.sub(/^.*<html/m, "<html")
|
306
|
-
.sub(/<\/html>.*$/m, "</html>")
|
307
|
-
doc = Nokogiri::XML(output)
|
308
|
-
.at("//xmlns:div[@class = 'WordSection3']")
|
309
|
-
expect(xmlpp(doc.to_xml))
|
310
|
-
.to be_equivalent_to xmlpp(word)
|
311
|
-
end
|
312
|
-
|
313
|
-
it "formats tt" do
|
314
|
-
input = <<~INPUT
|
315
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
316
|
-
<bibdata>
|
317
|
-
<status><stage>50</stage></status>
|
318
|
-
</bibdata>
|
319
|
-
<preface>
|
320
|
-
<foreword>
|
321
|
-
<p><tt>A <strong>B</strong> <em>C</em> <strong>D<em>E</em>F</strong> <em>G<strong>H</strong>I</em></tt></p>
|
322
|
-
<p><strong>A <tt>B</tt> <em>C<tt>D</tt>E</em></strong></p>
|
323
|
-
<p><em>A <tt>B</tt> <strong>C<tt>D</tt>E</strong></em></p>
|
324
|
-
</foreword>
|
325
|
-
</preface>
|
326
|
-
</iso-standard>
|
327
|
-
INPUT
|
328
|
-
word = <<~OUTPUT
|
329
|
-
<div class='WordSection2'>
|
330
|
-
<div>
|
331
|
-
<a name='boilerplate-copyright-destination' id='boilerplate-copyright-destination'/>
|
332
|
-
</div>
|
333
|
-
<p class='zzContents'>
|
334
|
-
<span lang='EN-GB' xml:lang='EN-GB'>Contents</span>
|
335
|
-
</p>
|
336
|
-
<p class='MsoBodyText'>
|
337
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
338
|
-
</p>
|
339
|
-
<div>
|
340
|
-
<p class='ForewordTitle'>Foreword</p>
|
341
|
-
<p class='ForewordText'>
|
342
|
-
<span class='ISOCode'>
|
343
|
-
A
|
344
|
-
<span class='ISOCodebold'>B</span>
|
345
|
-
<span class='ISOCodeitalic'>C</span>
|
346
|
-
<span class='ISOCodebold'>
|
347
|
-
D
|
348
|
-
<span class='ISOCodeitalic'>E</span>
|
349
|
-
F
|
350
|
-
</span>
|
351
|
-
<span class='ISOCodeitalic'>
|
352
|
-
G
|
353
|
-
<b>H</b>
|
354
|
-
I
|
355
|
-
</span>
|
356
|
-
</span>
|
357
|
-
</p>
|
358
|
-
<p class='ForewordText'>
|
359
|
-
<b>
|
360
|
-
A
|
361
|
-
<span class='ISOCodebold'>B</span>
|
362
|
-
<i>
|
363
|
-
C
|
364
|
-
<span class='ISOCodeitalic'>D</span>
|
365
|
-
E
|
366
|
-
</i>
|
367
|
-
</b>
|
368
|
-
</p>
|
369
|
-
<p class='ForewordText'>
|
370
|
-
<i>
|
371
|
-
A
|
372
|
-
<span class='ISOCodeitalic'>B</span>
|
373
|
-
<b>
|
374
|
-
C
|
375
|
-
<span class='ISOCodebold'>D</span>
|
376
|
-
E
|
377
|
-
</b>
|
378
|
-
</i>
|
379
|
-
</p>
|
380
|
-
</div>
|
381
|
-
<p class='MsoBodyText'> </p>
|
382
|
-
</div>
|
383
|
-
OUTPUT
|
384
|
-
FileUtils.rm_f "test.doc"
|
385
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
386
|
-
expect(File.exist?("test.doc")).to be true
|
387
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
388
|
-
.sub(/^.*<html/m, "<html")
|
389
|
-
.sub(/<\/html>.*$/m, "</html>")
|
390
|
-
doc = Nokogiri::XML(output)
|
391
|
-
.xpath("//xmlns:p[@class = 'MsoToc1']").each(&:remove)
|
392
|
-
.at("//xmlns:div[@class = 'WordSection2']")
|
393
|
-
expect(xmlpp(doc.to_xml))
|
394
|
-
.to be_equivalent_to xmlpp(word)
|
395
|
-
end
|
396
|
-
|
397
|
-
it "deals with lists" do
|
398
|
-
input = <<~INPUT
|
399
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
400
|
-
<bibdata>
|
401
|
-
<status><stage>50</stage></status>
|
402
|
-
</bibdata>
|
403
|
-
<sections>
|
404
|
-
<clause id="A"><p>
|
405
|
-
<ol>
|
406
|
-
<li><p>A</p></li>
|
407
|
-
<li><p>B</p></li>
|
408
|
-
<li><ol>
|
409
|
-
<li>C</li>
|
410
|
-
<li>D</li>
|
411
|
-
<li><ol>
|
412
|
-
<li>E</li>
|
413
|
-
<li>F</li>
|
414
|
-
<li><ol>
|
415
|
-
<li>G</li>
|
416
|
-
<li>H</li>
|
417
|
-
<li><ol>
|
418
|
-
<li>I</li>
|
419
|
-
<li>J</li>
|
420
|
-
<li><ol>
|
421
|
-
<li>K</li>
|
422
|
-
<li>L</li>
|
423
|
-
<li>M</li>
|
424
|
-
</ol></li>
|
425
|
-
<li>N</li>
|
426
|
-
</ol></li>
|
427
|
-
<li>O</li>
|
428
|
-
</ol></li>
|
429
|
-
<li>P</li>
|
430
|
-
</ol></li>
|
431
|
-
<li>Q</li>
|
432
|
-
</ol></li>
|
433
|
-
<li>R</li>
|
434
|
-
</ol>
|
435
|
-
<ul>
|
436
|
-
<li><p>A</p></li>
|
437
|
-
<li><p>B</p></li>
|
438
|
-
<li><p>B1</p><ul>
|
439
|
-
<li>C</li>
|
440
|
-
<li>D</li>
|
441
|
-
<li><ul>
|
442
|
-
<li>E</li>
|
443
|
-
<li>F</li>
|
444
|
-
<li><ul>
|
445
|
-
<li>G</li>
|
446
|
-
<li>H</li>
|
447
|
-
<li><ul>
|
448
|
-
<li>I</li>
|
449
|
-
<li>J</li>
|
450
|
-
<li><ul>
|
451
|
-
<li>K</li>
|
452
|
-
<li>L</li>
|
453
|
-
<li>M</li>
|
454
|
-
</ul></li>
|
455
|
-
<li>N</li>
|
456
|
-
</ul></li>
|
457
|
-
<li>O</li>
|
458
|
-
</ul></li>
|
459
|
-
<li>P</li>
|
460
|
-
</ul></li>
|
461
|
-
<li>Q</li>
|
462
|
-
</ul></li>
|
463
|
-
<li>R</li>
|
464
|
-
</ul>
|
465
|
-
</p></clause>
|
466
|
-
</sections>
|
467
|
-
</iso-standard>
|
468
|
-
INPUT
|
469
|
-
word = <<~OUTPUT
|
470
|
-
<div class='WordSection3'>
|
471
|
-
<p class='zzSTDTitle'/>
|
472
|
-
<div>
|
473
|
-
<a name='A' id='A'/>
|
474
|
-
<h1>1</h1>
|
475
|
-
<p class='ListNumber1'>
|
476
|
-
a)
|
477
|
-
<span style='mso-tab-count:1'> </span>
|
478
|
-
A
|
479
|
-
</p>
|
480
|
-
<p class='ListNumber1'>
|
481
|
-
b)
|
482
|
-
<span style='mso-tab-count:1'> </span>
|
483
|
-
B
|
484
|
-
</p>
|
485
|
-
<p class='MsoListNumber2'>
|
486
|
-
1)
|
487
|
-
<span style='mso-tab-count:1'> </span>
|
488
|
-
C
|
489
|
-
</p>
|
490
|
-
<p class='MsoListNumber2'>
|
491
|
-
2)
|
492
|
-
<span style='mso-tab-count:1'> </span>
|
493
|
-
D
|
494
|
-
</p>
|
495
|
-
<p class='MsoListNumber3'>
|
496
|
-
i)
|
497
|
-
<span style='mso-tab-count:1'> </span>
|
498
|
-
E
|
499
|
-
</p>
|
500
|
-
<p class='MsoListNumber3'>
|
501
|
-
ii)
|
502
|
-
<span style='mso-tab-count:1'> </span>
|
503
|
-
F
|
504
|
-
</p>
|
505
|
-
<p class='MsoListNumber4'>
|
506
|
-
A)
|
507
|
-
<span style='mso-tab-count:1'> </span>
|
508
|
-
G
|
509
|
-
</p>
|
510
|
-
<p class='MsoListNumber4'>
|
511
|
-
B)
|
512
|
-
<span style='mso-tab-count:1'> </span>
|
513
|
-
H
|
514
|
-
</p>
|
515
|
-
<p class='MsoListNumber5'>
|
516
|
-
I)
|
517
|
-
<span style='mso-tab-count:1'> </span>
|
518
|
-
I
|
519
|
-
</p>
|
520
|
-
<p class='MsoListNumber5'>
|
521
|
-
II)
|
522
|
-
<span style='mso-tab-count:1'> </span>
|
523
|
-
J
|
524
|
-
</p>
|
525
|
-
<p class='MsoListNumber5'>
|
526
|
-
a)
|
527
|
-
<span style='mso-tab-count:1'> </span>
|
528
|
-
K
|
529
|
-
</p>
|
530
|
-
<p class='MsoListNumber5'>
|
531
|
-
b)
|
532
|
-
<span style='mso-tab-count:1'> </span>
|
533
|
-
L
|
534
|
-
</p>
|
535
|
-
<p class='MsoListNumber5'>
|
536
|
-
c)
|
537
|
-
<span style='mso-tab-count:1'> </span>
|
538
|
-
M
|
539
|
-
</p>
|
540
|
-
<p class='MsoListNumber5'>
|
541
|
-
III)
|
542
|
-
<span style='mso-tab-count:1'> </span>
|
543
|
-
N
|
544
|
-
</p>
|
545
|
-
<p class='MsoListNumber4'>
|
546
|
-
C)
|
547
|
-
<span style='mso-tab-count:1'> </span>
|
548
|
-
O
|
549
|
-
</p>
|
550
|
-
<p class='MsoListNumber3'>
|
551
|
-
iii)
|
552
|
-
<span style='mso-tab-count:1'> </span>
|
553
|
-
P
|
554
|
-
</p>
|
555
|
-
<p class='MsoListNumber2'>
|
556
|
-
3)
|
557
|
-
<span style='mso-tab-count:1'> </span>
|
558
|
-
Q
|
559
|
-
</p>
|
560
|
-
<p class='ListNumber1'>
|
561
|
-
c)
|
562
|
-
<span style='mso-tab-count:1'> </span>
|
563
|
-
R
|
564
|
-
</p>
|
565
|
-
<p class='ListContinue1'>
|
566
|
-
—
|
567
|
-
<span style='mso-tab-count:1'> </span>
|
568
|
-
A
|
569
|
-
</p>
|
570
|
-
<p class='ListContinue1'>
|
571
|
-
—
|
572
|
-
<span style='mso-tab-count:1'> </span>
|
573
|
-
B
|
574
|
-
</p>
|
575
|
-
<p class='ListContinue1'>
|
576
|
-
—
|
577
|
-
<span style='mso-tab-count:1'> </span>
|
578
|
-
B1
|
579
|
-
</p>
|
580
|
-
<p class='MsoListContinue2'>
|
581
|
-
—
|
582
|
-
<span style='mso-tab-count:1'> </span>
|
583
|
-
C
|
584
|
-
</p>
|
585
|
-
<p class='MsoListContinue2'>
|
586
|
-
—
|
587
|
-
<span style='mso-tab-count:1'> </span>
|
588
|
-
D
|
589
|
-
</p>
|
590
|
-
<p class='MsoListContinue3'>
|
591
|
-
—
|
592
|
-
<span style='mso-tab-count:1'> </span>
|
593
|
-
E
|
594
|
-
</p>
|
595
|
-
<p class='MsoListContinue3'>
|
596
|
-
—
|
597
|
-
<span style='mso-tab-count:1'> </span>
|
598
|
-
F
|
599
|
-
</p>
|
600
|
-
<p class='MsoListContinue4'>
|
601
|
-
—
|
602
|
-
<span style='mso-tab-count:1'> </span>
|
603
|
-
G
|
604
|
-
</p>
|
605
|
-
<p class='MsoListContinue4'>
|
606
|
-
—
|
607
|
-
<span style='mso-tab-count:1'> </span>
|
608
|
-
H
|
609
|
-
</p>
|
610
|
-
<p class='MsoListContinue5'>
|
611
|
-
—
|
612
|
-
<span style='mso-tab-count:1'> </span>
|
613
|
-
I
|
614
|
-
</p>
|
615
|
-
<p class='MsoListContinue5'>
|
616
|
-
—
|
617
|
-
<span style='mso-tab-count:1'> </span>
|
618
|
-
J
|
619
|
-
</p>
|
620
|
-
<p class='MsoListContinue5'>
|
621
|
-
—
|
622
|
-
<span style='mso-tab-count:1'> </span>
|
623
|
-
K
|
624
|
-
</p>
|
625
|
-
<p class='MsoListContinue5'>
|
626
|
-
—
|
627
|
-
<span style='mso-tab-count:1'> </span>
|
628
|
-
L
|
629
|
-
</p>
|
630
|
-
<p class='MsoListContinue5'>
|
631
|
-
—
|
632
|
-
<span style='mso-tab-count:1'> </span>
|
633
|
-
M
|
634
|
-
</p>
|
635
|
-
<p class='MsoListContinue5'>
|
636
|
-
—
|
637
|
-
<span style='mso-tab-count:1'> </span>
|
638
|
-
N
|
639
|
-
</p>
|
640
|
-
<p class='MsoListContinue4'>
|
641
|
-
—
|
642
|
-
<span style='mso-tab-count:1'> </span>
|
643
|
-
O
|
644
|
-
</p>
|
645
|
-
<p class='MsoListContinue3'>
|
646
|
-
—
|
647
|
-
<span style='mso-tab-count:1'> </span>
|
648
|
-
P
|
649
|
-
</p>
|
650
|
-
<p class='MsoListContinue2'>
|
651
|
-
—
|
652
|
-
<span style='mso-tab-count:1'> </span>
|
653
|
-
Q
|
654
|
-
</p>
|
655
|
-
<p class='ListContinue1'>
|
656
|
-
—
|
657
|
-
<span style='mso-tab-count:1'> </span>
|
658
|
-
R
|
659
|
-
</p>
|
660
|
-
</div>
|
661
|
-
</div>
|
662
|
-
OUTPUT
|
663
|
-
FileUtils.rm_f "test.doc"
|
664
|
-
presxml = IsoDoc::Iso::PresentationXMLConvert.new({})
|
665
|
-
.convert("test", input, true)
|
666
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, false)
|
667
|
-
expect(File.exist?("test.doc")).to be true
|
668
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
669
|
-
.sub(/^.*<html/m, "<html")
|
670
|
-
.sub(/<\/html>.*$/m, "</html>")
|
671
|
-
expect(xmlpp(Nokogiri::XML(output)
|
672
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml))
|
673
|
-
.to be_equivalent_to xmlpp(word)
|
674
|
-
end
|
675
|
-
|
676
|
-
it "deals with lists and paragraphs" do
|
677
|
-
input = <<~INPUT
|
678
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
679
|
-
<bibdata>
|
680
|
-
<status><stage>50</stage></status>
|
681
|
-
</bibdata>
|
682
|
-
<sections>
|
683
|
-
<clause id="A">
|
684
|
-
<p id="_eb2fd8cd-5cbe-1f1f-7bdb-282868a25828">ISO and IEC maintain terminological databases for use in
|
685
|
-
standardization at the following addresses:</p>
|
686
|
-
|
687
|
-
<ul id="_6f8dbb84-61d9-f774-264e-b7e249cf44d1">
|
688
|
-
<li> <p id="_9f56356a-3a58-64c4-e59e-a23ca3da7e88">ISO Online browsing platform: available at
|
689
|
-
<link target="https://www.iso.org/obp"/></p></li>
|
690
|
-
<li> <p id="_5dc6886f-a99c-e420-a29d-2aa6ca9f376e">IEC Electropedia: available at
|
691
|
-
<link target="https://www.electropedia.org"/>
|
692
|
-
</p> </li> </ul>
|
693
|
-
</clause>
|
694
|
-
</sections>
|
695
|
-
</iso-standard>
|
696
|
-
INPUT
|
697
|
-
word = <<~OUTPUT
|
698
|
-
<div class='WordSection3'>
|
699
|
-
<p class='zzSTDTitle'/>
|
700
|
-
<div>
|
701
|
-
<a name='A' id='A'/>
|
702
|
-
<h1>1</h1>
|
703
|
-
<p class='MsoBodyText'>
|
704
|
-
<a name='_eb2fd8cd-5cbe-1f1f-7bdb-282868a25828' id='_eb2fd8cd-5cbe-1f1f-7bdb-282868a25828'/>
|
705
|
-
ISO and IEC maintain terminological databases for use in standardization
|
706
|
-
at the following addresses:
|
707
|
-
</p>
|
708
|
-
<p class='ListContinue1'>
|
709
|
-
—
|
710
|
-
<span style='mso-tab-count:1'> </span>
|
711
|
-
ISO Online browsing platform: available at
|
712
|
-
<a href='https://www.iso.org/obp'>https://www.iso.org/obp</a>
|
713
|
-
</p>
|
714
|
-
<p class='ListContinue1'>
|
715
|
-
—
|
716
|
-
<span style='mso-tab-count:1'> </span>
|
717
|
-
IEC Electropedia: available at
|
718
|
-
<a href='https://www.electropedia.org'>https://www.electropedia.org</a>
|
719
|
-
</p>
|
720
|
-
</div>
|
721
|
-
</div>
|
722
|
-
OUTPUT
|
723
|
-
FileUtils.rm_f "test.doc"
|
724
|
-
presxml = IsoDoc::Iso::PresentationXMLConvert.new({})
|
725
|
-
.convert("test", input, true)
|
726
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, false)
|
727
|
-
expect(File.exist?("test.doc")).to be true
|
728
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
729
|
-
.sub(/^.*<html/m, "<html")
|
730
|
-
.sub(/<\/html>.*$/m, "</html>")
|
731
|
-
expect(xmlpp(Nokogiri::XML(output)
|
732
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml))
|
733
|
-
.to be_equivalent_to xmlpp(word)
|
734
|
-
end
|
735
|
-
|
736
|
-
it "deals with ordered list start" do
|
737
|
-
input = <<~INPUT
|
738
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
739
|
-
<bibdata>
|
740
|
-
<status><stage>50</stage></status>
|
741
|
-
</bibdata>
|
742
|
-
<sections>
|
743
|
-
<clause id="A"><p>
|
744
|
-
<ol start="3">
|
745
|
-
<li><p>A</p></li>
|
746
|
-
<li><p>B</p></li>
|
747
|
-
<li><ol start="3">
|
748
|
-
<li>C</li>
|
749
|
-
<li>D</li>
|
750
|
-
<li><ol start="3">
|
751
|
-
<li>E</li>
|
752
|
-
<li>F</li>
|
753
|
-
<li><ol start="3">
|
754
|
-
<li>G</li>
|
755
|
-
<li>H</li>
|
756
|
-
<li><ol start="3">
|
757
|
-
<li>I</li>
|
758
|
-
<li>J</li>
|
759
|
-
<li><ol start="3">
|
760
|
-
<li>K</li>
|
761
|
-
<li>L</li>
|
762
|
-
<li>M</li>
|
763
|
-
</ol></li>
|
764
|
-
<li>N</li>
|
765
|
-
</ol></li>
|
766
|
-
<li>O</li>
|
767
|
-
</ol></li>
|
768
|
-
<li>P</li>
|
769
|
-
</ol></li>
|
770
|
-
<li>Q</li>
|
771
|
-
</ol></li>
|
772
|
-
<li>R</li>
|
773
|
-
</ol>
|
774
|
-
</clause>
|
775
|
-
</sections>
|
776
|
-
</iso-standard>
|
777
|
-
INPUT
|
778
|
-
word = <<~OUTPUT
|
779
|
-
<div class='WordSection3'>
|
780
|
-
<p class='zzSTDTitle'/>
|
781
|
-
<div>
|
782
|
-
<a name='A' id='A'/>
|
783
|
-
<h1>1</h1>
|
784
|
-
<p class='ListNumber1'>
|
785
|
-
c)
|
786
|
-
<span style='mso-tab-count:1'> </span>
|
787
|
-
A
|
788
|
-
</p>
|
789
|
-
<p class='ListNumber1'>
|
790
|
-
d)
|
791
|
-
<span style='mso-tab-count:1'> </span>
|
792
|
-
B
|
793
|
-
</p>
|
794
|
-
<p class='MsoListNumber2'>
|
795
|
-
3)
|
796
|
-
<span style='mso-tab-count:1'> </span>
|
797
|
-
C
|
798
|
-
</p>
|
799
|
-
<p class='MsoListNumber2'>
|
800
|
-
4)
|
801
|
-
<span style='mso-tab-count:1'> </span>
|
802
|
-
D
|
803
|
-
</p>
|
804
|
-
<p class='MsoListNumber3'>
|
805
|
-
iii)
|
806
|
-
<span style='mso-tab-count:1'> </span>
|
807
|
-
E
|
808
|
-
</p>
|
809
|
-
<p class='MsoListNumber3'>
|
810
|
-
iv)
|
811
|
-
<span style='mso-tab-count:1'> </span>
|
812
|
-
F
|
813
|
-
</p>
|
814
|
-
<p class='MsoListNumber4'>
|
815
|
-
C)
|
816
|
-
<span style='mso-tab-count:1'> </span>
|
817
|
-
G
|
818
|
-
</p>
|
819
|
-
<p class='MsoListNumber4'>
|
820
|
-
D)
|
821
|
-
<span style='mso-tab-count:1'> </span>
|
822
|
-
H
|
823
|
-
</p>
|
824
|
-
<p class='MsoListNumber5'>
|
825
|
-
III)
|
826
|
-
<span style='mso-tab-count:1'> </span>
|
827
|
-
I
|
828
|
-
</p>
|
829
|
-
<p class='MsoListNumber5'>
|
830
|
-
IV)
|
831
|
-
<span style='mso-tab-count:1'> </span>
|
832
|
-
J
|
833
|
-
</p>
|
834
|
-
<p class='MsoListNumber5'>
|
835
|
-
c)
|
836
|
-
<span style='mso-tab-count:1'> </span>
|
837
|
-
K
|
838
|
-
</p>
|
839
|
-
<p class='MsoListNumber5'>
|
840
|
-
d)
|
841
|
-
<span style='mso-tab-count:1'> </span>
|
842
|
-
L
|
843
|
-
</p>
|
844
|
-
<p class='MsoListNumber5'>
|
845
|
-
e)
|
846
|
-
<span style='mso-tab-count:1'> </span>
|
847
|
-
M
|
848
|
-
</p>
|
849
|
-
<p class='MsoListNumber5'>
|
850
|
-
V)
|
851
|
-
<span style='mso-tab-count:1'> </span>
|
852
|
-
N
|
853
|
-
</p>
|
854
|
-
<p class='MsoListNumber4'>
|
855
|
-
E)
|
856
|
-
<span style='mso-tab-count:1'> </span>
|
857
|
-
O
|
858
|
-
</p>
|
859
|
-
<p class='MsoListNumber3'>
|
860
|
-
v)
|
861
|
-
<span style='mso-tab-count:1'> </span>
|
862
|
-
P
|
863
|
-
</p>
|
864
|
-
<p class='MsoListNumber2'>
|
865
|
-
5)
|
866
|
-
<span style='mso-tab-count:1'> </span>
|
867
|
-
Q
|
868
|
-
</p>
|
869
|
-
<p class='ListNumber1'>
|
870
|
-
e)
|
871
|
-
<span style='mso-tab-count:1'> </span>
|
872
|
-
R
|
873
|
-
</p>
|
874
|
-
</div>
|
875
|
-
</div>
|
876
|
-
OUTPUT
|
877
|
-
FileUtils.rm_f "test.doc"
|
878
|
-
presxml = IsoDoc::Iso::PresentationXMLConvert.new({})
|
879
|
-
.convert("test", input, true)
|
880
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, false)
|
881
|
-
expect(File.exist?("test.doc")).to be true
|
882
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
883
|
-
.sub(/^.*<html/m, "<html")
|
884
|
-
.sub(/<\/html>.*$/m, "</html>")
|
885
|
-
expect(xmlpp(Nokogiri::XML(output)
|
886
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml))
|
887
|
-
.to be_equivalent_to xmlpp(word)
|
888
|
-
end
|
889
|
-
|
890
|
-
it "deals with tables" do
|
891
|
-
input = <<~INPUT
|
892
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
893
|
-
<bibdata>
|
894
|
-
<status><stage>50</stage></status>
|
895
|
-
</bibdata>
|
896
|
-
<sections>
|
897
|
-
<clause id="A">
|
898
|
-
<table id="B">
|
899
|
-
<name>Table1</name>
|
900
|
-
<thead>
|
901
|
-
<tr>
|
902
|
-
<th>A</th><th><p>B</p></th>
|
903
|
-
</tr>
|
904
|
-
</thead>
|
905
|
-
<tbody>
|
906
|
-
<tr>
|
907
|
-
<th>C</th><td><p>D</p></td>
|
908
|
-
</tr>
|
909
|
-
</tbody>
|
910
|
-
<tfoot>
|
911
|
-
<tr>
|
912
|
-
<th>E</th><td><p>F</p></td>
|
913
|
-
</tr>
|
914
|
-
</tfoot>
|
915
|
-
</table>
|
916
|
-
</clause>
|
917
|
-
</sections>
|
918
|
-
</iso-standard>
|
919
|
-
INPUT
|
920
|
-
word = <<~WORD
|
921
|
-
<div class='WordSection3'>
|
922
|
-
<p class='zzSTDTitle'/>
|
923
|
-
<div>
|
924
|
-
<a name='A' id='A'/>
|
925
|
-
<h1/>
|
926
|
-
<p class='Tabletitle' style='text-align:center;'>Table1</p>
|
927
|
-
<div align='center' class='table_container'>
|
928
|
-
<table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
929
|
-
<a name='B' id='B'/>
|
930
|
-
<thead>
|
931
|
-
<tr>
|
932
|
-
<th style='font-weight:bold;border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;' align='center' valign='middle'>
|
933
|
-
<div class='Tableheader'>A</div>
|
934
|
-
</th>
|
935
|
-
<th style='font-weight:bold;border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;' align='center' valign='middle'>
|
936
|
-
<p class='Tableheader' style='text-align: center'>B</p>
|
937
|
-
</th>
|
938
|
-
</tr>
|
939
|
-
</thead>
|
940
|
-
<tbody>
|
941
|
-
<tr>
|
942
|
-
<th style='font-weight:bold;border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>
|
943
|
-
<div class='Tablebody'>C</div>
|
944
|
-
</th>
|
945
|
-
<td style='border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>
|
946
|
-
<p class='Tablebody'>D</p>
|
947
|
-
</td>
|
948
|
-
</tr>
|
949
|
-
</tbody>
|
950
|
-
<tfoot>
|
951
|
-
<tr>
|
952
|
-
<th style='font-weight:bold;border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>
|
953
|
-
<div class='Tablebody'>E</div>
|
954
|
-
</th>
|
955
|
-
<td style='border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>
|
956
|
-
<p class='Tablebody'>F</p>
|
957
|
-
</td>
|
958
|
-
</tr>
|
959
|
-
</tfoot>
|
960
|
-
</table>
|
961
|
-
</div>
|
962
|
-
</div>
|
963
|
-
</div>
|
964
|
-
WORD
|
965
|
-
FileUtils.rm_f "test.doc"
|
966
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
967
|
-
expect(File.exist?("test.doc")).to be true
|
968
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
969
|
-
.sub(/^.*<html/m, "<html")
|
970
|
-
.sub(/<\/html>.*$/m, "</html>")
|
971
|
-
expect(xmlpp(Nokogiri::XML(output)
|
972
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml))
|
973
|
-
.to be_equivalent_to xmlpp(word)
|
974
|
-
end
|
975
|
-
|
976
|
-
it "deals with figures" do
|
977
|
-
input = <<~INPUT
|
978
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
979
|
-
<bibdata>
|
980
|
-
<status><stage>50</stage></status>
|
981
|
-
</bibdata>
|
982
|
-
<sections>
|
983
|
-
<clause id="A">
|
984
|
-
<figure id="B">
|
985
|
-
<name>Table1</name>
|
986
|
-
<image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto"/>
|
987
|
-
<note id="C"><name>FIGURENOTE</name><p>Note</p></note>
|
988
|
-
<example id="D"><p>Example</p></example>
|
989
|
-
</figure>
|
990
|
-
</clause>
|
991
|
-
</sections>
|
992
|
-
</iso-standard>
|
993
|
-
INPUT
|
994
|
-
word = <<~WORD
|
995
|
-
<div class='WordSection3'>
|
996
|
-
<p class='zzSTDTitle'/>
|
997
|
-
<div>
|
998
|
-
<a name='A' id='A'/>
|
999
|
-
<h1/>
|
1000
|
-
<div class='figure'>
|
1001
|
-
<a name='B' id='B'/>
|
1002
|
-
<p class='FigureGraphic'>
|
1003
|
-
<img src='_.gif' height='20' width='20'/>
|
1004
|
-
</p>
|
1005
|
-
<div class='Figurenote'>
|
1006
|
-
<a name='C' id='C'/>
|
1007
|
-
<p class='Figurenote'>
|
1008
|
-
FIGURENOTE
|
1009
|
-
<span style='mso-tab-count:1'> </span>
|
1010
|
-
Note
|
1011
|
-
</p>
|
1012
|
-
</div>
|
1013
|
-
<div class="Figureexample" style='page-break-after:avoid;'>
|
1014
|
-
<a name='D' id='D'/>
|
1015
|
-
<p class='Figureexample'>
|
1016
|
-
<span style='mso-tab-count:1'> </span>
|
1017
|
-
Example
|
1018
|
-
</p>
|
1019
|
-
</div>
|
1020
|
-
<p class='Figuretitle' style='text-align:center;'>Table1</p>
|
1021
|
-
</div>
|
1022
|
-
</div>
|
1023
|
-
</div>
|
1024
|
-
WORD
|
1025
|
-
FileUtils.rm_f "test.doc"
|
1026
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
1027
|
-
expect(File.exist?("test.doc")).to be true
|
1028
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
1029
|
-
.sub(/^.*<html/m, "<html")
|
1030
|
-
.sub(/<\/html>.*$/m, "</html>")
|
1031
|
-
expect(strip_guid(xmlpp(Nokogiri::XML(output)
|
1032
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml)))
|
1033
|
-
.to be_equivalent_to xmlpp(word)
|
1034
|
-
end
|
1035
|
-
|
1036
|
-
it "deals with examples" do
|
1037
|
-
input = <<~INPUT
|
1038
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1039
|
-
<bibdata>
|
1040
|
-
<status><stage>50</stage></status>
|
1041
|
-
</bibdata>
|
1042
|
-
<sections>
|
1043
|
-
<clause id="A">
|
1044
|
-
<example id="B">
|
1045
|
-
<name>EXAMPLE</name>
|
1046
|
-
<p>First example</p>
|
1047
|
-
</example>
|
1048
|
-
<example id="C">
|
1049
|
-
<p>Second example</p>
|
1050
|
-
<sourcecode>Code</sourcecode>
|
1051
|
-
<p>Continuation</p>
|
1052
|
-
</example>
|
1053
|
-
</clause>
|
1054
|
-
</sections>
|
1055
|
-
</iso-standard>
|
1056
|
-
INPUT
|
1057
|
-
word = <<~WORD
|
1058
|
-
<div class='WordSection3'>
|
1059
|
-
<p class='zzSTDTitle'/>
|
1060
|
-
<div>
|
1061
|
-
<a name='A' id='A'/>
|
1062
|
-
<h1/>
|
1063
|
-
<div>
|
1064
|
-
<a name='B' id='B'/>
|
1065
|
-
<p class='Example'>
|
1066
|
-
EXAMPLE
|
1067
|
-
<span style='mso-tab-count:1'> </span>
|
1068
|
-
First example
|
1069
|
-
</p>
|
1070
|
-
</div>
|
1071
|
-
<div>
|
1072
|
-
<a name='C' id='C'/>
|
1073
|
-
<p class='Example'>
|
1074
|
-
<span style='mso-tab-count:1'> </span>
|
1075
|
-
Second example
|
1076
|
-
</p>
|
1077
|
-
<p class='Code-' style='margin-bottom:12pt;'>Code</p>
|
1078
|
-
<p class='Examplecontinued'>Continuation</p>
|
1079
|
-
</div>
|
1080
|
-
</div>
|
1081
|
-
</div>
|
1082
|
-
WORD
|
1083
|
-
FileUtils.rm_f "test.doc"
|
1084
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
1085
|
-
expect(File.exist?("test.doc")).to be true
|
1086
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
1087
|
-
.sub(/^.*<html/m, "<html")
|
1088
|
-
.sub(/<\/html>.*$/m, "</html>")
|
1089
|
-
expect(strip_guid(xmlpp(Nokogiri::XML(output)
|
1090
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml)))
|
1091
|
-
.to be_equivalent_to xmlpp(word)
|
1092
|
-
end
|
1093
|
-
|
1094
|
-
it "deals with notes" do
|
1095
|
-
input = <<~INPUT
|
1096
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1097
|
-
<bibdata>
|
1098
|
-
<status><stage>50</stage></status>
|
1099
|
-
</bibdata>
|
1100
|
-
<sections>
|
1101
|
-
<clause id="A">
|
1102
|
-
<note id="B">
|
1103
|
-
<name>NOTE</name>
|
1104
|
-
<p>First example</p>
|
1105
|
-
</note>
|
1106
|
-
<note id="C">
|
1107
|
-
<p>Second example</p>
|
1108
|
-
<sourcecode>Code</sourcecode>
|
1109
|
-
<p>Continuation</p>
|
1110
|
-
</note>
|
1111
|
-
</clause>
|
1112
|
-
</sections>
|
1113
|
-
</iso-standard>
|
1114
|
-
INPUT
|
1115
|
-
word = <<~WORD
|
1116
|
-
<div class='WordSection3'>
|
1117
|
-
<p class='zzSTDTitle'/>
|
1118
|
-
<div>
|
1119
|
-
<a name='A' id='A'/>
|
1120
|
-
<h1/>
|
1121
|
-
<div>
|
1122
|
-
<a name='B' id='B'/>
|
1123
|
-
<p class='Note'>
|
1124
|
-
NOTE
|
1125
|
-
<span style='mso-tab-count:1'> </span>
|
1126
|
-
First example
|
1127
|
-
</p>
|
1128
|
-
</div>
|
1129
|
-
<div>
|
1130
|
-
<a name='C' id='C'/>
|
1131
|
-
<p class='Note'>
|
1132
|
-
<span style='mso-tab-count:1'> </span>
|
1133
|
-
Second example
|
1134
|
-
</p>
|
1135
|
-
<p class='Code-'>Code</p>
|
1136
|
-
<p class='Notecontinued'>Continuation</p>
|
1137
|
-
</div>
|
1138
|
-
</div>
|
1139
|
-
</div>
|
1140
|
-
WORD
|
1141
|
-
FileUtils.rm_f "test.doc"
|
1142
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
1143
|
-
expect(File.exist?("test.doc")).to be true
|
1144
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
1145
|
-
.sub(/^.*<html/m, "<html")
|
1146
|
-
.sub(/<\/html>.*$/m, "</html>")
|
1147
|
-
expect(strip_guid(xmlpp(Nokogiri::XML(output)
|
1148
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml)))
|
1149
|
-
.to be_equivalent_to xmlpp(word)
|
1150
|
-
end
|
1151
|
-
|
1152
|
-
it "deals with unordered lists embedded within notes and examples" do
|
1153
|
-
input = <<~INPUT
|
1154
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1155
|
-
<bibdata>
|
1156
|
-
<status><stage>50</stage></status>
|
1157
|
-
</bibdata>
|
1158
|
-
<sections>
|
1159
|
-
<clause id="A">
|
1160
|
-
<note id="B">
|
1161
|
-
<ul>
|
1162
|
-
<li><p>A</p></li>
|
1163
|
-
<li><p>B</p></li>
|
1164
|
-
<li><ul>
|
1165
|
-
<li>C</li>
|
1166
|
-
<li>D</li>
|
1167
|
-
<li><ul>
|
1168
|
-
<li>E</li>
|
1169
|
-
<li>F</li>
|
1170
|
-
<li><ul>
|
1171
|
-
<li>G</li>
|
1172
|
-
<li>H</li>
|
1173
|
-
<li><ul>
|
1174
|
-
<li>I</li>
|
1175
|
-
<li>J</li>
|
1176
|
-
<li><ul>
|
1177
|
-
<li>K</li>
|
1178
|
-
<li>L</li>
|
1179
|
-
<li>M</li>
|
1180
|
-
</ul></li>
|
1181
|
-
<li>N</li>
|
1182
|
-
</ul></li>
|
1183
|
-
<li>O</li>
|
1184
|
-
</ul></li>
|
1185
|
-
<li>P</li>
|
1186
|
-
</ul></li>
|
1187
|
-
<li>Q</li>
|
1188
|
-
</ul></li>
|
1189
|
-
<li>R</li>
|
1190
|
-
</ul>
|
1191
|
-
</note>
|
1192
|
-
</clause>
|
1193
|
-
</sections>
|
1194
|
-
</iso-standard>
|
1195
|
-
INPUT
|
1196
|
-
word = <<~WORD
|
1197
|
-
<div class='WordSection3'>
|
1198
|
-
<p class='zzSTDTitle'/>
|
1199
|
-
<div>
|
1200
|
-
<a name='A' id='A'/>
|
1201
|
-
<h1>1</h1>
|
1202
|
-
<div>
|
1203
|
-
<a name='B' id='B'/>
|
1204
|
-
<p class='Note'>
|
1205
|
-
NOTE
|
1206
|
-
<span style='mso-tab-count:1'> </span>
|
1207
|
-
</p>
|
1208
|
-
<p class='ListContinue2-'>
|
1209
|
-
—
|
1210
|
-
<span style='mso-tab-count:1'> </span>
|
1211
|
-
A
|
1212
|
-
</p>
|
1213
|
-
<p class='ListContinue2-'>
|
1214
|
-
—
|
1215
|
-
<span style='mso-tab-count:1'> </span>
|
1216
|
-
B
|
1217
|
-
</p>
|
1218
|
-
<p class='ListContinue3-'>
|
1219
|
-
—
|
1220
|
-
<span style='mso-tab-count:1'> </span>
|
1221
|
-
C
|
1222
|
-
</p>
|
1223
|
-
<p class='ListContinue3-'>
|
1224
|
-
—
|
1225
|
-
<span style='mso-tab-count:1'> </span>
|
1226
|
-
D
|
1227
|
-
</p>
|
1228
|
-
<p class='ListContinue4-'>
|
1229
|
-
—
|
1230
|
-
<span style='mso-tab-count:1'> </span>
|
1231
|
-
E
|
1232
|
-
</p>
|
1233
|
-
<p class='ListContinue4-'>
|
1234
|
-
—
|
1235
|
-
<span style='mso-tab-count:1'> </span>
|
1236
|
-
F
|
1237
|
-
</p>
|
1238
|
-
<p class='ListContinue5-'>
|
1239
|
-
—
|
1240
|
-
<span style='mso-tab-count:1'> </span>
|
1241
|
-
G
|
1242
|
-
</p>
|
1243
|
-
<p class='ListContinue5-'>
|
1244
|
-
—
|
1245
|
-
<span style='mso-tab-count:1'> </span>
|
1246
|
-
H
|
1247
|
-
</p>
|
1248
|
-
<p class='ListContinue5-'>
|
1249
|
-
—
|
1250
|
-
<span style='mso-tab-count:1'> </span>
|
1251
|
-
I
|
1252
|
-
</p>
|
1253
|
-
<p class='ListContinue5-'>
|
1254
|
-
—
|
1255
|
-
<span style='mso-tab-count:1'> </span>
|
1256
|
-
J
|
1257
|
-
</p>
|
1258
|
-
<p class='ListContinue5-'>
|
1259
|
-
—
|
1260
|
-
<span style='mso-tab-count:1'> </span>
|
1261
|
-
K
|
1262
|
-
</p>
|
1263
|
-
<p class='ListContinue5-'>
|
1264
|
-
—
|
1265
|
-
<span style='mso-tab-count:1'> </span>
|
1266
|
-
L
|
1267
|
-
</p>
|
1268
|
-
<p class='ListContinue5-'>
|
1269
|
-
—
|
1270
|
-
<span style='mso-tab-count:1'> </span>
|
1271
|
-
M
|
1272
|
-
</p>
|
1273
|
-
<p class='ListContinue5-'>
|
1274
|
-
—
|
1275
|
-
<span style='mso-tab-count:1'> </span>
|
1276
|
-
N
|
1277
|
-
</p>
|
1278
|
-
<p class='ListContinue5-'>
|
1279
|
-
—
|
1280
|
-
<span style='mso-tab-count:1'> </span>
|
1281
|
-
O
|
1282
|
-
</p>
|
1283
|
-
<p class='ListContinue4-'>
|
1284
|
-
—
|
1285
|
-
<span style='mso-tab-count:1'> </span>
|
1286
|
-
P
|
1287
|
-
</p>
|
1288
|
-
<p class='ListContinue3-'>
|
1289
|
-
—
|
1290
|
-
<span style='mso-tab-count:1'> </span>
|
1291
|
-
Q
|
1292
|
-
</p>
|
1293
|
-
<p class='ListContinue2-'>
|
1294
|
-
—
|
1295
|
-
<span style='mso-tab-count:1'> </span>
|
1296
|
-
R
|
1297
|
-
</p>
|
1298
|
-
</div>
|
1299
|
-
</div>
|
1300
|
-
</div>
|
1301
|
-
WORD
|
1302
|
-
FileUtils.rm_f "test.doc"
|
1303
|
-
presxml = IsoDoc::Iso::PresentationXMLConvert.new({})
|
1304
|
-
.convert("test", input, true)
|
1305
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, false)
|
1306
|
-
expect(File.exist?("test.doc")).to be true
|
1307
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
1308
|
-
.sub(/^.*<html/m, "<html")
|
1309
|
-
.sub(/<\/html>.*$/m, "</html>")
|
1310
|
-
expect(strip_guid(xmlpp(Nokogiri::XML(output)
|
1311
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml)))
|
1312
|
-
.to be_equivalent_to xmlpp(word)
|
1313
|
-
end
|
1314
|
-
|
1315
|
-
it "deals with ordered lists embedded within notes and examples" do
|
1316
|
-
input = <<~INPUT
|
1317
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1318
|
-
<bibdata>
|
1319
|
-
<status><stage>50</stage></status>
|
1320
|
-
</bibdata>
|
1321
|
-
<sections>
|
1322
|
-
<clause id="A">
|
1323
|
-
<example id="B">
|
1324
|
-
<ol>
|
1325
|
-
<li><p>A</p></li>
|
1326
|
-
<li><p>B</p></li>
|
1327
|
-
<li><ol>
|
1328
|
-
<li>C</li>
|
1329
|
-
<li>D</li>
|
1330
|
-
<li><ol>
|
1331
|
-
<li>E</li>
|
1332
|
-
<li>F</li>
|
1333
|
-
<li><ol>
|
1334
|
-
<li>G</li>
|
1335
|
-
<li>H</li>
|
1336
|
-
<li><ol>
|
1337
|
-
<li>I</li>
|
1338
|
-
<li>J</li>
|
1339
|
-
<li><ol>
|
1340
|
-
<li>K</li>
|
1341
|
-
<li>L</li>
|
1342
|
-
<li>M</li>
|
1343
|
-
</ol></li>
|
1344
|
-
<li>N</li>
|
1345
|
-
</ol></li>
|
1346
|
-
<li>O</li>
|
1347
|
-
</ol></li>
|
1348
|
-
<li>P</li>
|
1349
|
-
</ol></li>
|
1350
|
-
<li>Q</li>
|
1351
|
-
</ol></li>
|
1352
|
-
<li>R</li>
|
1353
|
-
</ol>
|
1354
|
-
</example>
|
1355
|
-
</clause>
|
1356
|
-
</sections>
|
1357
|
-
</iso-standard>
|
1358
|
-
INPUT
|
1359
|
-
word = <<~WORD
|
1360
|
-
<div class='WordSection3'>
|
1361
|
-
<p class='zzSTDTitle'/>
|
1362
|
-
<div>
|
1363
|
-
<a name='A' id='A'/>
|
1364
|
-
<h1>1</h1>
|
1365
|
-
<div>
|
1366
|
-
<a name='B' id='B'/>
|
1367
|
-
<p class='Example'>
|
1368
|
-
EXAMPLE
|
1369
|
-
<span style='mso-tab-count:1'> </span>
|
1370
|
-
</p>
|
1371
|
-
<p class='ListNumber2-'>
|
1372
|
-
a)
|
1373
|
-
<span style='mso-tab-count:1'> </span>
|
1374
|
-
A
|
1375
|
-
</p>
|
1376
|
-
<p class='ListNumber2-'>
|
1377
|
-
b)
|
1378
|
-
<span style='mso-tab-count:1'> </span>
|
1379
|
-
B
|
1380
|
-
</p>
|
1381
|
-
<p class='ListNumber3-'>
|
1382
|
-
1)
|
1383
|
-
<span style='mso-tab-count:1'> </span>
|
1384
|
-
C
|
1385
|
-
</p>
|
1386
|
-
<p class='ListNumber3-'>
|
1387
|
-
2)
|
1388
|
-
<span style='mso-tab-count:1'> </span>
|
1389
|
-
D
|
1390
|
-
</p>
|
1391
|
-
<p class='ListNumber4-'>
|
1392
|
-
i)
|
1393
|
-
<span style='mso-tab-count:1'> </span>
|
1394
|
-
E
|
1395
|
-
</p>
|
1396
|
-
<p class='ListNumber4-'>
|
1397
|
-
ii)
|
1398
|
-
<span style='mso-tab-count:1'> </span>
|
1399
|
-
F
|
1400
|
-
</p>
|
1401
|
-
<p class='ListNumber5-'>
|
1402
|
-
A)
|
1403
|
-
<span style='mso-tab-count:1'> </span>
|
1404
|
-
G
|
1405
|
-
</p>
|
1406
|
-
<p class='ListNumber5-'>
|
1407
|
-
B)
|
1408
|
-
<span style='mso-tab-count:1'> </span>
|
1409
|
-
H
|
1410
|
-
</p>
|
1411
|
-
<p class='ListNumber5-'>
|
1412
|
-
I)
|
1413
|
-
<span style='mso-tab-count:1'> </span>
|
1414
|
-
I
|
1415
|
-
</p>
|
1416
|
-
<p class='ListNumber5-'>
|
1417
|
-
II)
|
1418
|
-
<span style='mso-tab-count:1'> </span>
|
1419
|
-
J
|
1420
|
-
</p>
|
1421
|
-
<p class='ListNumber5-'>
|
1422
|
-
a)
|
1423
|
-
<span style='mso-tab-count:1'> </span>
|
1424
|
-
K
|
1425
|
-
</p>
|
1426
|
-
<p class='ListNumber5-'>
|
1427
|
-
b)
|
1428
|
-
<span style='mso-tab-count:1'> </span>
|
1429
|
-
L
|
1430
|
-
</p>
|
1431
|
-
<p class='ListNumber5-'>
|
1432
|
-
c)
|
1433
|
-
<span style='mso-tab-count:1'> </span>
|
1434
|
-
M
|
1435
|
-
</p>
|
1436
|
-
<p class='ListNumber5-'>
|
1437
|
-
III)
|
1438
|
-
<span style='mso-tab-count:1'> </span>
|
1439
|
-
N
|
1440
|
-
</p>
|
1441
|
-
<p class='ListNumber5-'>
|
1442
|
-
C)
|
1443
|
-
<span style='mso-tab-count:1'> </span>
|
1444
|
-
O
|
1445
|
-
</p>
|
1446
|
-
<p class='ListNumber4-'>
|
1447
|
-
iii)
|
1448
|
-
<span style='mso-tab-count:1'> </span>
|
1449
|
-
P
|
1450
|
-
</p>
|
1451
|
-
<p class='ListNumber3-'>
|
1452
|
-
3)
|
1453
|
-
<span style='mso-tab-count:1'> </span>
|
1454
|
-
Q
|
1455
|
-
</p>
|
1456
|
-
<p class='ListNumber2-'>
|
1457
|
-
c)
|
1458
|
-
<span style='mso-tab-count:1'> </span>
|
1459
|
-
R
|
1460
|
-
</p>
|
1461
|
-
</div>
|
1462
|
-
</div>
|
1463
|
-
</div>
|
1464
|
-
WORD
|
1465
|
-
FileUtils.rm_f "test.doc"
|
1466
|
-
presxml = IsoDoc::Iso::PresentationXMLConvert.new({})
|
1467
|
-
.convert("test", input, true)
|
1468
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, false)
|
1469
|
-
expect(File.exist?("test.doc")).to be true
|
1470
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
1471
|
-
.sub(/^.*<html/m, "<html")
|
1472
|
-
.sub(/<\/html>.*$/m, "</html>")
|
1473
|
-
expect(strip_guid(xmlpp(Nokogiri::XML(output)
|
1474
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml)))
|
1475
|
-
.to be_equivalent_to xmlpp(word)
|
1476
|
-
end
|
1477
|
-
|
1478
|
-
it "ignores intervening ul in numbering ol" do
|
1479
|
-
input = <<~INPUT
|
1480
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1481
|
-
<bibdata>
|
1482
|
-
<status><stage>50</stage></status>
|
1483
|
-
</bibdata>
|
1484
|
-
<sections>
|
1485
|
-
<clause id="A">
|
1486
|
-
<ul>
|
1487
|
-
<li>A</li>
|
1488
|
-
<li>
|
1489
|
-
<ol>
|
1490
|
-
<li>List</li>
|
1491
|
-
<li>
|
1492
|
-
<ul>
|
1493
|
-
<li>B</li>
|
1494
|
-
<li>
|
1495
|
-
<ol>
|
1496
|
-
<li>List 2</li>
|
1497
|
-
</ol>
|
1498
|
-
</li>
|
1499
|
-
</ul>
|
1500
|
-
</li>
|
1501
|
-
</ol>
|
1502
|
-
</li>
|
1503
|
-
</ul>
|
1504
|
-
</clause></sections>
|
1505
|
-
</iso-standard>
|
1506
|
-
INPUT
|
1507
|
-
word = <<~WORD
|
1508
|
-
<div class='WordSection3'>
|
1509
|
-
<p class='zzSTDTitle'/>
|
1510
|
-
<div>
|
1511
|
-
<a name='A' id='A'/>
|
1512
|
-
<h1>1</h1>
|
1513
|
-
<p class='ListContinue1'>
|
1514
|
-
—
|
1515
|
-
<span style='mso-tab-count:1'> </span>
|
1516
|
-
A
|
1517
|
-
</p>
|
1518
|
-
<p class='MsoListNumber2'>
|
1519
|
-
a)
|
1520
|
-
<span style='mso-tab-count:1'> </span>
|
1521
|
-
List
|
1522
|
-
</p>
|
1523
|
-
<p class='MsoListContinue3'>
|
1524
|
-
—
|
1525
|
-
<span style='mso-tab-count:1'> </span>
|
1526
|
-
B
|
1527
|
-
</p>
|
1528
|
-
<p class='MsoListNumber4'>
|
1529
|
-
1)
|
1530
|
-
<span style='mso-tab-count:1'> </span>
|
1531
|
-
List 2
|
1532
|
-
</p>
|
1533
|
-
</div>
|
1534
|
-
</div>
|
1535
|
-
WORD
|
1536
|
-
FileUtils.rm_f "test.doc"
|
1537
|
-
presxml = IsoDoc::Iso::PresentationXMLConvert.new({})
|
1538
|
-
.convert("test", input, true)
|
1539
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, false)
|
1540
|
-
expect(File.exist?("test.doc")).to be true
|
1541
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
1542
|
-
.sub(/^.*<html/m, "<html")
|
1543
|
-
.sub(/<\/html>.*$/m, "</html>")
|
1544
|
-
expect(strip_guid(xmlpp(Nokogiri::XML(output)
|
1545
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml)))
|
1546
|
-
.to be_equivalent_to xmlpp(word)
|
1547
|
-
end
|
1548
|
-
|
1549
|
-
it "deals with definition lists embedded within notes and examples" do
|
1550
|
-
input = <<~INPUT
|
1551
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1552
|
-
<bibdata>
|
1553
|
-
<status><stage>50</stage></status>
|
1554
|
-
</bibdata>
|
1555
|
-
<sections>
|
1556
|
-
<clause id="A">
|
1557
|
-
<example id="B">
|
1558
|
-
<name>EXAMPLE</name>
|
1559
|
-
<dl>
|
1560
|
-
<dt>A</dt><dd>B</dd>
|
1561
|
-
</dl>
|
1562
|
-
</example>
|
1563
|
-
</clause>
|
1564
|
-
</sections>
|
1565
|
-
</iso-standard>
|
1566
|
-
INPUT
|
1567
|
-
word = <<~WORD
|
1568
|
-
<div class='WordSection3'>
|
1569
|
-
<p class='zzSTDTitle'/>
|
1570
|
-
<div>
|
1571
|
-
<a name='A' id='A'/>
|
1572
|
-
<h1/>
|
1573
|
-
<div>
|
1574
|
-
<a name='B' id='B'/>
|
1575
|
-
<p class='Example'>
|
1576
|
-
EXAMPLE
|
1577
|
-
<span style='mso-tab-count:1'> </span>
|
1578
|
-
</p>
|
1579
|
-
<table class='dl' style='margin-left: 1cm;'>
|
1580
|
-
<tr>
|
1581
|
-
<td valign='top' align='left'>
|
1582
|
-
<p align='left' style='margin-left:0pt;text-align:left;' class='Tablebody'>A</p>
|
1583
|
-
</td>
|
1584
|
-
<td valign='top'>
|
1585
|
-
<div class='Tablebody'>B</div>
|
1586
|
-
</td>
|
1587
|
-
</tr>
|
1588
|
-
</table>
|
1589
|
-
</div>
|
1590
|
-
</div>
|
1591
|
-
</div>
|
1592
|
-
WORD
|
1593
|
-
FileUtils.rm_f "test.doc"
|
1594
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
1595
|
-
expect(File.exist?("test.doc")).to be true
|
1596
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
1597
|
-
.sub(/^.*<html/m, "<html")
|
1598
|
-
.sub(/<\/html>.*$/m, "</html>")
|
1599
|
-
expect(strip_guid(xmlpp(Nokogiri::XML(output)
|
1600
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml)))
|
1601
|
-
.to be_equivalent_to xmlpp(word)
|
1602
|
-
end
|
1603
|
-
|
1604
|
-
it "deals with annexes" do
|
1605
|
-
input = <<~INPUT
|
1606
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1607
|
-
<bibdata>
|
1608
|
-
<status><stage>50</stage></status>
|
1609
|
-
</bibdata>
|
1610
|
-
<annex id="A"><title>Annex</title>
|
1611
|
-
<clause id="B"><title>Subannex</title>
|
1612
|
-
<clause id="C"><title>Subsubannex</title>
|
1613
|
-
</clause>
|
1614
|
-
</clause>
|
1615
|
-
</annex>
|
1616
|
-
</iso-standard>
|
1617
|
-
INPUT
|
1618
|
-
word = <<~WORD
|
1619
|
-
<div class='WordSection3'>
|
1620
|
-
<p class='zzSTDTitle'/>
|
1621
|
-
<p class='MsoBodyText'>
|
1622
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1623
|
-
</p>
|
1624
|
-
<div class='Section3'>
|
1625
|
-
<a name='A' id='A'/>
|
1626
|
-
<p class='ANNEX'>Annex</p>
|
1627
|
-
<div>
|
1628
|
-
<a name='B' id='B'/>
|
1629
|
-
<p class='a2'>Subannex</p>
|
1630
|
-
<div>
|
1631
|
-
<a name='C' id='C'/>
|
1632
|
-
<p class='a3'>Subsubannex</p>
|
1633
|
-
</div>
|
1634
|
-
</div>
|
1635
|
-
</div>
|
1636
|
-
</div>
|
1637
|
-
WORD
|
1638
|
-
FileUtils.rm_f "test.doc"
|
1639
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
1640
|
-
expect(File.exist?("test.doc")).to be true
|
1641
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
1642
|
-
.sub(/^.*<html/m, "<html")
|
1643
|
-
.sub(/<\/html>.*$/m, "</html>")
|
1644
|
-
expect(strip_guid(xmlpp(Nokogiri::XML(output)
|
1645
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml)))
|
1646
|
-
.to be_equivalent_to xmlpp(word)
|
1647
|
-
end
|
1648
|
-
|
1649
|
-
it "deals with blockquotes" do
|
1650
|
-
input = <<~INPUT
|
1651
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1652
|
-
<bibdata>
|
1653
|
-
<status><stage>50</stage></status>
|
1654
|
-
</bibdata>
|
1655
|
-
<sections>
|
1656
|
-
<clause id="A">
|
1657
|
-
<quote>
|
1658
|
-
<p>Normal clause</p>
|
1659
|
-
<note><p>Note clause</p></note>
|
1660
|
-
<example>
|
1661
|
-
<p>Example start</p>
|
1662
|
-
<sourcecode>X</sourcecode>
|
1663
|
-
<p>Example continued</p>
|
1664
|
-
</example>
|
1665
|
-
<sourcecode>X</sourcecode>
|
1666
|
-
</quote>
|
1667
|
-
</clause>
|
1668
|
-
</sections>
|
1669
|
-
</iso-standard>
|
1670
|
-
INPUT
|
1671
|
-
word = <<~WORD
|
1672
|
-
<div class='WordSection3'>
|
1673
|
-
<p class='zzSTDTitle'/>
|
1674
|
-
<div>
|
1675
|
-
<a name='A' id='A'/>
|
1676
|
-
<h1/>
|
1677
|
-
<div>
|
1678
|
-
<p class='BodyTextindent1'>Normal clause</p>
|
1679
|
-
<div>
|
1680
|
-
<p class='Noteindent'>
|
1681
|
-
<span style='mso-tab-count:1'> </span>
|
1682
|
-
Note clause
|
1683
|
-
</p>
|
1684
|
-
</div>
|
1685
|
-
<div id=''>
|
1686
|
-
<p class='Exampleindent'>
|
1687
|
-
<span style='mso-tab-count:1'> </span>
|
1688
|
-
Example start
|
1689
|
-
</p>
|
1690
|
-
<p class='Code--' style='margin-bottom:12pt;'>X</p>
|
1691
|
-
<p class='Exampleindentcontinued'>Example continued</p>
|
1692
|
-
</div>
|
1693
|
-
<p class='Code-'>X</p>
|
1694
|
-
</div>
|
1695
|
-
</div>
|
1696
|
-
</div>
|
1697
|
-
WORD
|
1698
|
-
FileUtils.rm_f "test.doc"
|
1699
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
1700
|
-
expect(File.exist?("test.doc")).to be true
|
1701
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
1702
|
-
.sub(/^.*<html/m, "<html")
|
1703
|
-
.sub(/<\/html>.*$/m, "</html>")
|
1704
|
-
expect(strip_guid(xmlpp(Nokogiri::XML(output)
|
1705
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml)))
|
1706
|
-
.to be_equivalent_to xmlpp(word)
|
1707
|
-
end
|
1708
|
-
|
1709
|
-
it "deals with title" do
|
1710
|
-
input = <<~INPUT
|
1711
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1712
|
-
<bibdata>
|
1713
|
-
<title language="en" format="text/plain" type="title-intro">Date and time</title>
|
1714
|
-
<title language="en" format="text/plain" type="title-main">Representations for information interchange</title>
|
1715
|
-
<title language="en" format="text/plain" type="title-part">Basic rules</title>
|
1716
|
-
<status><stage>50</stage></status>
|
1717
|
-
<ext><doctype>international-standard</doctype>
|
1718
|
-
<structuredidentifier><project-number part="1" origyr="2022-03-10">8601</project-number></structuredidentifier>
|
1719
|
-
</ext>
|
1720
|
-
</bibdata>
|
1721
|
-
<sections>
|
1722
|
-
<clause id="A"><title>First clause</title>
|
1723
|
-
</clause>
|
1724
|
-
</sections>
|
1725
|
-
</iso-standard>
|
1726
|
-
INPUT
|
1727
|
-
word = <<~WORD
|
1728
|
-
<div class='WordSection3'>
|
1729
|
-
<p class='zzSTDTitle'>
|
1730
|
-
Date and time — Representations for information interchange —
|
1731
|
-
<span style='font-weight:normal'>Part 1:</span>
|
1732
|
-
Basic rules
|
1733
|
-
</p>
|
1734
|
-
<div>
|
1735
|
-
<a name='A' id='A'/>
|
1736
|
-
<h1>First clause</h1>
|
1737
|
-
</div>
|
1738
|
-
</div>
|
1739
|
-
WORD
|
1740
|
-
title = <<~WORD
|
1741
|
-
<div class='WordSection1'>
|
1742
|
-
<p class='zzCover' style='font-weight:normal;'>
|
1743
|
-
<span lang='EN-GB' xml:lang='EN-GB'>Reference number of project: </span>
|
1744
|
-
</p>
|
1745
|
-
<p class='zzCover' style='font-weight:normal;'>
|
1746
|
-
<span lang='EN-GB' xml:lang='EN-GB'>Committee identification: /</span>
|
1747
|
-
</p>
|
1748
|
-
<p class='zzCover'>
|
1749
|
-
<span lang='EN-GB' xml:lang='EN-GB'>
|
1750
|
-
<b>
|
1751
|
-
Date and time — Representations for information interchange
|
1752
|
-
— Part 1: Basic rules
|
1753
|
-
</b>
|
1754
|
-
</span>
|
1755
|
-
</p>
|
1756
|
-
<p class='zzCover' style='font-weight:normal;'>
|
1757
|
-
<i/>
|
1758
|
-
</p>
|
1759
|
-
</div>
|
1760
|
-
WORD
|
1761
|
-
FileUtils.rm_f "test.doc"
|
1762
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
1763
|
-
expect(File.exist?("test.doc")).to be true
|
1764
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
1765
|
-
.sub(/^.*<html/m, "<html")
|
1766
|
-
.sub(/<\/html>.*$/m, "</html>")
|
1767
|
-
expect(strip_guid(xmlpp(Nokogiri::XML(output)
|
1768
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml)))
|
1769
|
-
.to be_equivalent_to xmlpp(word)
|
1770
|
-
expect(strip_guid(xmlpp(Nokogiri::XML(output)
|
1771
|
-
.at("//xmlns:div[@class = 'WordSection1']").to_xml)))
|
1772
|
-
.to be_equivalent_to xmlpp(title)
|
1773
|
-
end
|
1774
|
-
|
1775
|
-
it "deals with amendments" do
|
1776
|
-
input = <<~INPUT
|
1777
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1778
|
-
<bibdata>
|
1779
|
-
<title language="en" format="text/plain" type="title-intro">Date and time</title>
|
1780
|
-
<title language="en" format="text/plain" type="title-main">Representations for information interchange</title>
|
1781
|
-
<title language="en" format="text/plain" type="title-part">Basic rules</title>
|
1782
|
-
<title language="en" format="text/plain" type="title-amd">Technical corrections</title>
|
1783
|
-
<status><stage>50</stage></status>
|
1784
|
-
<ext><doctype>amendment</doctype>
|
1785
|
-
<structuredidentifier><project-number part="1" amendment="1" origyr="2022-03-10">8601</project-number>
|
1786
|
-
</structuredidentifier>
|
1787
|
-
</ext>
|
1788
|
-
</bibdata>
|
1789
|
-
<preface>
|
1790
|
-
<foreword id="F"><title>Foreword</title></foreword>
|
1791
|
-
</preface>
|
1792
|
-
<sections>
|
1793
|
-
<clause id="A"><title>First clause</title>
|
1794
|
-
</clause>
|
1795
|
-
</sections>
|
1796
|
-
</iso-standard>
|
1797
|
-
INPUT
|
1798
|
-
word = <<~WORD
|
1799
|
-
<div class='WordSection3'>
|
1800
|
-
<p class='zzSTDTitle'>
|
1801
|
-
Date and time — Representations for information interchange —
|
1802
|
-
<span style='font-weight:normal'>Part 1:</span>
|
1803
|
-
Basic rules
|
1804
|
-
<span style='font-weight:normal'> AMENDMENT 1: Technical corrections</span>
|
1805
|
-
</p>
|
1806
|
-
<div>
|
1807
|
-
<a name='A' id='A'/>
|
1808
|
-
<p style='font-style:italic;page-break-after:avoid;' class='MsoBodyText'>First clause</p>
|
1809
|
-
</div>
|
1810
|
-
</div>
|
1811
|
-
WORD
|
1812
|
-
FileUtils.rm_f "test.doc"
|
1813
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
1814
|
-
expect(File.exist?("test.doc")).to be true
|
1815
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
1816
|
-
.sub(/^.*<html/m, "<html")
|
1817
|
-
.sub(/<\/html>.*$/m, "</html>")
|
1818
|
-
expect(strip_guid(xmlpp(Nokogiri::XML(output)
|
1819
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml)))
|
1820
|
-
.to be_equivalent_to xmlpp(word)
|
1821
|
-
end
|
1822
|
-
|
1823
|
-
it "deals with copyright boilerplate" do
|
1824
|
-
presxml = <<~OUTPUT
|
1825
|
-
<iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
|
1826
|
-
<bibdata type="standard">
|
1827
|
-
<status>
|
1828
|
-
<stage language="">50</stage>
|
1829
|
-
</status>
|
1830
|
-
</bibdata>
|
1831
|
-
<boilerplate>
|
1832
|
-
<copyright-statement>
|
1833
|
-
<clause><title>COPYRIGHT PROTECTED DOCUMENT</title>
|
1834
|
-
<p id="boilerplate-year">© ISO 2019, Published in Switzerland
|
1835
|
-
</p>
|
1836
|
-
<p id="boilerplate-message">I am the Walrus.
|
1837
|
-
</p>
|
1838
|
-
<p id="boilerplate-name">ISO copyright office</p>
|
1839
|
-
<p align="left" id="boilerplate-address">ISO copyright office
|
1840
|
-
<br/>
|
1841
|
-
Ch. de Blandonnet 8 ?~@? CP 401
|
1842
|
-
<br/>
|
1843
|
-
CH-1214 Vernier, Geneva, Switzerland
|
1844
|
-
<br/>
|
1845
|
-
Phone: +41 22 749 01 11
|
1846
|
-
<br/>
|
1847
|
-
Email: copyright@iso.org
|
1848
|
-
<br/>
|
1849
|
-
www.iso.org</p>
|
1850
|
-
</clause>
|
1851
|
-
</copyright-statement>
|
1852
|
-
<license-statement>
|
1853
|
-
<clause>
|
1854
|
-
<title depth="1">Warning for Stuff</title>
|
1855
|
-
<p>This document is not an ISO International Standard. It is distributed for review and
|
1856
|
-
comment. It is subject to change without notice and may not be referred to as
|
1857
|
-
an International Standard.</p>
|
1858
|
-
<p>Recipients
|
1859
|
-
of this draft are invited to submit, with their comments, notification of any
|
1860
|
-
relevant patent rights of which they are aware and to provide supporting
|
1861
|
-
documentation.</p>
|
1862
|
-
</clause>
|
1863
|
-
</license-statement>
|
1864
|
-
</boilerplate>
|
1865
|
-
</iso-standard>
|
1866
|
-
OUTPUT
|
1867
|
-
|
1868
|
-
FileUtils.rm_f "test.doc"
|
1869
|
-
IsoDoc::Iso::WordConvert.new(wordstylesheet: "spec/assets/word.css")
|
1870
|
-
.convert("test", presxml, false)
|
1871
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
1872
|
-
expect(xmlpp(word
|
1873
|
-
.sub(%r{^.*<div class="boilerplate-copyright">}m,
|
1874
|
-
'<div class="boilerplate-copyright">')
|
1875
|
-
.sub(%r{</div>.*$}m, "</div></div>")))
|
1876
|
-
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1877
|
-
<div class='boilerplate-copyright'>
|
1878
|
-
<div>
|
1879
|
-
<p class='zzCopyright'>
|
1880
|
-
<a name='boilerplate-year' id='boilerplate-year'/>
|
1881
|
-
© ISO 2019, Published in Switzerland
|
1882
|
-
</p>
|
1883
|
-
<p class='zzCopyright'>
|
1884
|
-
<a name='boilerplate-message' id='boilerplate-message'/>
|
1885
|
-
I am the Walrus.
|
1886
|
-
</p>
|
1887
|
-
<p class='zzCopyright'>
|
1888
|
-
<a name='boilerplate-name' id='boilerplate-name'/>
|
1889
|
-
ISO copyright office
|
1890
|
-
</p>
|
1891
|
-
<p style='text-align:left;' align='left' class='zzCopyright'>
|
1892
|
-
<a name='boilerplate-address' id='boilerplate-address'/>
|
1893
|
-
ISO copyright office
|
1894
|
-
</p>
|
1895
|
-
<p class='zzCopyright'> Ch. de Blandonnet 8 ?~@? CP 401 </p>
|
1896
|
-
<p class='zzCopyright'> CH-1214 Vernier, Geneva, Switzerland </p>
|
1897
|
-
<p class='zzCopyright'> Phone: +41 22 749 01 11 </p>
|
1898
|
-
<p class='zzCopyright'> Email: copyright@iso.org </p>
|
1899
|
-
<p class='zzCopyright'> www.iso.org</p>
|
1900
|
-
</div>
|
1901
|
-
</div>
|
1902
|
-
OUTPUT
|
1903
|
-
|
1904
|
-
FileUtils.rm_f "test.doc"
|
1905
|
-
IsoDoc::Iso::WordConvert.new(wordstylesheet: "spec/assets/word.css")
|
1906
|
-
.convert("test",
|
1907
|
-
presxml.sub(%r{<stage language="">50</stage>},
|
1908
|
-
"<stage>60</stage><substage>00</substage>"), false)
|
1909
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
1910
|
-
expect(xmlpp(word
|
1911
|
-
.sub(%r{^.*<div class="boilerplate-copyright">}m,
|
1912
|
-
'<div class="boilerplate-copyright">')
|
1913
|
-
.sub(%r{</div>.*$}m, "</div></div>")))
|
1914
|
-
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1915
|
-
<div class='boilerplate-copyright'>
|
1916
|
-
<div>
|
1917
|
-
<p class='zzCopyright'>
|
1918
|
-
<a name='boilerplate-year' id='boilerplate-year'/>
|
1919
|
-
© ISO 2019, Published in Switzerland
|
1920
|
-
</p>
|
1921
|
-
<p class='zzCopyright'>
|
1922
|
-
<a name='boilerplate-message' id='boilerplate-message'/>
|
1923
|
-
I am the Walrus.
|
1924
|
-
</p>
|
1925
|
-
<p class='zzCopyright'>
|
1926
|
-
<a name='boilerplate-name' id='boilerplate-name'/>
|
1927
|
-
ISO copyright office
|
1928
|
-
</p>
|
1929
|
-
<p style='text-indent:20.15pt;' align='left' class='zzCopyright'>
|
1930
|
-
<a name='boilerplate-address' id='boilerplate-address'/>
|
1931
|
-
ISO copyright office
|
1932
|
-
</p>
|
1933
|
-
<p class='zzCopyright' style='text-indent:20.15pt;'> Ch. de Blandonnet 8 ?~@? CP 401 </p>
|
1934
|
-
<p class='zzCopyright' style='text-indent:20.15pt;'> CH-1214 Vernier, Geneva, Switzerland </p>
|
1935
|
-
<p class='zzCopyright' style='text-indent:20.15pt;'> Phone: +41 22 749 01 11 </p>
|
1936
|
-
<p class='zzCopyright' style='text-indent:20.15pt;'> Email: copyright@iso.org </p>
|
1937
|
-
<p class='zzCopyright' style='text-indent:20.15pt;'> www.iso.org</p>
|
1938
|
-
</div>
|
1939
|
-
</div>
|
1940
|
-
OUTPUT
|
1941
|
-
end
|
1942
|
-
|
1943
|
-
it "deals with Simple Template styles" do
|
1944
|
-
input = <<~INPUT
|
1945
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1946
|
-
<bibdata>
|
1947
|
-
<status><stage>20</stage></status>
|
1948
|
-
</bibdata>
|
1949
|
-
<sections>
|
1950
|
-
<clause id="A"><title>Clause Title</title>
|
1951
|
-
<ul><li>List</li></ul>
|
1952
|
-
<note id="B"><p>Note</p>
|
1953
|
-
<ul><li>Note List</li></ul>
|
1954
|
-
</note>
|
1955
|
-
<example id="C"><p>Example</p>
|
1956
|
-
<ul><li>Example List</li></ul>
|
1957
|
-
</example>
|
1958
|
-
<figure id="D"><name>Figure Title</name></figure>
|
1959
|
-
<sourcecode id="E">XYZ</sourcecode>
|
1960
|
-
<table id="F"><name>Table</name></table>
|
1961
|
-
</clause>
|
1962
|
-
</sections>
|
1963
|
-
<annex id="G"><title>Annex Title</title>
|
1964
|
-
<table id="H"><name>Annex Table</name></table>
|
1965
|
-
<clause id="I"><title>Annex Clause Title</title>
|
1966
|
-
</clause>
|
1967
|
-
</annex>
|
1968
|
-
<bibliography>
|
1969
|
-
<references id="_normative_references" normative="false" obligation="informative">
|
1970
|
-
<title>Bibliography</title>
|
1971
|
-
<bibitem id="ISO712" type="standard">
|
1972
|
-
<formattedref>ALUFFI, Paolo, ed. (2022). <em><span class="std_class">Facets of Algebraic Geometry: A Collection in Honor of William Fulton's 80th Birthday</span></em>, 1st edition. Cambridge, UK: CUP.</formattedref>
|
1973
|
-
<docidentifier type="ISO">ISO/IEC 712-3:2022</docidentifier>
|
1974
|
-
</bibitem>
|
1975
|
-
</references>
|
1976
|
-
</bibliography>
|
1977
|
-
</iso-standard>
|
1978
|
-
INPUT
|
1979
|
-
word = <<~WORD
|
1980
|
-
<div class='WordSection3'>
|
1981
|
-
<p class='zzSTDTitle1'/>
|
1982
|
-
<div>
|
1983
|
-
<a name='A' id='A'/>
|
1984
|
-
<h1>Clause Title</h1>
|
1985
|
-
<p style='mso-list:l3 level1 lfo1;' class='MsoListParagraphCxSpFirst'>List</p>
|
1986
|
-
<div class='Note'>
|
1987
|
-
<a name='B' id='B'/>
|
1988
|
-
<p class='Note'>
|
1989
|
-
<span class='note_label'/>
|
1990
|
-
<span style='mso-tab-count:1'> </span>
|
1991
|
-
Note
|
1992
|
-
</p>
|
1993
|
-
<p style='font-size:10.0pt;;mso-list:l3 level1 lfo2;' class='MsoListParagraphCxSpFirst'>Note List</p>
|
1994
|
-
</div>
|
1995
|
-
<div class='Example'>
|
1996
|
-
<a name='C' id='C'/>
|
1997
|
-
<p class='Example'>
|
1998
|
-
<span style='mso-tab-count:1'> </span>
|
1999
|
-
Example
|
2000
|
-
</p>
|
2001
|
-
<p style='font-size:10.0pt;;mso-list:l3 level1 lfo3;' class='MsoListParagraphCxSpFirst'>Example List</p>
|
2002
|
-
</div>
|
2003
|
-
<div class='MsoNormal' style='text-align:center;'>
|
2004
|
-
<a name='D' id='D'/>
|
2005
|
-
<p class='FigureTitle' style='text-align:center;'>Figure Title</p>
|
2006
|
-
</div>
|
2007
|
-
<p class='Code'>
|
2008
|
-
<a name='E' id='E'/>
|
2009
|
-
XYZ
|
2010
|
-
</p>
|
2011
|
-
<p class='Tabletitle' style='text-align:center;'>Table</p>
|
2012
|
-
<div align='center' class='table_container'>
|
2013
|
-
<table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
2014
|
-
<a name='F' id='F'/>
|
2015
|
-
</table>
|
2016
|
-
</div>
|
2017
|
-
</div>
|
2018
|
-
<p class='MsoNormal'>
|
2019
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
2020
|
-
</p>
|
2021
|
-
<div class='Section3'>
|
2022
|
-
<a name='G' id='G'/>
|
2023
|
-
<p class='ANNEX'>Annex Title</p>
|
2024
|
-
<p class='AnnexTableTitle' style='text-align:center;'>Annex Table</p>
|
2025
|
-
<div align='center' class='table_container'>
|
2026
|
-
<table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
2027
|
-
<a name='H' id='H'/>
|
2028
|
-
</table>
|
2029
|
-
</div>
|
2030
|
-
<div>
|
2031
|
-
<a name='I' id='I'/>
|
2032
|
-
<p class='a2'>Annex Clause Title</p>
|
2033
|
-
</div>
|
2034
|
-
</div>
|
2035
|
-
<p class='MsoNormal'>
|
2036
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
2037
|
-
</p>
|
2038
|
-
<div>
|
2039
|
-
<p class='BiblioTitle'>Bibliography</p>
|
2040
|
-
<p class='MsoNormal'>
|
2041
|
-
<a name='ISO712' id='ISO712'/>
|
2042
|
-
[1]
|
2043
|
-
<span style='mso-tab-count:1'> </span>
|
2044
|
-
ISO/IEC 712-3:2022, ALUFFI, Paolo, ed. (2022).
|
2045
|
-
<i>
|
2046
|
-
Facets of Algebraic Geometry: A Collection in Honor of William Fulton's
|
2047
|
-
80th Birthday
|
2048
|
-
</i>
|
2049
|
-
, 1st edition. Cambridge, UK: CUP.
|
2050
|
-
</p>
|
2051
|
-
</div>
|
2052
|
-
</div>
|
2053
|
-
WORD
|
2054
|
-
FileUtils.rm_f "test.doc"
|
2055
|
-
IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
|
2056
|
-
expect(File.exist?("test.doc")).to be true
|
2057
|
-
output = File.read("test.doc", encoding: "UTF-8")
|
2058
|
-
.sub(/^.*<html/m, "<html")
|
2059
|
-
.sub(/<\/html>.*$/m, "</html>")
|
2060
|
-
expect(strip_guid(xmlpp(Nokogiri::XML(output)
|
2061
|
-
.at("//xmlns:div[@class = 'WordSection3']").to_xml)))
|
2062
|
-
.to be_equivalent_to xmlpp(word)
|
2063
|
-
end
|
2064
|
-
end
|