isodoc 1.0.29 → 1.1.3.pre.alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +6 -12
- data/.github/workflows/ubuntu.yml +18 -20
- data/.github/workflows/windows.yml +6 -12
- data/Rakefile +3 -1
- data/isodoc.gemspec +2 -2
- data/lib/isodoc.rb +2 -0
- data/lib/isodoc/base_style/all.css +207 -0
- data/lib/isodoc/base_style/blocks.css +0 -0
- data/lib/isodoc/base_style/coverpage.css +0 -0
- data/lib/isodoc/base_style/defaults.css +0 -0
- data/lib/isodoc/base_style/metanorma_word.css +34 -0
- data/lib/isodoc/base_style/metanorma_word.scss +0 -1
- data/lib/isodoc/base_style/nav.css +0 -0
- data/lib/isodoc/base_style/reset.css +105 -0
- data/lib/isodoc/base_style/reset.scss +3 -3
- data/lib/isodoc/base_style/typography.css +0 -0
- data/lib/isodoc/common.rb +0 -4
- data/lib/isodoc/convert.rb +121 -58
- data/lib/isodoc/function/blocks.rb +3 -3
- data/lib/isodoc/function/blocks_example_note.rb +2 -2
- data/lib/isodoc/function/inline.rb +5 -5
- data/lib/isodoc/function/references.rb +29 -34
- data/lib/isodoc/function/reqt.rb +1 -1
- data/lib/isodoc/function/section.rb +7 -11
- data/lib/isodoc/function/table.rb +1 -1
- data/lib/isodoc/function/terms.rb +2 -2
- data/lib/isodoc/function/to_word_html.rb +2 -2
- data/lib/isodoc/function/utils.rb +57 -51
- data/lib/isodoc/gem_tasks.rb +117 -0
- data/lib/isodoc/headlesshtml_convert.rb +7 -6
- data/lib/isodoc/html_convert.rb +2 -1
- data/lib/isodoc/html_function/html.rb +1 -1
- data/lib/isodoc/html_function/postprocess.rb +1 -1
- data/lib/isodoc/metadata.rb +69 -63
- data/lib/isodoc/pdf_convert.rb +8 -6
- data/lib/isodoc/presentation_xml_convert.rb +29 -0
- data/lib/isodoc/sassc_importer.rb +11 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_convert.rb +2 -1
- data/lib/isodoc/word_function/body.rb +1 -1
- data/lib/isodoc/word_function/postprocess.rb +1 -0
- data/lib/isodoc/xref.rb +59 -0
- data/lib/isodoc/{function → xref}/xref_anchor.rb +10 -21
- data/lib/isodoc/xref/xref_counter.rb +74 -0
- data/lib/isodoc/{function → xref}/xref_gen.rb +9 -22
- data/lib/isodoc/{function → xref}/xref_gen_seq.rb +34 -26
- data/lib/isodoc/{function → xref}/xref_sect_gen.rb +33 -23
- data/lib/isodoc/xslfo_convert.rb +16 -4
- data/spec/assets/{html.css → html.scss} +0 -0
- data/spec/isodoc/footnotes_spec.rb +2 -2
- data/spec/isodoc/postproc_spec.rb +1319 -1345
- data/spec/isodoc/presentation_xml_spec.rb +20 -0
- data/spec/isodoc/ref_spec.rb +1 -1
- data/spec/isodoc/section_spec.rb +52 -0
- metadata +40 -28
- data/lib/isodoc/function/xref_counter.rb +0 -84
data/lib/isodoc/xslfo_convert.rb
CHANGED
@@ -15,14 +15,26 @@ module IsoDoc
|
|
15
15
|
|
16
16
|
def initialize(options)
|
17
17
|
@format = :pdf
|
18
|
+
@suffix = "pdf"
|
18
19
|
super
|
19
20
|
end
|
20
21
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
22
|
+
def pdf_stylesheet(docxml)
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
|
26
|
+
def convert(input_filename, file = nil, debug = false, output_filename = nil)
|
27
|
+
file = File.read(input_filename, encoding: "utf-8") if file.nil?
|
28
|
+
docxml, filename, dir = convert_init(file, input_filename, debug)
|
29
|
+
/\.xml$/.match(input_filename) or
|
30
|
+
input_filename = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f|
|
31
|
+
f.write file
|
32
|
+
f.path
|
33
|
+
end
|
24
34
|
FileUtils.rm_rf dir
|
25
|
-
::Metanorma::Output::XslfoPdf.new.convert(
|
35
|
+
::Metanorma::Output::XslfoPdf.new.convert(input_filename,
|
36
|
+
output_filename || "#{filename}.#{@suffix}",
|
37
|
+
File.join(@libdir, pdf_stylesheet(docxml)))
|
26
38
|
end
|
27
39
|
|
28
40
|
def xref_parse(node, out)
|
File without changes
|
@@ -138,7 +138,7 @@ RSpec.describe IsoDoc do
|
|
138
138
|
|
139
139
|
it "processes IsoXML reviewer notes (HTML)" do
|
140
140
|
FileUtils.rm_f "test.html"
|
141
|
-
IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.
|
141
|
+
IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss"}).convert("test", <<~"INPUT", false)
|
142
142
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
143
143
|
<preface>
|
144
144
|
<foreword>
|
@@ -192,7 +192,7 @@ RSpec.describe IsoDoc do
|
|
192
192
|
|
193
193
|
it "processes IsoXML reviewer notes (Word)" do
|
194
194
|
FileUtils.rm_f "test.doc"
|
195
|
-
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.
|
195
|
+
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss"}).convert("test", <<~"INPUT", false)
|
196
196
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
197
197
|
<preface>
|
198
198
|
<foreword>
|
@@ -1,122 +1,124 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'fileutils'
|
3
5
|
|
4
6
|
RSpec.describe IsoDoc do
|
5
|
-
it
|
6
|
-
FileUtils.rm_f
|
7
|
-
FileUtils.rm_f
|
8
|
-
IsoDoc::HtmlConvert.new(
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
</note>
|
17
|
-
|
18
|
-
|
7
|
+
it 'generates file based on string input' do
|
8
|
+
FileUtils.rm_f 'test.doc'
|
9
|
+
FileUtils.rm_f 'test.html'
|
10
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', filename: 'test').convert('test', <<~"INPUT", false)
|
11
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
12
|
+
<bibdata>
|
13
|
+
<title language="en">test</title>
|
14
|
+
</bibdata>
|
15
|
+
<preface><foreword>
|
16
|
+
<note>
|
17
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
18
|
+
</note>
|
19
|
+
</foreword></preface>
|
20
|
+
</iso-standard>
|
19
21
|
INPUT
|
20
|
-
expect(File.exist?(
|
21
|
-
html = File.read(
|
22
|
+
expect(File.exist?('test.html')).to be true
|
23
|
+
html = File.read('test.html')
|
22
24
|
expect(html).to match(%r{<title>test</title>})
|
23
25
|
expect(html).to match(/another empty stylesheet/)
|
24
26
|
expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
|
25
27
|
expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
|
26
28
|
end
|
27
29
|
|
28
|
-
it
|
29
|
-
FileUtils.rm_f
|
30
|
-
FileUtils.rm_f
|
31
|
-
IsoDoc::HtmlConvert.new(
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
</note>
|
40
|
-
|
41
|
-
|
30
|
+
it 'ignores Liquid markup in the document body' do
|
31
|
+
FileUtils.rm_f 'test.doc'
|
32
|
+
FileUtils.rm_f 'test.html'
|
33
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css').convert('test', <<~"INPUT", false)
|
34
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
35
|
+
<bibdata>
|
36
|
+
<title language="en">test</title>
|
37
|
+
</bibdata>
|
38
|
+
<preface><foreword>
|
39
|
+
<note>
|
40
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">{% elif %}These results are based on a study carried out on three different types of kernel.</p>
|
41
|
+
</note>
|
42
|
+
</foreword></preface>
|
43
|
+
</iso-standard>
|
42
44
|
INPUT
|
43
|
-
expect(File.exist?(
|
44
|
-
html = File.read(
|
45
|
+
expect(File.exist?('test.html')).to be true
|
46
|
+
html = File.read('test.html')
|
45
47
|
end
|
46
48
|
|
47
|
-
|
48
|
-
FileUtils.rm_f
|
49
|
-
FileUtils.rm_f
|
50
|
-
IsoDoc::WordConvert.new(
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
</note>
|
59
|
-
|
60
|
-
|
49
|
+
it 'ignores Liquid markup in the document body (Word)' do
|
50
|
+
FileUtils.rm_f 'test.doc'
|
51
|
+
FileUtils.rm_f 'test.html'
|
52
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css').convert('test', <<~"INPUT", false)
|
53
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
54
|
+
<bibdata>
|
55
|
+
<title language="en">test</title>
|
56
|
+
</bibdata>
|
57
|
+
<preface><foreword>
|
58
|
+
<note>
|
59
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">{% elif %}These results are based on a study carried out on three different types of kernel.</p>
|
60
|
+
</note>
|
61
|
+
</foreword></preface>
|
62
|
+
</iso-standard>
|
61
63
|
INPUT
|
62
|
-
expect(File.exist?(
|
63
|
-
html = File.read(
|
64
|
+
expect(File.exist?('test.doc')).to be true
|
65
|
+
html = File.read('test.doc')
|
64
66
|
end
|
65
67
|
|
66
|
-
it
|
67
|
-
FileUtils.rm_f
|
68
|
-
FileUtils.rm_f
|
69
|
-
IsoDoc::HtmlConvert.new(
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
</note>
|
75
|
-
|
76
|
-
|
68
|
+
it 'generates HTML output docs with null configuration' do
|
69
|
+
FileUtils.rm_f 'test.doc'
|
70
|
+
FileUtils.rm_f 'test.html'
|
71
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css').convert('test', <<~"INPUT", false)
|
72
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
73
|
+
<preface><foreword>
|
74
|
+
<note>
|
75
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
76
|
+
</note>
|
77
|
+
</foreword></preface>
|
78
|
+
</iso-standard>
|
77
79
|
INPUT
|
78
|
-
expect(File.exist?(
|
79
|
-
html = File.read(
|
80
|
+
expect(File.exist?('test.html')).to be true
|
81
|
+
html = File.read('test.html')
|
80
82
|
expect(html).not_to match(%r{<title>test</title>})
|
81
83
|
expect(html).not_to match(/another empty stylesheet/)
|
82
84
|
expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
|
83
85
|
expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
|
84
86
|
end
|
85
87
|
|
86
|
-
it
|
87
|
-
FileUtils.rm_f
|
88
|
-
FileUtils.rm_f
|
89
|
-
IsoDoc::WordConvert.new(
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
</note>
|
95
|
-
|
96
|
-
|
88
|
+
it 'generates Word output docs with null configuration' do
|
89
|
+
FileUtils.rm_f 'test.doc'
|
90
|
+
FileUtils.rm_f 'test.html'
|
91
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
92
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
93
|
+
<preface><foreword>
|
94
|
+
<note>
|
95
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
96
|
+
</note>
|
97
|
+
</foreword></preface>
|
98
|
+
</iso-standard>
|
97
99
|
INPUT
|
98
|
-
expect(File.exist?(
|
99
|
-
word = File.read(
|
100
|
+
expect(File.exist?('test.doc')).to be true
|
101
|
+
word = File.read('test.doc')
|
100
102
|
expect(word).to match(/one empty stylesheet/)
|
101
103
|
expect(word).to match(/div\.table_container/)
|
102
104
|
end
|
103
105
|
|
104
|
-
it
|
105
|
-
FileUtils.rm_f
|
106
|
-
FileUtils.rm_f
|
107
|
-
IsoDoc::HtmlConvert.new(
|
108
|
-
expect(File.exist?(
|
109
|
-
html = File.read(
|
106
|
+
it 'generates HTML output docs with null configuration from file' do
|
107
|
+
FileUtils.rm_f 'spec/assets/iso.doc'
|
108
|
+
FileUtils.rm_f 'spec/assets/iso.html'
|
109
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('spec/assets/iso.xml', nil, false)
|
110
|
+
expect(File.exist?('spec/assets/iso.html')).to be true
|
111
|
+
html = File.read('spec/assets/iso.html')
|
110
112
|
expect(html).to match(/another empty stylesheet/)
|
111
113
|
expect(html).to match(%r{https://use.fontawesome.com})
|
112
114
|
expect(html).to match(%r{libs/jquery})
|
113
115
|
end
|
114
116
|
|
115
|
-
it
|
116
|
-
FileUtils.rm_f
|
117
|
-
IsoDoc::HeadlessHtmlConvert.new(
|
118
|
-
expect(File.exist?(
|
119
|
-
html = File.read(
|
117
|
+
it 'generates Headless HTML output docs with null configuration from file' do
|
118
|
+
FileUtils.rm_f 'spec/assets/iso.html'
|
119
|
+
IsoDoc::HeadlessHtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('spec/assets/iso.xml', nil, false)
|
120
|
+
expect(File.exist?('spec/assets/iso.headless.html')).to be true
|
121
|
+
html = File.read('spec/assets/iso.headless.html')
|
120
122
|
expect(html).not_to match(/another empty stylesheet/)
|
121
123
|
expect(html).not_to match(%r{https://use.fontawesome.com})
|
122
124
|
expect(html).not_to match(%r{libs/jquery})
|
@@ -126,27 +128,27 @@ expect(File.exist?("test.doc")).to be true
|
|
126
128
|
expect(html).to match(%r{<div})
|
127
129
|
end
|
128
130
|
|
129
|
-
it
|
130
|
-
FileUtils.rm_f
|
131
|
-
IsoDoc::WordConvert.new(
|
132
|
-
expect(File.exist?(
|
133
|
-
word = File.read(
|
131
|
+
it 'generates Word output docs with null configuration from file' do
|
132
|
+
FileUtils.rm_f 'spec/assets/iso.doc'
|
133
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('spec/assets/iso.xml', nil, false)
|
134
|
+
expect(File.exist?('spec/assets/iso.doc')).to be true
|
135
|
+
word = File.read('spec/assets/iso.doc')
|
134
136
|
expect(word).to match(/one empty stylesheet/)
|
135
137
|
end
|
136
138
|
|
137
|
-
it
|
138
|
-
FileUtils.rm_f
|
139
|
-
FileUtils.rm_f
|
140
|
-
IsoDoc::HtmlConvert.new(
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
</note>
|
146
|
-
|
147
|
-
|
139
|
+
it 'generates HTML output docs with complete configuration' do
|
140
|
+
FileUtils.rm_f 'test.doc'
|
141
|
+
FileUtils.rm_f 'test.html'
|
142
|
+
IsoDoc::HtmlConvert.new(bodyfont: 'Zapf', htmlstylesheet: 'spec/assets/html.scss', htmlcoverpage: 'spec/assets/htmlcover.html', htmlintropage: 'spec/assets/htmlintro.html', scripts: 'spec/assets/scripts.html', i18nyaml: 'spec/assets/i18n.yaml', ulstyle: 'l1', olstyle: 'l2').convert('test', <<~"INPUT", false)
|
143
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
144
|
+
<preface><foreword>
|
145
|
+
<note>
|
146
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
147
|
+
</note>
|
148
|
+
</foreword></preface>
|
149
|
+
</iso-standard>
|
148
150
|
INPUT
|
149
|
-
html = File.read(
|
151
|
+
html = File.read('test.html')
|
150
152
|
expect(html).to match(/another empty stylesheet/)
|
151
153
|
expect(html).to match(/font-family: Zapf/)
|
152
154
|
expect(html).to match(/an empty html cover page/)
|
@@ -156,19 +158,19 @@ expect(File.exist?("test.doc")).to be true
|
|
156
158
|
expect(html).to match(%r{Enkonduko</h1>})
|
157
159
|
end
|
158
160
|
|
159
|
-
it
|
160
|
-
FileUtils.rm_f
|
161
|
-
FileUtils.rm_f
|
162
|
-
IsoDoc::HtmlConvert.new(
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
</note>
|
168
|
-
|
169
|
-
|
161
|
+
it 'generates HTML output docs with default fonts' do
|
162
|
+
FileUtils.rm_f 'test.doc'
|
163
|
+
FileUtils.rm_f 'test.html'
|
164
|
+
IsoDoc::HtmlConvert.new(htmlstylesheet: 'spec/assets/html.scss', htmlcoverpage: 'spec/assets/htmlcover.html', htmlintropage: 'spec/assets/htmlintro.html', scripts: 'spec/assets/scripts.html', i18nyaml: 'spec/assets/i18n.yaml', ulstyle: 'l1', olstyle: 'l2').convert('test', <<~"INPUT", false)
|
165
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
166
|
+
<preface><foreword>
|
167
|
+
<note>
|
168
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
169
|
+
</note>
|
170
|
+
</foreword></preface>
|
171
|
+
</iso-standard>
|
170
172
|
INPUT
|
171
|
-
html = File.read(
|
173
|
+
html = File.read('test.html')
|
172
174
|
expect(html).to match(/another empty stylesheet/)
|
173
175
|
expect(html).to match(/font-family: Arial/)
|
174
176
|
expect(html).to match(/an empty html cover page/)
|
@@ -178,1407 +180,1379 @@ expect(File.exist?("test.doc")).to be true
|
|
178
180
|
expect(html).to match(%r{Enkonduko</h1>})
|
179
181
|
end
|
180
182
|
|
181
|
-
it
|
182
|
-
FileUtils.rm_f
|
183
|
-
FileUtils.rm_f
|
184
|
-
IsoDoc::WordConvert.new(
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
</note>
|
190
|
-
|
191
|
-
|
183
|
+
it 'generates Word output docs with complete configuration' do
|
184
|
+
FileUtils.rm_f 'test.doc'
|
185
|
+
FileUtils.rm_f 'test.html'
|
186
|
+
IsoDoc::WordConvert.new(bodyfont: 'Zapf', wordstylesheet: 'spec/assets/html.scss', standardstylesheet: 'spec/assets/std.css', header: 'spec/assets/header.html', wordcoverpage: 'spec/assets/wordcover.html', wordintropage: 'spec/assets/wordintro.html', i18nyaml: 'spec/assets/i18n.yaml', ulstyle: 'l1', olstyle: 'l2').convert('test', <<~"INPUT", false)
|
187
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
188
|
+
<preface><foreword>
|
189
|
+
<note>
|
190
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
191
|
+
</note>
|
192
|
+
</foreword></preface>
|
193
|
+
</iso-standard>
|
192
194
|
INPUT
|
193
|
-
word = File.read(
|
195
|
+
word = File.read('test.doc')
|
194
196
|
expect(word).to match(/another empty stylesheet/)
|
195
197
|
expect(word).to match(/font-family: Zapf/)
|
196
198
|
expect(word).to match(/a third empty stylesheet/)
|
197
|
-
#expect(word).to match(/<title>test<\/title>/)
|
199
|
+
# expect(word).to match(/<title>test<\/title>/)
|
198
200
|
expect(word).to match(/test_files\/header.html/)
|
199
201
|
expect(word).to match(/an empty word cover page/)
|
200
202
|
expect(word).to match(/an empty word intro page/)
|
201
203
|
expect(word).to match(%r{Enkonduko</h1>})
|
202
204
|
end
|
203
205
|
|
204
|
-
it
|
205
|
-
FileUtils.rm_f
|
206
|
-
FileUtils.rm_f
|
207
|
-
IsoDoc::WordConvert.new(
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
</note>
|
213
|
-
|
214
|
-
|
206
|
+
it 'generates Word output docs with default fonts' do
|
207
|
+
FileUtils.rm_f 'test.doc'
|
208
|
+
FileUtils.rm_f 'test.html'
|
209
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/html.scss', standardstylesheet: 'spec/assets/std.css', header: 'spec/assets/header.html', wordcoverpage: 'spec/assets/wordcover.html', wordintropage: 'spec/assets/wordintro.html', i18nyaml: 'spec/assets/i18n.yaml', ulstyle: 'l1', olstyle: 'l2').convert('test', <<~"INPUT", false)
|
210
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
211
|
+
<preface><foreword>
|
212
|
+
<note>
|
213
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
214
|
+
</note>
|
215
|
+
</foreword></preface>
|
216
|
+
</iso-standard>
|
215
217
|
INPUT
|
216
|
-
word = File.read(
|
218
|
+
word = File.read('test.doc')
|
217
219
|
expect(word).to match(/another empty stylesheet/)
|
218
220
|
expect(word).to match(/font-family: Arial/)
|
219
221
|
expect(word).to match(/a third empty stylesheet/)
|
220
|
-
#expect(word).to match(/<title>test<\/title>/)
|
222
|
+
# expect(word).to match(/<title>test<\/title>/)
|
221
223
|
expect(word).to match(/test_files\/header.html/)
|
222
224
|
expect(word).to match(/an empty word cover page/)
|
223
225
|
expect(word).to match(/an empty word intro page/)
|
224
226
|
expect(word).to match(%r{Enkonduko</h1>})
|
225
227
|
end
|
226
228
|
|
227
|
-
it
|
228
|
-
FileUtils.rm_f
|
229
|
-
FileUtils.rm_f
|
230
|
-
IsoDoc::WordConvert.new(
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
229
|
+
it 'converts definition lists to tables for Word' do
|
230
|
+
FileUtils.rm_f 'test.doc'
|
231
|
+
FileUtils.rm_f 'test.html'
|
232
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
233
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
234
|
+
<preface><foreword>
|
235
|
+
<dl>
|
236
|
+
<dt>Term</dt>
|
237
|
+
<dd>Definition</dd>
|
238
|
+
<dt>Term 2</dt>
|
239
|
+
<dd>Definition 2</dd>
|
240
|
+
</dl>
|
241
|
+
</foreword></preface>
|
242
|
+
</iso-standard>
|
241
243
|
INPUT
|
242
|
-
word = File.read(
|
243
|
-
|
244
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
|
245
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
244
246
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
</div>
|
264
|
-
<p class="MsoNormal"> </p>
|
247
|
+
<div class="WordSection2">
|
248
|
+
<p class="MsoNormal"><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
|
249
|
+
<div>
|
250
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
251
|
+
<table class="dl">
|
252
|
+
<tr>
|
253
|
+
<td valign="top" align="left">
|
254
|
+
<p align="left" style="margin-left:0pt;text-align:left;" class="MsoNormal">Term</p>
|
255
|
+
</td>
|
256
|
+
<td valign="top">Definition</td>
|
257
|
+
</tr>
|
258
|
+
<tr>
|
259
|
+
<td valign="top" align="left">
|
260
|
+
<p align="left" style="margin-left:0pt;text-align:left;" class="MsoNormal">Term 2</p>
|
261
|
+
</td>
|
262
|
+
<td valign="top">Definition 2</td>
|
263
|
+
</tr>
|
264
|
+
</table>
|
265
265
|
</div>
|
266
|
+
<p class="MsoNormal"> </p>
|
267
|
+
</div>
|
266
268
|
OUTPUT
|
267
269
|
end
|
268
270
|
|
269
|
-
it
|
270
|
-
FileUtils.rm_f
|
271
|
-
FileUtils.rm_f
|
272
|
-
IsoDoc::WordConvert.new(
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
<term id="paddy1"><preferred>paddy</preferred>
|
278
|
-
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
279
|
-
<termsource status="modified">
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
</termsource></term>
|
285
|
-
|
286
|
-
</terms>
|
287
|
-
</sections>
|
288
|
-
</iso-standard>
|
271
|
+
it 'populates Word template with terms reference labels' do
|
272
|
+
FileUtils.rm_f 'test.doc'
|
273
|
+
FileUtils.rm_f 'test.html'
|
274
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
275
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
276
|
+
<sections>
|
277
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
278
|
+
|
279
|
+
<term id="paddy1"><preferred>paddy</preferred>
|
280
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
281
|
+
<termsource status="modified">
|
282
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
283
|
+
<modification>
|
284
|
+
<p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
|
285
|
+
</modification>
|
286
|
+
</termsource></term>
|
287
|
+
|
288
|
+
</terms>
|
289
|
+
</sections>
|
290
|
+
</iso-standard>
|
289
291
|
|
290
292
|
INPUT
|
291
|
-
word = File.read(
|
292
|
-
|
293
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
294
|
+
.sub(%r{<div style="mso-element:footnote-list"/>.*$}m, '')
|
293
295
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
296
|
+
<div class="WordSection3">
|
297
|
+
<p class="zzSTDTitle1"></p>
|
298
|
+
<div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1.<span style="mso-tab-count:1">  </span>Terms and Definitions</h1>
|
299
|
+
<p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1.</p><p class="Terms" style="text-align:left;">paddy</p>
|
300
|
+
<p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
|
301
|
+
<p class="MsoNormal">[SOURCE: <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
|
302
|
+
</div>
|
301
303
|
OUTPUT
|
302
304
|
end
|
303
305
|
|
304
|
-
it
|
305
|
-
FileUtils.rm_f
|
306
|
-
IsoDoc::WordConvert.new(
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
</iso-standard>
|
306
|
+
it 'populates Word header' do
|
307
|
+
FileUtils.rm_f 'test.doc'
|
308
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', header: 'spec/assets/header.html').convert('test', <<~"INPUT", false)
|
309
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
310
|
+
<bibdata type="article">
|
311
|
+
<docidentifier>
|
312
|
+
<project-number part="1">1000</project-number>
|
313
|
+
</docidentifier>
|
314
|
+
</bibdata>
|
315
|
+
</iso-standard>
|
314
316
|
|
315
317
|
INPUT
|
316
|
-
word = File.read(
|
317
|
-
|
318
|
+
word = File.read('test.doc').sub(%r{^.*Content-Location: file:///C:/Doc/test_files/header.html}m, 'Content-Location: file:///C:/Doc/test_files/header.html')
|
319
|
+
.sub(/------=_NextPart.*$/m, '')
|
318
320
|
expect(word).to be_equivalent_to <<~"OUTPUT"
|
319
321
|
|
320
|
-
Content-Location: file:///C:/Doc/test_files/header.html
|
321
|
-
Content-Transfer-Encoding: base64
|
322
|
-
Content-Type: text/html charset="utf-8"
|
322
|
+
Content-Location: file:///C:/Doc/test_files/header.html
|
323
|
+
Content-Transfer-Encoding: base64
|
324
|
+
Content-Type: text/html charset="utf-8"
|
323
325
|
|
324
|
-
Ci8qIGFuIGVtcHR5IGhlYWRlciAqLwoKU1RBUlQgRE9DIElEOiAKICAgICAgICAgICAxMDAwCiAg
|
325
|
-
ICAgICAgIDogRU5EIERPQyBJRAoKRklMRU5BTUU6IHRlc3QKCg==
|
326
|
+
Ci8qIGFuIGVtcHR5IGhlYWRlciAqLwoKU1RBUlQgRE9DIElEOiAKICAgICAgICAgICAxMDAwCiAg
|
327
|
+
ICAgICAgIDogRU5EIERPQyBJRAoKRklMRU5BTUU6IHRlc3QKCg==
|
326
328
|
|
327
329
|
OUTPUT
|
328
330
|
end
|
329
331
|
|
330
|
-
it
|
331
|
-
FileUtils.rm_f
|
332
|
-
IsoDoc::WordConvert.new(
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
</fn></title>
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
</fn></p>
|
346
|
-
<clause id="P" inline-header="false" obligation="normative">
|
347
|
-
<title>Clause 4.2.1</title>
|
348
|
-
</clause>
|
349
|
-
|
350
|
-
|
351
|
-
|
332
|
+
it 'populates Word ToC' do
|
333
|
+
FileUtils.rm_f 'test.doc'
|
334
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', wordintropage: 'spec/assets/wordintro.html').convert('test', <<~"INPUT", false)
|
335
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
336
|
+
<sections>
|
337
|
+
<clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
338
|
+
|
339
|
+
<title>Introduction<bookmark id="Q"/> to this<fn reference="1">
|
340
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
341
|
+
</fn></title>
|
342
|
+
</clause>
|
343
|
+
<clause id="O" inline-header="false" obligation="normative">
|
344
|
+
<title>Clause 4.2</title>
|
345
|
+
<p>A<fn reference="1">
|
346
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
347
|
+
</fn></p>
|
348
|
+
<clause id="P" inline-header="false" obligation="normative">
|
349
|
+
<title>Clause 4.2.1</title>
|
350
|
+
</clause>
|
351
|
+
</clause></clause>
|
352
|
+
</sections>
|
353
|
+
</iso-standard>
|
352
354
|
|
353
355
|
INPUT
|
354
|
-
word = File.read(
|
355
|
-
|
356
|
-
expect(xmlpp(word.gsub(/_Toc\d\d+/,
|
357
|
-
|
358
|
-
|
359
|
-
|
356
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
|
357
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
358
|
+
expect(xmlpp(word.gsub(/_Toc\d\d+/, '_Toc'))).to be_equivalent_to xmlpp(<<~'OUTPUT')
|
359
|
+
<div class="WordSection2">
|
360
|
+
/* an empty word intro page */
|
360
361
|
<p class="MsoToc1"><span lang="EN-GB" xml:lang="EN-GB"><span style="mso-element:field-begin"></span><span style="mso-spacerun:yes"> </span>TOC
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
362
|
+
\o "1-2" \h \z \u <span style="mso-element:field-separator"></span></span>
|
363
|
+
<span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
364
|
+
<a href="#_Toc">1. Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
365
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
366
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
367
|
+
<span style="mso-element:field-begin"></span></span>
|
368
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
369
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
|
370
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span></span></p>
|
371
371
|
<p class="MsoToc2">
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
372
|
+
<span class="MsoHyperlink">
|
373
|
+
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
374
|
+
<a href="#_Toc">1.1. Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
375
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
376
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
377
|
+
<span style="mso-element:field-begin"></span></span>
|
378
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
379
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
|
380
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
|
381
|
+
</span>
|
382
|
+
</p>
|
384
383
|
<p class="MsoToc2">
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
384
|
+
<span class="MsoHyperlink">
|
385
|
+
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
386
|
+
<a href="#_Toc">1.2. Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
387
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
388
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
389
|
+
<span style="mso-element:field-begin"></span></span>
|
390
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
391
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
|
392
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
|
393
|
+
</span>
|
394
|
+
</p>
|
397
395
|
<p class="MsoToc1">
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
<p class="MsoNormal"> </p>
|
408
|
-
</div>
|
396
|
+
<span lang="EN-GB" xml:lang="EN-GB">
|
397
|
+
<span style="mso-element:field-end"></span>
|
398
|
+
</span>
|
399
|
+
<span lang="EN-GB" xml:lang="EN-GB">
|
400
|
+
<p class="MsoNormal"> </p>
|
401
|
+
</span>
|
402
|
+
</p>
|
403
|
+
<p class="MsoNormal"> </p>
|
404
|
+
</div>
|
409
405
|
OUTPUT
|
410
406
|
end
|
411
407
|
|
412
|
-
|
413
|
-
FileUtils.rm_f
|
414
|
-
IsoDoc::WordConvert.new(
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
</fn></title>
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
</fn></p>
|
428
|
-
<clause id="P" inline-header="false" obligation="normative">
|
429
|
-
<title>Clause 4.2.1</title>
|
430
|
-
</clause>
|
431
|
-
|
432
|
-
|
433
|
-
|
408
|
+
it 'populates Word ToC with custom levels' do
|
409
|
+
FileUtils.rm_f 'test.doc'
|
410
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', wordintropage: 'spec/assets/wordintro.html', doctoclevels: 3).convert('test', <<~"INPUT", false)
|
411
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
412
|
+
<sections>
|
413
|
+
<clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
414
|
+
|
415
|
+
<title>Introduction<bookmark id="Q"/> to this<fn reference="1">
|
416
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
417
|
+
</fn></title>
|
418
|
+
</clause>
|
419
|
+
<clause id="O" inline-header="false" obligation="normative">
|
420
|
+
<title>Clause 4.2</title>
|
421
|
+
<p>A<fn reference="1">
|
422
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
423
|
+
</fn></p>
|
424
|
+
<clause id="P" inline-header="false" obligation="normative">
|
425
|
+
<title>Clause 4.2.1</title>
|
426
|
+
</clause>
|
427
|
+
</clause></clause>
|
428
|
+
</sections>
|
429
|
+
</iso-standard>
|
434
430
|
|
435
431
|
INPUT
|
436
|
-
word = File.read(
|
437
|
-
|
438
|
-
expect(xmlpp(word.gsub(/_Toc\d\d+/,
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
432
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
|
433
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
434
|
+
expect(xmlpp(word.gsub(/_Toc\d\d+/, '_Toc'))).to be_equivalent_to xmlpp(<<~'OUTPUT')
|
435
|
+
<div class="WordSection2">
|
436
|
+
/* an empty word intro page */
|
437
|
+
|
438
|
+
<p class="MsoToc1"><span lang="EN-GB" xml:lang="EN-GB"><span style="mso-element:field-begin"></span><span style="mso-spacerun:yes"> </span>TOC
|
439
|
+
\o "1-3" \h \z \u <span style="mso-element:field-separator"></span></span>
|
440
|
+
<span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
441
|
+
<a href="#_Toc">1. Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
442
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
443
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
444
|
+
<span style="mso-element:field-begin"></span></span>
|
445
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
446
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
|
447
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span></span></p>
|
448
|
+
|
449
|
+
<p class="MsoToc2">
|
450
|
+
<span class="MsoHyperlink">
|
451
|
+
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
452
|
+
<a href="#_Toc">1.1. Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
453
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
454
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
455
|
+
<span style="mso-element:field-begin"></span></span>
|
456
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
457
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
|
458
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
|
459
|
+
</span>
|
460
|
+
</p>
|
452
461
|
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
462
|
+
<p class="MsoToc2">
|
463
|
+
<span class="MsoHyperlink">
|
464
|
+
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
465
|
+
<a href="#_Toc">1.2. Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
466
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
467
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
468
|
+
<span style="mso-element:field-begin"></span></span>
|
469
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
470
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
|
471
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
|
472
|
+
</span>
|
473
|
+
</p>
|
465
474
|
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
<p class="MsoToc3">
|
480
|
-
<span class="MsoHyperlink">
|
481
|
-
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
482
|
-
<a href="#_Toc">1.2.1. Clause 4.2.1<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
483
|
-
<span style="mso-tab-count:1 dotted">. </span>
|
484
|
-
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
485
|
-
<span style="mso-element:field-begin"></span></span>
|
486
|
-
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
487
|
-
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
|
488
|
-
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
|
489
|
-
</span>
|
490
|
-
</p>
|
475
|
+
<p class="MsoToc3">
|
476
|
+
<span class="MsoHyperlink">
|
477
|
+
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
478
|
+
<a href="#_Toc">1.2.1. Clause 4.2.1<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
479
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
480
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
481
|
+
<span style="mso-element:field-begin"></span></span>
|
482
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
483
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
|
484
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
|
485
|
+
</span>
|
486
|
+
</p>
|
491
487
|
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
488
|
+
<p class="MsoToc1">
|
489
|
+
<span lang="EN-GB" xml:lang="EN-GB">
|
490
|
+
<span style="mso-element:field-end"></span>
|
491
|
+
</span>
|
492
|
+
<span lang="EN-GB" xml:lang="EN-GB">
|
493
|
+
<p class="MsoNormal"> </p>
|
494
|
+
</span>
|
495
|
+
</p>
|
500
496
|
|
501
497
|
|
502
|
-
|
503
|
-
|
498
|
+
<p class="MsoNormal"> </p>
|
499
|
+
</div>
|
504
500
|
OUTPUT
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
FileUtils.rm_f
|
509
|
-
FileUtils.rm_f
|
510
|
-
IsoDoc::HtmlConvert.new(
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
</note>
|
516
|
-
|
517
|
-
|
501
|
+
end
|
502
|
+
|
503
|
+
it 'generates HTML output with custom ToC levels function' do
|
504
|
+
FileUtils.rm_f 'test.doc'
|
505
|
+
FileUtils.rm_f 'test.html'
|
506
|
+
IsoDoc::HtmlConvert.new(htmltoclevels: 3).convert('test', <<~"INPUT", false)
|
507
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
508
|
+
<preface><foreword>
|
509
|
+
<note>
|
510
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
511
|
+
</note>
|
512
|
+
</foreword></preface>
|
513
|
+
</iso-standard>
|
518
514
|
INPUT
|
519
|
-
html = File.read(
|
515
|
+
html = File.read('test.html')
|
520
516
|
toclevel = <<~"TOCLEVEL"
|
521
|
-
function toclevel() { return "h1:not(:empty):not(.TermNum):not(.noTOC),h2:not(:empty):not(.TermNum):not(.noTOC),h3:not(:empty):not(.TermNum):not(.noTOC)";}
|
517
|
+
function toclevel() { return "h1:not(:empty):not(.TermNum):not(.noTOC),h2:not(:empty):not(.TermNum):not(.noTOC),h3:not(:empty):not(.TermNum):not(.noTOC)";}
|
522
518
|
TOCLEVEL
|
523
519
|
expect(html).to include toclevel
|
524
520
|
end
|
525
521
|
|
526
|
-
it
|
527
|
-
FileUtils.rm_f
|
528
|
-
IsoDoc::HtmlConvert.new(
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
</fn><clause id="N" inline-header="false" obligation="normative">
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
</fn></title>
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
</fn></p>
|
544
|
-
|
545
|
-
|
546
|
-
|
522
|
+
it 'reorders footnote numbers in HTML' do
|
523
|
+
FileUtils.rm_f 'test.html'
|
524
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', wordintropage: 'spec/assets/wordintro.html').convert('test', <<~"INPUT", false)
|
525
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
526
|
+
<sections>
|
527
|
+
<clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><fn reference="3">
|
528
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">This is a footnote.</p>
|
529
|
+
</fn><clause id="N" inline-header="false" obligation="normative">
|
530
|
+
|
531
|
+
<title>Introduction to this<fn reference="2">
|
532
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
533
|
+
</fn></title>
|
534
|
+
</clause>
|
535
|
+
<clause id="O" inline-header="false" obligation="normative">
|
536
|
+
<title>Clause 4.2</title>
|
537
|
+
<p>A<fn reference="1">
|
538
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
539
|
+
</fn></p>
|
540
|
+
</clause></clause>
|
541
|
+
</sections>
|
542
|
+
</iso-standard>
|
547
543
|
INPUT
|
548
|
-
html = File.read(
|
549
|
-
|
544
|
+
html = File.read('test.html').sub(/^.*<main class="main-section">/m, '<main xmlns:epub="epub" class="main-section">')
|
545
|
+
.sub(%r{</main>.*$}m, '</main>')
|
550
546
|
expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
547
|
+
<main xmlns:epub="epub" class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
548
|
+
<p class="zzSTDTitle1"></p>
|
549
|
+
<div id="A">
|
550
|
+
<h1>1.  Clause 4</h1>
|
551
|
+
<a class='FootnoteRef' href='#fn:3' id='fnref:1'>
|
552
|
+
<sup>1</sup>
|
553
|
+
</a>
|
554
|
+
<div id="N">
|
560
555
|
<h2>1.1.  Introduction to this<a class='FootnoteRef' href='#fn:2' id='fnref:2'><sup>2</sup></a></h2>
|
561
|
-
</div>
|
562
|
-
<div id="O">
|
563
|
-
<h2>1.2.  Clause 4.2</h2>
|
564
|
-
<p>A<a class='FootnoteRef' href='#fn:2'><sup>2</sup></a></p>
|
565
|
-
</div>
|
566
556
|
</div>
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
557
|
+
<div id="O">
|
558
|
+
<h2>1.2.  Clause 4.2</h2>
|
559
|
+
<p>A<a class='FootnoteRef' href='#fn:2'><sup>2</sup></a></p>
|
560
|
+
</div>
|
561
|
+
</div>
|
562
|
+
<aside id="fn:3" class="footnote">
|
563
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a class='FootnoteRef' href='#fn:3'>
|
564
|
+
<sup>1</sup>
|
565
|
+
</a>This is a footnote.</p>
|
566
|
+
<a href="#fnref:1">↩</a></aside>
|
567
|
+
<aside id="fn:2" class="footnote">
|
568
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a class='FootnoteRef' href='#fn:2'><sup>2</sup></a>Formerly denoted as 15 % (m/m).</p>
|
569
|
+
<a href="#fnref:2">↩</a></aside>
|
576
570
|
</main>
|
577
571
|
OUTPUT
|
578
572
|
end
|
579
573
|
|
580
|
-
it
|
581
|
-
FileUtils.rm_f
|
582
|
-
FileUtils.rm_rf
|
583
|
-
IsoDoc::HtmlConvert.new(
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
574
|
+
it 'moves images in HTML' do
|
575
|
+
FileUtils.rm_f 'test.html'
|
576
|
+
FileUtils.rm_rf 'test_htmlimages'
|
577
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
578
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
579
|
+
<preface><foreword>
|
580
|
+
<figure id="_">
|
581
|
+
<name>Split-it-right sample divider</name>
|
582
|
+
<image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
|
583
|
+
<image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
|
584
|
+
<image src="spec/assets/rice_image1.png" id="_" width="20000" height="300000" mimetype="image/png"/>
|
585
|
+
<image src="spec/assets/rice_image1.png" id="_" width="99" height="auto" mimetype="image/png"/>
|
586
|
+
|
587
|
+
</figure>
|
588
|
+
</foreword></preface>
|
589
|
+
</iso-standard>
|
596
590
|
INPUT
|
597
|
-
html = File.read(
|
598
|
-
|
591
|
+
html = File.read('test.html').sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
592
|
+
.sub(%r{</main>.*$}m, '</main>')
|
599
593
|
expect(`ls test_htmlimages`).to match(/\.png$/)
|
600
|
-
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/,
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
<img src="test_htmlimages/_.png" height="800" width="53" />
|
609
|
-
<img src="test_htmlimages/_.png" height="83" width="99" />
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
594
|
+
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, '/_.png'))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
595
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
596
|
+
<br />
|
597
|
+
<div>
|
598
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
599
|
+
<div id="_" class="figure">
|
600
|
+
<img src="test_htmlimages/_.png" height="776" width="922" />
|
601
|
+
<img src="test_htmlimages/_.png" height="776" width="922" />
|
602
|
+
<img src="test_htmlimages/_.png" height="800" width="53" />
|
603
|
+
<img src="test_htmlimages/_.png" height="83" width="99" />
|
604
|
+
|
605
|
+
<p class="FigureTitle" style="text-align:center;">Figure 1 — Split-it-right sample divider</p></div>
|
606
|
+
</div>
|
607
|
+
<p class="zzSTDTitle1"></p>
|
608
|
+
</main>
|
615
609
|
OUTPUT
|
616
|
-
|
617
610
|
end
|
618
611
|
|
619
|
-
|
620
|
-
|
621
|
-
FileUtils.
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
</iso-standard>
|
612
|
+
it 'moves images in HTML with no file suffix' do
|
613
|
+
FileUtils.rm_f 'test.html'
|
614
|
+
FileUtils.rm_rf 'test_htmlimages'
|
615
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
616
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
617
|
+
<preface><foreword>
|
618
|
+
<figure id="_">
|
619
|
+
<name>Split-it-right sample divider</name>
|
620
|
+
<image src="spec/assets/rice_image1" id="_" mimetype="image/png"/>
|
621
|
+
<image src="spec/assets/rice_image1" id="_" mimetype="image/*"/>
|
622
|
+
|
623
|
+
|
624
|
+
</foreword></preface>
|
625
|
+
</iso-standard>
|
634
626
|
INPUT
|
635
|
-
html = File.read(
|
636
|
-
|
627
|
+
html = File.read('test.html').sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
628
|
+
.sub(%r{</main>.*$}m, '</main>')
|
637
629
|
expect(`ls test_htmlimages`).to match(/\.png$/)
|
638
|
-
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/,
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
630
|
+
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, '/_.png'))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
631
|
+
<main class='main-section'>
|
632
|
+
<button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
|
633
|
+
<br/>
|
634
|
+
<div>
|
635
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
636
|
+
<div id='_' class='figure'>
|
637
|
+
<img src='test_htmlimages/_.png' height='776' width='922'/>
|
638
|
+
<img src='test_htmlimages/_.png' height='776' width='922'/>
|
639
|
+
|
640
|
+
<p class='FigureTitle' style='text-align:center;'>Figure 1 — Split-it-right sample divider</p>
|
641
|
+
</div>
|
649
642
|
</div>
|
650
|
-
|
651
|
-
|
652
|
-
</main>
|
643
|
+
<p class='zzSTDTitle1'/>
|
644
|
+
</main>
|
653
645
|
OUTPUT
|
654
646
|
end
|
655
647
|
|
656
|
-
it
|
657
|
-
FileUtils.rm_f
|
658
|
-
FileUtils.rm_rf
|
659
|
-
IsoDoc::HtmlConvert.new(
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
648
|
+
it 'moves images in HTML, using relative file location' do
|
649
|
+
FileUtils.rm_f 'spec/test.html'
|
650
|
+
FileUtils.rm_rf 'spec/test_htmlimages'
|
651
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('spec/test', <<~"INPUT", false)
|
652
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
653
|
+
<preface><foreword>
|
654
|
+
<figure id="_">
|
655
|
+
<name>Split-it-right sample divider</name>
|
656
|
+
<image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
|
657
|
+
<image src="assets/rice_image1.png" id="_" mimetype="image/png"/>
|
658
|
+
<image src="assets/rice_image1.png" id="_" width="20000" height="300000" mimetype="image/png"/>
|
659
|
+
<image src="assets/rice_image1.png" id="_" width="99" height="auto" mimetype="image/png"/>
|
660
|
+
</figure>
|
661
|
+
</foreword></preface>
|
662
|
+
</iso-standard>
|
671
663
|
INPUT
|
672
|
-
html = File.read(
|
673
|
-
|
664
|
+
html = File.read('spec/test.html').sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
665
|
+
.sub(%r{</main>.*$}m, '</main>')
|
674
666
|
expect(`ls test_htmlimages`).to match(/\.png$/)
|
675
|
-
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/,
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
<img src="test_htmlimages/_.png" height="800" width="53" />
|
684
|
-
<img src="test_htmlimages/_.png" height="83" width="99" />
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
667
|
+
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, '/_.png'))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
668
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
669
|
+
<br />
|
670
|
+
<div>
|
671
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
672
|
+
<div id="_" class="figure">
|
673
|
+
<img src="test_htmlimages/_.png" height="776" width="922" />
|
674
|
+
<img src="test_htmlimages/_.png" height="776" width="922" />
|
675
|
+
<img src="test_htmlimages/_.png" height="800" width="53" />
|
676
|
+
<img src="test_htmlimages/_.png" height="83" width="99" />
|
677
|
+
<p class="FigureTitle" style="text-align:center;">Figure 1 — Split-it-right sample divider</p></div>
|
678
|
+
</div>
|
679
|
+
<p class="zzSTDTitle1"></p>
|
680
|
+
</main>
|
689
681
|
OUTPUT
|
690
682
|
end
|
691
683
|
|
692
|
-
|
693
|
-
|
694
|
-
FileUtils.
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
<
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
</
|
705
|
-
</iso-standard>
|
684
|
+
it 'encodes images in HTML as data URIs' do
|
685
|
+
FileUtils.rm_f 'test.html'
|
686
|
+
FileUtils.rm_rf 'test_htmlimages'
|
687
|
+
IsoDoc::HtmlConvert.new(htmlstylesheet: 'spec/assets/html.scss', datauriimage: true).convert('test', <<~"INPUT", false)
|
688
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
689
|
+
<preface><foreword>
|
690
|
+
<figure id="_">
|
691
|
+
<name>Split-it-right sample divider</name>
|
692
|
+
<image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
|
693
|
+
<image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
|
694
|
+
</figure>
|
695
|
+
</foreword></preface>
|
696
|
+
</iso-standard>
|
706
697
|
INPUT
|
707
|
-
html = File.read(
|
708
|
-
|
698
|
+
html = File.read('test.html').sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
699
|
+
.sub(%r{</main>.*$}m, '</main>')
|
709
700
|
expect(xmlpp(html.gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"}))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
701
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
702
|
+
<br />
|
703
|
+
<div>
|
704
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
705
|
+
<div id="_" class="figure">
|
706
|
+
<img src="data:image/png;base64,_" height="776" width="922" />
|
707
|
+
<img src="data:image/png;base64,_" height="776" width="922" />
|
708
|
+
<p class="FigureTitle" style="text-align:center;">Figure 1 — Split-it-right sample divider</p></div>
|
709
|
+
</div>
|
710
|
+
<p class="zzSTDTitle1"></p>
|
711
|
+
</main>
|
721
712
|
OUTPUT
|
722
|
-
|
723
713
|
end
|
724
714
|
|
725
|
-
|
726
|
-
FileUtils.rm_f
|
727
|
-
FileUtils.rm_rf
|
728
|
-
IsoDoc::HtmlConvert.new(
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
715
|
+
it 'encodes images in HTML as data URIs, using relative file location' do
|
716
|
+
FileUtils.rm_f 'spec/test.html'
|
717
|
+
FileUtils.rm_rf 'spec/test_htmlimages'
|
718
|
+
IsoDoc::HtmlConvert.new(htmlstylesheet: 'spec/assets/html.scss', datauriimage: true).convert('spec/test', <<~"INPUT", false)
|
719
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
720
|
+
<preface><foreword>
|
721
|
+
<figure id="_">
|
722
|
+
<name>Split-it-right sample divider</name>
|
723
|
+
<image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
|
724
|
+
<image src="assets/rice_image1.png" id="_" mimetype="image/png"/>
|
725
|
+
</figure>
|
726
|
+
</foreword></preface>
|
727
|
+
</iso-standard>
|
738
728
|
INPUT
|
739
|
-
html = File.read(
|
740
|
-
|
729
|
+
html = File.read('spec/test.html').sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
730
|
+
.sub(%r{</main>.*$}m, '</main>')
|
741
731
|
expect(xmlpp(html.gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"}))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
732
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
733
|
+
<br />
|
734
|
+
<div>
|
735
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
736
|
+
<div id="_" class="figure">
|
737
|
+
<img src="data:image/png;base64,_" height="776" width="922" />
|
738
|
+
<img src="data:image/png;base64,_" height="776" width="922" />
|
739
|
+
<p class="FigureTitle" style="text-align:center;">Figure 1 — Split-it-right sample divider</p></div>
|
740
|
+
</div>
|
741
|
+
<p class="zzSTDTitle1"></p>
|
742
|
+
</main>
|
753
743
|
OUTPUT
|
754
|
-
|
755
744
|
end
|
756
745
|
|
757
|
-
|
758
|
-
|
759
|
-
FileUtils.rm_f
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
<
|
767
|
-
<
|
768
|
-
<
|
769
|
-
<
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
<
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
<
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
<
|
789
|
-
<
|
790
|
-
<
|
791
|
-
<
|
792
|
-
<
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
<
|
798
|
-
|
799
|
-
|
800
|
-
<
|
801
|
-
<
|
802
|
-
|
803
|
-
|
804
|
-
<
|
805
|
-
|
806
|
-
</
|
807
|
-
</
|
808
|
-
</
|
809
|
-
</iso-standard>
|
746
|
+
it 'processes IsoXML terms for HTML' do
|
747
|
+
FileUtils.rm_f 'test.html'
|
748
|
+
FileUtils.rm_f 'test.doc'
|
749
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
750
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
751
|
+
<sections>
|
752
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
753
|
+
|
754
|
+
<term id="paddy1"><preferred>paddy</preferred>
|
755
|
+
<domain>rice</domain>
|
756
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
757
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
758
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
759
|
+
<ul>
|
760
|
+
<li>A</li>
|
761
|
+
</ul>
|
762
|
+
</termexample>
|
763
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
764
|
+
<ul>
|
765
|
+
<li>A</li>
|
766
|
+
</ul>
|
767
|
+
</termexample>
|
768
|
+
|
769
|
+
<termsource status="modified">
|
770
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
771
|
+
<modification>
|
772
|
+
<p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
|
773
|
+
</modification>
|
774
|
+
</termsource></term>
|
775
|
+
|
776
|
+
<term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
|
777
|
+
<admitted>rough rice</admitted>
|
778
|
+
<deprecates>cargo rice</deprecates>
|
779
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
780
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
781
|
+
<ul>
|
782
|
+
<li>A</li>
|
783
|
+
</ul>
|
784
|
+
</termexample>
|
785
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
786
|
+
<p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
787
|
+
</termnote>
|
788
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
789
|
+
<ul><li>A</li></ul>
|
790
|
+
<p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
791
|
+
</termnote>
|
792
|
+
<termsource status="identical">
|
793
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
794
|
+
</termsource></term>
|
795
|
+
</terms>
|
796
|
+
</sections>
|
797
|
+
</iso-standard>
|
810
798
|
INPUT
|
811
|
-
expect(File.exist?(
|
812
|
-
html = File.read(
|
799
|
+
expect(File.exist?('test.html')).to be true
|
800
|
+
html = File.read('test.html')
|
813
801
|
expect(html).to match(%r{<h2 class="TermNum" id="paddy1">1\.1\.</h2>})
|
814
802
|
expect(html).to match(%r{<h2 class="TermNum" id="paddy">1\.2\.</h2>})
|
815
803
|
end
|
816
804
|
|
817
|
-
|
818
|
-
FileUtils.rm_f
|
819
|
-
FileUtils.rm_f
|
820
|
-
IsoDoc::HtmlConvert.new(
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
<
|
826
|
-
<
|
827
|
-
<
|
828
|
-
<
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
<
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
<
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
</
|
846
|
-
|
847
|
-
</terms>
|
848
|
-
</sections>
|
849
|
-
</iso-standard>
|
805
|
+
it 'processes empty term modifications' do
|
806
|
+
FileUtils.rm_f 'test.html'
|
807
|
+
FileUtils.rm_f 'test.doc'
|
808
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
809
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
810
|
+
<sections>
|
811
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
812
|
+
<term id="paddy1"><preferred>paddy</preferred>
|
813
|
+
<domain>rice</domain>
|
814
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
815
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
816
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
817
|
+
<ul>
|
818
|
+
<li>A</li>
|
819
|
+
</ul>
|
820
|
+
</termexample>
|
821
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
822
|
+
<ul>
|
823
|
+
<li>A</li>
|
824
|
+
</ul>
|
825
|
+
</termexample>
|
826
|
+
<termsource status="modified">
|
827
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
828
|
+
<modification>
|
829
|
+
<p id="_e73a417d-ad39-417d-a4c8-20e4e2529489"/>
|
830
|
+
</modification>
|
831
|
+
</termsource></term>
|
832
|
+
</terms>
|
833
|
+
</sections>
|
834
|
+
</iso-standard>
|
850
835
|
INPUT
|
851
|
-
expect(File.exist?(
|
852
|
-
html = File.read(
|
836
|
+
expect(File.exist?('test.html')).to be true
|
837
|
+
html = File.read('test.html')
|
853
838
|
expect(html).to include '[SOURCE: <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>, modified]'
|
854
839
|
end
|
855
840
|
|
856
|
-
|
857
|
-
|
858
|
-
FileUtils.rm_f
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
</iso-standard>
|
841
|
+
it 'creates continuation styles for multiparagraph list items in Word' do
|
842
|
+
FileUtils.rm_f 'test.doc'
|
843
|
+
FileUtils.rm_f 'test.html'
|
844
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
845
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
846
|
+
<preface><foreword>
|
847
|
+
<ul>
|
848
|
+
<li><p>A</p>
|
849
|
+
<p>B</p></li>
|
850
|
+
<li><ol><li><p>C</p>
|
851
|
+
<p>D</p>
|
852
|
+
<sourcecode>E</sourcecode></li>
|
853
|
+
</ol></li>
|
854
|
+
</ul>
|
855
|
+
<ol>
|
856
|
+
<li><p>A1</p>
|
857
|
+
<p>B1</p></li>
|
858
|
+
<li><ul><li><p>C1</p>
|
859
|
+
<formula id="_5fc1ef0f-75d2-4b54-802c-b1bad4a53b62">
|
860
|
+
<stem type="AsciiMath">D1</stem>
|
861
|
+
</formula>
|
862
|
+
</ul></li>
|
863
|
+
</ol>
|
864
|
+
</foreword></preface>
|
865
|
+
</iso-standard>
|
882
866
|
INPUT
|
883
|
-
word = File.read(
|
884
|
-
|
867
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">')
|
868
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
885
869
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
</p>
|
890
|
-
<div>
|
891
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
892
|
-
<p class='MsoListParagraphCxSpFirst'>
|
893
|
-
A
|
894
|
-
<div class='ListContLevel1'>
|
895
|
-
<p class='MsoNormal'>B</p>
|
896
|
-
</div>
|
870
|
+
<div class='WordSection2' xmlns:m='m'>
|
871
|
+
<p class='MsoNormal'>
|
872
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
897
873
|
</p>
|
898
|
-
<
|
874
|
+
<div>
|
875
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
899
876
|
<p class='MsoListParagraphCxSpFirst'>
|
900
|
-
|
901
|
-
<div class='
|
902
|
-
<p class='MsoNormal'>
|
877
|
+
A
|
878
|
+
<div class='ListContLevel1'>
|
879
|
+
<p class='MsoNormal'>B</p>
|
903
880
|
</div>
|
904
|
-
|
905
|
-
|
881
|
+
</p>
|
882
|
+
<p class='MsoListParagraphCxSpLast'>
|
883
|
+
<p class='MsoListParagraphCxSpFirst'>
|
884
|
+
C
|
885
|
+
<div class='ListContLevel2'>
|
886
|
+
<p class='MsoNormal'>D</p>
|
887
|
+
</div>
|
888
|
+
<div class='ListContLevel2'>
|
889
|
+
<p class='Sourcecode'>E</p>
|
890
|
+
</div>
|
891
|
+
</p>
|
892
|
+
</p>
|
893
|
+
<p class='MsoListParagraphCxSpFirst'>
|
894
|
+
A1
|
895
|
+
<div class='ListContLevel1'>
|
896
|
+
<p class='MsoNormal'>B1</p>
|
906
897
|
</div>
|
907
898
|
</p>
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
</m:r>
|
927
|
-
</m:oMath>
|
928
|
-
</span>
|
929
|
-
<span style='mso-tab-count:1'>  </span>
|
930
|
-
(1)
|
931
|
-
</p>
|
899
|
+
<p class='MsoListParagraphCxSpLast'>
|
900
|
+
C1
|
901
|
+
<div class='ListContLevel2'>
|
902
|
+
<div>
|
903
|
+
<a name='_5fc1ef0f-75d2-4b54-802c-b1bad4a53b62' id='_5fc1ef0f-75d2-4b54-802c-b1bad4a53b62'/>
|
904
|
+
<div class='formula'>
|
905
|
+
<p class='MsoNormal'>
|
906
|
+
<span class='stem'>
|
907
|
+
<m:oMath>
|
908
|
+
<m:r>
|
909
|
+
<m:t>D1</m:t>
|
910
|
+
</m:r>
|
911
|
+
</m:oMath>
|
912
|
+
</span>
|
913
|
+
<span style='mso-tab-count:1'>  </span>
|
914
|
+
(1)
|
915
|
+
</p>
|
916
|
+
</div>
|
932
917
|
</div>
|
933
918
|
</div>
|
934
|
-
</
|
935
|
-
</
|
919
|
+
</p>
|
920
|
+
</div>
|
921
|
+
<p class='MsoNormal'> </p>
|
936
922
|
</div>
|
937
|
-
<p class='MsoNormal'> </p>
|
938
|
-
</div>
|
939
923
|
OUTPUT
|
940
924
|
end
|
941
925
|
|
942
|
-
it
|
943
|
-
|
944
|
-
FileUtils.rm_f
|
945
|
-
IsoDoc::HtmlConvert.new(
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
</sourcecode>
|
952
|
-
|
953
|
-
|
926
|
+
it 'does not lose HTML escapes in postprocessing' do
|
927
|
+
FileUtils.rm_f 'test.doc'
|
928
|
+
FileUtils.rm_f 'test.html'
|
929
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
930
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
931
|
+
<preface><foreword>
|
932
|
+
<sourcecode id="samplecode">
|
933
|
+
<name>XML code</name>
|
934
|
+
<xml> &
|
935
|
+
</sourcecode>
|
936
|
+
</foreword></preface>
|
937
|
+
</iso-standard>
|
954
938
|
INPUT
|
955
|
-
|
956
|
-
|
939
|
+
html = File.read('test.html').sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
940
|
+
.sub(%r{</main>.*$}m, '</main>')
|
957
941
|
expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
942
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
943
|
+
<br />
|
944
|
+
<div>
|
945
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
946
|
+
<pre id="samplecode" class="prettyprint "><br />    <br />  <xml> &<br />
|
947
|
+
</pre>
|
948
|
+
<p class="SourceTitle" style="text-align:center;">Figure 1 — XML code</p>
|
949
|
+
</div>
|
950
|
+
<p class="zzSTDTitle1"></p>
|
951
|
+
</main>
|
968
952
|
OUTPUT
|
969
953
|
end
|
970
954
|
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
</
|
982
|
-
|
983
|
-
</iso-standard>
|
955
|
+
it 'does not lose HTML escapes in postprocessing (Word)' do
|
956
|
+
FileUtils.rm_f 'test.doc'
|
957
|
+
FileUtils.rm_f 'test.html'
|
958
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
959
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
960
|
+
<preface><foreword>
|
961
|
+
<sourcecode id="samplecode">
|
962
|
+
<name>XML code</name>
|
963
|
+
<xml> &
|
964
|
+
</sourcecode>
|
965
|
+
</foreword></preface>
|
966
|
+
</iso-standard>
|
984
967
|
INPUT
|
985
|
-
|
986
|
-
|
968
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
|
969
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
987
970
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
971
|
+
<div class="WordSection2">
|
972
|
+
<p class="MsoNormal">
|
973
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
974
|
+
</p>
|
975
|
+
<div>
|
976
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
977
|
+
<p class="Sourcecode" style="page-break-after:avoid;"><a name="samplecode" id="samplecode"></a><br/>    <br/>  <xml> &<br/></p><p class="SourceTitle" style="text-align:center;">Figure 1 — XML code</p>
|
978
|
+
</div>
|
979
|
+
<p class="MsoNormal"> </p>
|
995
980
|
</div>
|
996
|
-
<p class="MsoNormal"> </p>
|
997
|
-
</div>
|
998
981
|
|
999
982
|
OUTPUT
|
1000
983
|
end
|
1001
984
|
|
1002
|
-
it
|
1003
|
-
FileUtils.rm_f
|
1004
|
-
FileUtils.rm_f
|
1005
|
-
IsoDoc::WordConvert.new(
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
</example>
|
1011
|
-
|
1012
|
-
|
985
|
+
it 'propagates example style to paragraphs in postprocessing (Word)' do
|
986
|
+
FileUtils.rm_f 'test.doc'
|
987
|
+
FileUtils.rm_f 'test.html'
|
988
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
989
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
990
|
+
<preface><foreword>
|
991
|
+
<example id="samplecode">
|
992
|
+
<p>ABC</p>
|
993
|
+
</example>
|
994
|
+
</foreword></preface>
|
995
|
+
</iso-standard>
|
1013
996
|
INPUT
|
1014
|
-
|
1015
|
-
|
997
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
|
998
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
1016
999
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1017
|
-
<div class="WordSection2">
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
</div>
|
1000
|
+
<div class="WordSection2">
|
1001
|
+
<p class="MsoNormal">
|
1002
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
1003
|
+
</p>
|
1004
|
+
<div>
|
1005
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
1006
|
+
<div class="example"><a name="samplecode" id="samplecode"></a><p class="example-title">EXAMPLE</p>
|
1007
|
+
<p class="example">ABC</p>
|
1026
1008
|
</div>
|
1027
|
-
|
1028
|
-
|
1009
|
+
</div>
|
1010
|
+
<p class="MsoNormal"> </p>
|
1011
|
+
</div>
|
1029
1012
|
OUTPUT
|
1030
1013
|
end
|
1031
1014
|
|
1032
|
-
it
|
1033
|
-
FileUtils.rm_f
|
1034
|
-
FileUtils.rm_f
|
1035
|
-
IsoDoc::WordConvert.new(
|
1036
|
-
|
1037
|
-
|
1038
|
-
<figure id="fig1">
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1015
|
+
it 'deals with image captions (Word)' do
|
1016
|
+
FileUtils.rm_f 'test.doc'
|
1017
|
+
FileUtils.rm_f 'test.html'
|
1018
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
1019
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1020
|
+
<preface><foreword>
|
1021
|
+
<figure id="fig1">
|
1022
|
+
<name>Typical arrangement of the far-field scan set-up</name>
|
1023
|
+
<image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
|
1024
|
+
</figure>
|
1025
|
+
</foreword></preface>
|
1026
|
+
</iso-standard>
|
1044
1027
|
INPUT
|
1045
|
-
word = File.read(
|
1046
|
-
|
1047
|
-
|
1028
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
|
1029
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
1030
|
+
.sub(/src="[^"]+"/, 'src="_"')
|
1048
1031
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1032
|
+
<div class="WordSection2">
|
1033
|
+
<p class="MsoNormal">
|
1034
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
1035
|
+
</p>
|
1036
|
+
<div>
|
1037
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
1038
|
+
<div class="figure"><a name="fig1" id="fig1"></a>
|
1039
|
+
<p style="page-break-after:avoid;" class="figure"><img src="_" width="400" height="337"/></p>
|
1040
|
+
<p class="FigureTitle" style="text-align:center;">Figure 1 — Typical arrangement of the far-field scan set-up</p></div>
|
1041
|
+
</div>
|
1042
|
+
<p class="MsoNormal"> </p>
|
1059
1043
|
</div>
|
1060
|
-
<p class="MsoNormal"> </p>
|
1061
|
-
</div>
|
1062
1044
|
OUTPUT
|
1063
|
-
|
1064
1045
|
end
|
1065
1046
|
|
1066
|
-
it
|
1067
|
-
FileUtils.rm_f
|
1068
|
-
FileUtils.rm_f
|
1069
|
-
IsoDoc::WordConvert.new(
|
1070
|
-
|
1071
|
-
|
1072
|
-
<table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1047
|
+
it 'deals with empty table titles (Word)' do
|
1048
|
+
FileUtils.rm_f 'test.doc'
|
1049
|
+
FileUtils.rm_f 'test.html'
|
1050
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
1051
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1052
|
+
<preface><foreword>
|
1053
|
+
<table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
|
1054
|
+
<td rowspan="2">
|
1055
|
+
<p id="_c47d9b39-adb2-431d-9320-78cb148fdb56">Output wavelength <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mo>(</mo><mi>μ</mi><mi>m</mi><mo>)</mo></mrow></math></stem></p>
|
1056
|
+
</td>
|
1057
|
+
<th colspan="3" align="left">Predictive wavelengths</th>
|
1058
|
+
</tr>
|
1059
|
+
</thead>
|
1060
|
+
</table>
|
1061
|
+
</preface>
|
1062
|
+
</iso-standard>
|
1082
1063
|
INPUT
|
1083
|
-
word = File.read(
|
1084
|
-
|
1085
|
-
|
1064
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">')
|
1065
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
1066
|
+
.sub(/src="[^"]+"/, 'src="_"')
|
1086
1067
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
</table>
|
1112
|
-
</div>
|
1113
|
-
</div>
|
1114
|
-
<p class="MsoNormal"> </p>
|
1115
|
-
</div>
|
1068
|
+
<div class="WordSection2" xmlns:m="m">
|
1069
|
+
<p class="MsoNormal">
|
1070
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
1071
|
+
</p>
|
1072
|
+
<div>
|
1073
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
1074
|
+
<div align="center" class="table_container">
|
1075
|
+
<table class="MsoISOTable" style="mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;"><a name="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7"></a>
|
1076
|
+
<thead>
|
1077
|
+
<tr>
|
1078
|
+
<td rowspan="2" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt:solid windowtext 1.0pt;">
|
1079
|
+
<p class="MsoNormal"><a name="_c47d9b39-adb2-431d-9320-78cb148fdb56" id="_c47d9b39-adb2-431d-9320-78cb148fdb56"></a>Output wavelength <span class="stem"><m:oMath>
|
1080
|
+
<m:r><m:t>(μm)</m:t></m:r>
|
1081
|
+
</m:oMath>
|
1082
|
+
</span></p>
|
1083
|
+
</td>
|
1084
|
+
<th colspan="3" align="left" 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;">Predictive wavelengths</th>
|
1085
|
+
</tr>
|
1086
|
+
</thead>
|
1087
|
+
</table>
|
1088
|
+
</div>
|
1089
|
+
</div>
|
1090
|
+
<p class="MsoNormal"> </p>
|
1091
|
+
</div>
|
1116
1092
|
OUTPUT
|
1117
1093
|
end
|
1118
1094
|
|
1119
|
-
|
1120
|
-
FileUtils.rm_f
|
1121
|
-
FileUtils.rm_f
|
1122
|
-
IsoDoc::WordConvert.new(
|
1123
|
-
|
1124
|
-
|
1125
|
-
<table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1095
|
+
it 'propagates alignment of table cells (Word)' do
|
1096
|
+
FileUtils.rm_f 'test.doc'
|
1097
|
+
FileUtils.rm_f 'test.html'
|
1098
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
1099
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1100
|
+
<preface><foreword>
|
1101
|
+
<table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
|
1102
|
+
<td rowspan="2" align="left">
|
1103
|
+
<p id="_c47d9b39-adb2-431d-9320-78cb148fdb56">Output wavelength</p>
|
1104
|
+
<p id="_c47d9b39-adb2-431d-9320-78cb148fdb57">Output wavelength</p>
|
1105
|
+
</td>
|
1106
|
+
<th colspan="3" align="right"><p id="_c47d9b39-adb2-431d-9320-78cb148fdb58">Predictive wavelengths</p></th>
|
1107
|
+
</tr>
|
1108
|
+
</thead>
|
1109
|
+
</table>
|
1110
|
+
</preface>
|
1111
|
+
</iso-standard>
|
1136
1112
|
INPUT
|
1137
|
-
word = File.read(
|
1138
|
-
|
1139
|
-
|
1113
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">')
|
1114
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
1115
|
+
.sub(/src="[^"]+"/, 'src="_"')
|
1140
1116
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1117
|
+
<div class='WordSection2' xmlns:m='m'>
|
1118
|
+
<p class='MsoNormal'>
|
1119
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1120
|
+
</p>
|
1121
|
+
<div>
|
1122
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
1123
|
+
<div align='center' class="table_container">
|
1124
|
+
<table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
1125
|
+
<a name='_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7' id='_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7'/>
|
1126
|
+
<thead>
|
1127
|
+
<tr>
|
1128
|
+
<td rowspan='2' align='left' style='border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt:solid windowtext 1.0pt;'>
|
1129
|
+
<p style='text-align: left' class='MsoNormal'>
|
1130
|
+
<a name='_c47d9b39-adb2-431d-9320-78cb148fdb56' id='_c47d9b39-adb2-431d-9320-78cb148fdb56'/>
|
1131
|
+
Output wavelength
|
1132
|
+
</p>
|
1133
|
+
<p style='text-align: left' class='MsoNormal'>
|
1134
|
+
<a name='_c47d9b39-adb2-431d-9320-78cb148fdb57' id='_c47d9b39-adb2-431d-9320-78cb148fdb57'/>
|
1135
|
+
Output wavelength
|
1136
|
+
</p>
|
1137
|
+
</td>
|
1138
|
+
<th colspan='3' align='right' 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;'>
|
1139
|
+
<p style='text-align: right' class='MsoNormal'>
|
1140
|
+
<a name='_c47d9b39-adb2-431d-9320-78cb148fdb58' id='_c47d9b39-adb2-431d-9320-78cb148fdb58'/>
|
1141
|
+
Predictive wavelengths
|
1142
|
+
</p>
|
1143
|
+
</th>
|
1144
|
+
</tr>
|
1145
|
+
</thead>
|
1146
|
+
</table>
|
1147
|
+
</div>
|
1171
1148
|
</div>
|
1149
|
+
<p class='MsoNormal'> </p>
|
1172
1150
|
</div>
|
1173
|
-
<p class='MsoNormal'> </p>
|
1174
|
-
</div>
|
1175
1151
|
OUTPUT
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
<hr/>
|
1189
|
-
<div id="boilerplate-feedback-destination"/>
|
1190
|
-
<div id="boilerplate-legal-destination"/>
|
1191
|
-
<div id="boilerplate-license-destination"/>
|
1192
|
-
<div id="boilerplate-copyright-destination"/>
|
1193
|
-
</div>
|
1194
|
-
</body>
|
1195
|
-
</html>
|
1196
|
-
INPUT
|
1197
|
-
<main class='main-section'>
|
1198
|
-
<button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
|
1152
|
+
end
|
1153
|
+
|
1154
|
+
it 'cleans up boilerplate' do
|
1155
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', filename: 'test').html_preface(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, '<main').sub(%r{</main>.*$}m, '</main>')).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1156
|
+
<html>
|
1157
|
+
<head/>
|
1158
|
+
<body>
|
1159
|
+
<div class="main-section">
|
1160
|
+
<div id="boilerplate-copyright"> <h1>Copyright</h1> </div>
|
1161
|
+
<div id="boilerplate-license"> <h1>License</h1> </div>
|
1162
|
+
<div id="boilerplate-legal"> <h1>Legal</h1> </div>
|
1163
|
+
<div id="boilerplate-feedback"> <h1>Feedback</h1> </div>
|
1199
1164
|
<hr/>
|
1200
|
-
<div id=
|
1201
|
-
|
1202
|
-
|
1203
|
-
<div id=
|
1204
|
-
<h1 class='IntroTitle'>Legal</h1>
|
1205
|
-
</div>
|
1206
|
-
<div id='boilerplate-license'>
|
1207
|
-
<h1 class='IntroTitle'>License</h1>
|
1165
|
+
<div id="boilerplate-feedback-destination"/>
|
1166
|
+
<div id="boilerplate-legal-destination"/>
|
1167
|
+
<div id="boilerplate-license-destination"/>
|
1168
|
+
<div id="boilerplate-copyright-destination"/>
|
1208
1169
|
</div>
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1170
|
+
</body>
|
1171
|
+
</html>
|
1172
|
+
INPUT
|
1173
|
+
<main class='main-section'>
|
1174
|
+
<button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
|
1175
|
+
<hr/>
|
1176
|
+
<div id='boilerplate-feedback'>
|
1177
|
+
<h1 class='IntroTitle'>Feedback</h1>
|
1178
|
+
</div>
|
1179
|
+
<div id='boilerplate-legal'>
|
1180
|
+
<h1 class='IntroTitle'>Legal</h1>
|
1181
|
+
</div>
|
1182
|
+
<div id='boilerplate-license'>
|
1183
|
+
<h1 class='IntroTitle'>License</h1>
|
1184
|
+
</div>
|
1185
|
+
<div id='boilerplate-copyright'>
|
1186
|
+
<h1 class='IntroTitle'>Copyright</h1>
|
1187
|
+
</div>
|
1188
|
+
</main>
|
1213
1189
|
OUTPUT
|
1214
1190
|
end
|
1215
1191
|
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
<hr/>
|
1227
|
-
<div id="boilerplate-feedback-destination"/>
|
1228
|
-
<div id="boilerplate-legal-destination"/>
|
1229
|
-
<div id="boilerplate-license-destination"/>
|
1230
|
-
<div id="boilerplate-copyright-destination"/>
|
1231
|
-
</div>
|
1232
|
-
</body>
|
1233
|
-
</html>
|
1234
|
-
INPUT
|
1235
|
-
<html>
|
1236
|
-
<head/>
|
1237
|
-
<body>
|
1238
|
-
<div class='main-section'>
|
1192
|
+
it 'cleans up boilerplate (Word)' do
|
1193
|
+
expect(xmlpp(IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', filename: 'test').word_cleanup(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, '<main').sub(%r{</main>.*$}m, '</main>')).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1194
|
+
<html>
|
1195
|
+
<head/>
|
1196
|
+
<body>
|
1197
|
+
<div class="main-section">
|
1198
|
+
<div id="boilerplate-copyright"> <h1>Copyright</h1> </div>
|
1199
|
+
<div id="boilerplate-license"> <h1>License</h1> </div>
|
1200
|
+
<div id="boilerplate-legal"> <h1>Legal</h1> </div>
|
1201
|
+
<div id="boilerplate-feedback"> <h1>Feedback</h1> </div>
|
1239
1202
|
<hr/>
|
1240
|
-
<div id=
|
1241
|
-
|
1203
|
+
<div id="boilerplate-feedback-destination"/>
|
1204
|
+
<div id="boilerplate-legal-destination"/>
|
1205
|
+
<div id="boilerplate-license-destination"/>
|
1206
|
+
<div id="boilerplate-copyright-destination"/>
|
1242
1207
|
</div>
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
<
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1208
|
+
</body>
|
1209
|
+
</html>
|
1210
|
+
INPUT
|
1211
|
+
<html>
|
1212
|
+
<head/>
|
1213
|
+
<body>
|
1214
|
+
<div class='main-section'>
|
1215
|
+
<hr/>
|
1216
|
+
<div id='boilerplate-feedback'>
|
1217
|
+
<p class='TitlePageSubhead'>Feedback</p>
|
1218
|
+
</div>
|
1219
|
+
<div id='boilerplate-legal'>
|
1220
|
+
<p class='TitlePageSubhead'>Legal</p>
|
1221
|
+
</div>
|
1222
|
+
<div id='boilerplate-license'>
|
1223
|
+
<p class='TitlePageSubhead'>License</p>
|
1224
|
+
</div>
|
1225
|
+
<div id='boilerplate-copyright'>
|
1226
|
+
<p class='TitlePageSubhead'>Copyright</p>
|
1227
|
+
</div>
|
1228
|
+
</div>
|
1229
|
+
</body>
|
1230
|
+
</html>
|
1255
1231
|
OUTPUT
|
1256
1232
|
end
|
1257
1233
|
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
<thead>
|
1298
|
-
<tr>
|
1299
|
-
<th align="left">A</th>
|
1300
|
-
<th align="left">B</th>
|
1301
|
-
</tr>
|
1302
|
-
</thead>
|
1303
|
-
<tbody>
|
1304
|
-
<tr>
|
1305
|
-
<td align="left">C</td>
|
1306
|
-
<td align="left">D</td>
|
1307
|
-
</tr>
|
1308
|
-
</tbody>
|
1309
|
-
<note id="_8fff1596-290e-4314-b03c-7a8aab97eebe">
|
1310
|
-
<p id="_32c22439-387a-48cf-a006-5ab3b934ba73">B</p>
|
1311
|
-
</note></table>
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1234
|
+
it 'deals with landscape and portrait pagebreaks (Word)' do
|
1235
|
+
FileUtils.rm_f 'test.doc'
|
1236
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', filename: 'test').convert('test', <<~"INPUT", false)
|
1237
|
+
<standard-document xmlns="http://riboseinc.com/isoxml">
|
1238
|
+
<bibdata type="standard">
|
1239
|
+
<title language="en" format="text/plain">Document title</title>
|
1240
|
+
<version>
|
1241
|
+
<draft>1.2</draft>
|
1242
|
+
</version>
|
1243
|
+
<language>en</language>
|
1244
|
+
<script>Latn</script>
|
1245
|
+
<status><stage>published</stage></status>
|
1246
|
+
<ext>
|
1247
|
+
<doctype>article</doctype>
|
1248
|
+
</ext>
|
1249
|
+
</bibdata>
|
1250
|
+
<preface>
|
1251
|
+
<introduction><title>Preface 1</title>
|
1252
|
+
<p align="center">This is a <pagebreak orientation="landscape"/> paragraph</p>
|
1253
|
+
<table>
|
1254
|
+
<tbody>
|
1255
|
+
<tr><td>A</td><td>B</td></tr>
|
1256
|
+
</tbody>
|
1257
|
+
</table>
|
1258
|
+
<clause><title>Preface 1.1</title>
|
1259
|
+
<p>On my side</p>
|
1260
|
+
<pagebreak orientation="portrait"/>
|
1261
|
+
<p>Upright again</p>
|
1262
|
+
</clause>
|
1263
|
+
<clause><title>Preface 1.3</title>
|
1264
|
+
<p>And still upright</p>
|
1265
|
+
</clause>
|
1266
|
+
</introduction>
|
1267
|
+
</preface>
|
1268
|
+
<sections><clause><title>Foreword</title>
|
1269
|
+
<note>
|
1270
|
+
<p id="_">For further information on the Foreword, see <strong>ISO/IEC Directives, Part 2, 2016, Clause 12.</strong></p>
|
1271
|
+
<pagebreak orientation="landscape"/>
|
1272
|
+
<table id="_c09a7e60-b0c7-4418-9bfc-2ef0bc09a249">
|
1273
|
+
<thead>
|
1274
|
+
<tr>
|
1275
|
+
<th align="left">A</th>
|
1276
|
+
<th align="left">B</th>
|
1277
|
+
</tr>
|
1278
|
+
</thead>
|
1279
|
+
<tbody>
|
1280
|
+
<tr>
|
1281
|
+
<td align="left">C</td>
|
1282
|
+
<td align="left">D</td>
|
1283
|
+
</tr>
|
1284
|
+
</tbody>
|
1285
|
+
<note id="_8fff1596-290e-4314-b03c-7a8aab97eebe">
|
1286
|
+
<p id="_32c22439-387a-48cf-a006-5ab3b934ba73">B</p>
|
1287
|
+
</note></table>
|
1288
|
+
<pagebreak orientation="portrait"/>
|
1289
|
+
<p>And up</p>
|
1290
|
+
</note>
|
1291
|
+
<pagebreak orientation="portrait"/>
|
1292
|
+
</clause></sections>
|
1293
|
+
<annex id="_level_1" inline-header="false" obligation="normative">
|
1294
|
+
<title>Annex 1</title>
|
1295
|
+
</annex>
|
1296
|
+
</standard-document>
|
1321
1297
|
INPUT
|
1322
|
-
|
1323
|
-
html = File.read(
|
1324
|
-
expect(html).to include
|
1325
|
-
expect(html).to include
|
1326
|
-
expect(html).to include
|
1327
|
-
expect(html).to include
|
1328
|
-
expect(html).to include
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
</div>
|
1336
|
-
<p class='MsoNormal'>
|
1337
|
-
<br clear='all' class='section'/>
|
1338
|
-
</p>
|
1339
|
-
<div class='WordSection2'>
|
1340
|
-
<p class='MsoNormal'>
|
1341
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1342
|
-
</p>
|
1343
|
-
<div class='Section3' id=''>
|
1344
|
-
<h1 class='IntroTitle'>Introduction</h1>
|
1345
|
-
<p align='center' style='text-align:center;' class='MsoNormal'>
|
1346
|
-
This is a
|
1298
|
+
expect(File.exist?('test.doc')).to be true
|
1299
|
+
html = File.read('test.doc', encoding: 'UTF-8')
|
1300
|
+
expect(html).to include 'div.WordSection2_0 {page:WordSection2P;}'
|
1301
|
+
expect(html).to include 'div.WordSection2_1 {page:WordSection2L;}'
|
1302
|
+
expect(html).to include 'div.WordSection3_0 {page:WordSection3P;}'
|
1303
|
+
expect(html).to include 'div.WordSection3_1 {page:WordSection3P;}'
|
1304
|
+
expect(html).to include 'div.WordSection3_2 {page:WordSection3L;}'
|
1305
|
+
|
1306
|
+
expect(xmlpp(html.sub(/^.*<body /m, '<body ').sub(%r{</body>.*$}m, '</body>'))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1307
|
+
<body lang='EN-US' xml:lang='EN-US' link='blue' vlink='#954F72'>
|
1308
|
+
<div class='WordSection1'>
|
1309
|
+
<p class='MsoNormal'> </p>
|
1310
|
+
</div>
|
1347
1311
|
<p class='MsoNormal'>
|
1348
1312
|
<br clear='all' class='section'/>
|
1349
1313
|
</p>
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
<
|
1391
|
-
|
1392
|
-
|
1393
|
-
<b>ISO/IEC Directives, Part 2, 2016, Clause 12.</b>
|
1394
|
-
</p>
|
1395
|
-
<p class='Note'>
|
1314
|
+
<div class='WordSection2'>
|
1315
|
+
<p class='MsoNormal'>
|
1316
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1317
|
+
</p>
|
1318
|
+
<div class='Section3' id=''>
|
1319
|
+
<h1 class='IntroTitle'>Introduction</h1>
|
1320
|
+
<p align='center' style='text-align:center;' class='MsoNormal'>
|
1321
|
+
This is a
|
1322
|
+
<p class='MsoNormal'>
|
1323
|
+
<br clear='all' class='section'/>
|
1324
|
+
</p>
|
1325
|
+
paragraph
|
1326
|
+
</p>
|
1327
|
+
</div>
|
1328
|
+
</div>
|
1329
|
+
<div class='WordSection2_1'>
|
1330
|
+
<div align='center' class='table_container'>
|
1331
|
+
<table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
1332
|
+
<tbody>
|
1333
|
+
<tr>
|
1334
|
+
<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;'>A</td>
|
1335
|
+
<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;'>B</td>
|
1336
|
+
</tr>
|
1337
|
+
</tbody>
|
1338
|
+
</table>
|
1339
|
+
</div>
|
1340
|
+
<div>
|
1341
|
+
<h1>Preface 1.1</h1>
|
1342
|
+
<p class='MsoNormal'>On my side</p>
|
1343
|
+
<p class='MsoNormal'>
|
1344
|
+
<br clear='all' class='section'/>
|
1345
|
+
</p>
|
1346
|
+
</div>
|
1347
|
+
</div>
|
1348
|
+
<div class='WordSection2_0'>
|
1349
|
+
<p class='MsoNormal'>Upright again</p>
|
1350
|
+
<div>
|
1351
|
+
<h1>Preface 1.3</h1>
|
1352
|
+
<p class='MsoNormal'>And still upright</p>
|
1353
|
+
</div>
|
1354
|
+
<p class='MsoNormal'> </p>
|
1355
|
+
</div>
|
1356
|
+
<p class='MsoNormal'>
|
1396
1357
|
<br clear='all' class='section'/>
|
1397
1358
|
</p>
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
</
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1359
|
+
<div class='WordSection3'>
|
1360
|
+
<p class='zzSTDTitle1'>Document title</p>
|
1361
|
+
<div>
|
1362
|
+
<h1>Foreword</h1>
|
1363
|
+
<div class='Note'>
|
1364
|
+
<p class='Note'>
|
1365
|
+
<span class='note_label'>NOTE 1</span>
|
1366
|
+
<span style='mso-tab-count:1'>  </span>
|
1367
|
+
For further information on the Foreword, see
|
1368
|
+
<b>ISO/IEC Directives, Part 2, 2016, Clause 12.</b>
|
1369
|
+
</p>
|
1370
|
+
<p class='Note'>
|
1371
|
+
<br clear='all' class='section'/>
|
1372
|
+
</p>
|
1373
|
+
</div>
|
1374
|
+
</div>
|
1375
|
+
</div>
|
1376
|
+
<div class='WordSection3_2'>
|
1377
|
+
<p class='TableTitle' style='text-align:center;'>Table 1</p>
|
1378
|
+
<div align='center' class='table_container'>
|
1379
|
+
<table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
1380
|
+
<a name='_c09a7e60-b0c7-4418-9bfc-2ef0bc09a249' id='_c09a7e60-b0c7-4418-9bfc-2ef0bc09a249'/>
|
1381
|
+
<thead>
|
1382
|
+
<tr>
|
1383
|
+
<th align='left' 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;'>A</th>
|
1384
|
+
<th align='left' 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;'>B</th>
|
1385
|
+
</tr>
|
1386
|
+
</thead>
|
1387
|
+
<tbody>
|
1388
|
+
<tr>
|
1389
|
+
<td align='left' 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;'>C</td>
|
1390
|
+
<td align='left' 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;'>D</td>
|
1391
|
+
</tr>
|
1392
|
+
</tbody>
|
1393
|
+
<tfoot>
|
1394
|
+
<tr>
|
1395
|
+
<td colspan='2' style='border-top:0pt;mso-border-top-alt:0pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>
|
1396
|
+
<div class='Note'>
|
1397
|
+
<a name='_8fff1596-290e-4314-b03c-7a8aab97eebe' id='_8fff1596-290e-4314-b03c-7a8aab97eebe'/>
|
1398
|
+
<p class='Note'>
|
1399
|
+
<span class='note_label'>NOTE</span>
|
1400
|
+
<span style='mso-tab-count:1'>  </span>
|
1401
|
+
B
|
1402
|
+
</p>
|
1403
|
+
</div>
|
1404
|
+
</td>
|
1405
|
+
</tr>
|
1406
|
+
</tfoot>
|
1407
|
+
</table>
|
1408
|
+
</div>
|
1409
|
+
<p class='Note'>
|
1410
|
+
<br clear='all' class='section'/>
|
1411
|
+
</p>
|
1412
|
+
</div>
|
1413
|
+
<div class='WordSection3_1'>
|
1414
|
+
<p class='Note'>And up</p>
|
1415
|
+
<p class='MsoNormal'>
|
1416
|
+
<br clear='all' class='section'/>
|
1417
|
+
</p>
|
1418
|
+
</div>
|
1419
|
+
<div class='WordSection3_0'>
|
1420
|
+
<div class='Section3'>
|
1421
|
+
<a name='_level_1' id='_level_1'/>
|
1422
|
+
<h1 class='Annex'>
|
1423
|
+
<b>Annex A</b>
|
1424
|
+
<br/>
|
1425
|
+
(normative)
|
1426
|
+
<br/>
|
1427
|
+
<br/>
|
1428
|
+
<b>Annex 1</b>
|
1429
|
+
</h1>
|
1456
1430
|
</div>
|
1457
|
-
|
1458
|
-
|
1431
|
+
</div>
|
1432
|
+
<div style='mso-element:footnote-list'/>
|
1433
|
+
</body>
|
1459
1434
|
OUTPUT
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
<table id="_a0f8c202-fd34-460c-bd5e-b2f4cc29210d" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 1-1:</p></th></tr></thead><tbody><tr style="background:#C9C9C9;"><td style="vertical-align:top;" class="recommend" colspan="2">
|
1471
|
-
<p id="_2e2c247b-ce4c-48c5-96dd-f3e090a5b4a7">Description text</p>
|
1472
|
-
</td></tr></tbody></table>
|
1473
|
-
</tbody></table>
|
1474
|
-
</div>
|
1475
|
-
|
1476
|
-
|
1477
|
-
<table id="_9846c486-14e5-4b1c-bb2f-55cc254dd309" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 2:</p></th></tr></thead><tbody><tr><td style="vertical-align:top;" class="recommend" colspan="2"><p>requirement label</p></td></tr><table id="_62de974c-7128-44d6-ba86-99f818f1d467" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 2-1:</p></th></tr></thead><tbody><tr style="background:#C9C9C9;"><td style="vertical-align:top;" class="recommend" colspan="2">
|
1478
|
-
<p id="_30b90b08-bd71-4497-bbcc-8c61fbb9f772">Description text</p>
|
1479
|
-
</td></tr></tbody></table>
|
1480
|
-
<table id="_fede5681-71f6-47bb-bc65-7bd0b11acd01" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 2-2:</p></th></tr></thead><tbody><tr><td style="vertical-align:top;" class="recommend" colspan="2">
|
1481
|
-
<p id="_8daa3d74-90fd-4a57-9169-de457a68cfda">Description text</p>
|
1482
|
-
</td></tr></tbody></table></tbody></table>
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1435
|
+
end
|
1436
|
+
|
1437
|
+
it 'expands out nested tables in Word' do
|
1438
|
+
expect(xmlpp(IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', filename: 'test').word_cleanup(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, '<main').sub(%r{</main>.*$}m, '</main>')).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1439
|
+
<html>
|
1440
|
+
<head/>
|
1441
|
+
<body>
|
1442
|
+
<div class="main-section">
|
1443
|
+
<table id="_7830dff8-419e-4b9e-85cf-a063689f44ca" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 1:</p></th></tr></thead><tbody><tr><td style="vertical-align:top;" class="recommend" colspan="2"><p>requirement label</p></td></tr>
|
1444
|
+
|
1445
|
+
<table id="_a0f8c202-fd34-460c-bd5e-b2f4cc29210d" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 1-1:</p></th></tr></thead><tbody><tr style="background:#C9C9C9;"><td style="vertical-align:top;" class="recommend" colspan="2">
|
1446
|
+
<p id="_2e2c247b-ce4c-48c5-96dd-f3e090a5b4a7">Description text</p>
|
1447
|
+
</td></tr></tbody></table>
|
1448
|
+
</tbody></table>
|
1449
|
+
</div>
|
1450
|
+
<div id="_second_sample"><h2>1.2.<span style="mso-tab-count:1">  </span>Second sample</h2>
|
1451
|
+
|
1452
|
+
<table id="_9846c486-14e5-4b1c-bb2f-55cc254dd309" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 2:</p></th></tr></thead><tbody><tr><td style="vertical-align:top;" class="recommend" colspan="2"><p>requirement label</p></td></tr><table id="_62de974c-7128-44d6-ba86-99f818f1d467" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 2-1:</p></th></tr></thead><tbody><tr style="background:#C9C9C9;"><td style="vertical-align:top;" class="recommend" colspan="2">
|
1453
|
+
<p id="_30b90b08-bd71-4497-bbcc-8c61fbb9f772">Description text</p>
|
1454
|
+
</td></tr></tbody></table>
|
1455
|
+
<table id="_fede5681-71f6-47bb-bc65-7bd0b11acd01" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 2-2:</p></th></tr></thead><tbody><tr><td style="vertical-align:top;" class="recommend" colspan="2">
|
1456
|
+
<p id="_8daa3d74-90fd-4a57-9169-de457a68cfda">Description text</p>
|
1457
|
+
</td></tr></tbody></table></tbody></table>
|
1458
|
+
</div>
|
1459
|
+
</body>
|
1460
|
+
</html>
|
1486
1461
|
INPUT
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
</html>
|
1462
|
+
<html>
|
1463
|
+
<head/>
|
1464
|
+
<body>
|
1465
|
+
<div class='main-section'>
|
1466
|
+
<table id='_7830dff8-419e-4b9e-85cf-a063689f44ca' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
|
1467
|
+
<thead>
|
1468
|
+
<tr style='background:#A5A5A5;'>
|
1469
|
+
<th style='vertical-align:top;' class='recommend' colspan='2'>
|
1470
|
+
<p class='RecommendationTitle'>Requirement 1:</p>
|
1471
|
+
</th>
|
1472
|
+
</tr>
|
1473
|
+
</thead>
|
1474
|
+
<tbody>
|
1475
|
+
<tr>
|
1476
|
+
<td style='vertical-align:top;' class='recommend' colspan='2'>
|
1477
|
+
<p>requirement label</p>
|
1478
|
+
</td>
|
1479
|
+
</tr>
|
1480
|
+
</tbody>
|
1481
|
+
</table>
|
1482
|
+
<table id='_a0f8c202-fd34-460c-bd5e-b2f4cc29210d' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
|
1483
|
+
<thead>
|
1484
|
+
<tr style='background:#A5A5A5;'>
|
1485
|
+
<th style='vertical-align:top;' class='recommend' colspan='2'>
|
1486
|
+
<p class='RecommendationTitle'>Requirement 1-1:</p>
|
1487
|
+
</th>
|
1488
|
+
</tr>
|
1489
|
+
</thead>
|
1490
|
+
<tbody>
|
1491
|
+
<tr style='background:#C9C9C9;'>
|
1492
|
+
<td style='vertical-align:top;' class='recommend' colspan='2'>
|
1493
|
+
<p id='_2e2c247b-ce4c-48c5-96dd-f3e090a5b4a7'>Description text</p>
|
1494
|
+
</td>
|
1495
|
+
</tr>
|
1496
|
+
</tbody>
|
1497
|
+
</table>
|
1498
|
+
</div>
|
1499
|
+
<div id='_second_sample'>
|
1500
|
+
<h2>
|
1501
|
+
1.2.
|
1502
|
+
<span style='mso-tab-count:1'>  </span>
|
1503
|
+
Second sample
|
1504
|
+
</h2>
|
1505
|
+
<table id='_9846c486-14e5-4b1c-bb2f-55cc254dd309' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
|
1506
|
+
<thead>
|
1507
|
+
<tr style='background:#A5A5A5;'>
|
1508
|
+
<th style='vertical-align:top;' class='recommend' colspan='2'>
|
1509
|
+
<p class='RecommendationTitle'>Requirement 2:</p>
|
1510
|
+
</th>
|
1511
|
+
</tr>
|
1512
|
+
</thead>
|
1513
|
+
<tbody>
|
1514
|
+
<tr>
|
1515
|
+
<td style='vertical-align:top;' class='recommend' colspan='2'>
|
1516
|
+
<p>requirement label</p>
|
1517
|
+
</td>
|
1518
|
+
</tr>
|
1519
|
+
</tbody>
|
1520
|
+
</table>
|
1521
|
+
<table id='_62de974c-7128-44d6-ba86-99f818f1d467' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
|
1522
|
+
<thead>
|
1523
|
+
<tr style='background:#A5A5A5;'>
|
1524
|
+
<th style='vertical-align:top;' class='recommend' colspan='2'>
|
1525
|
+
<p class='RecommendationTitle'>Requirement 2-1:</p>
|
1526
|
+
</th>
|
1527
|
+
</tr>
|
1528
|
+
</thead>
|
1529
|
+
<tbody>
|
1530
|
+
<tr style='background:#C9C9C9;'>
|
1531
|
+
<td style='vertical-align:top;' class='recommend' colspan='2'>
|
1532
|
+
<p id='_30b90b08-bd71-4497-bbcc-8c61fbb9f772'>Description text</p>
|
1533
|
+
</td>
|
1534
|
+
</tr>
|
1535
|
+
</tbody>
|
1536
|
+
</table>
|
1537
|
+
<table id='_fede5681-71f6-47bb-bc65-7bd0b11acd01' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
|
1538
|
+
<thead>
|
1539
|
+
<tr style='background:#A5A5A5;'>
|
1540
|
+
<th style='vertical-align:top;' class='recommend' colspan='2'>
|
1541
|
+
<p class='RecommendationTitle'>Requirement 2-2:</p>
|
1542
|
+
</th>
|
1543
|
+
</tr>
|
1544
|
+
</thead>
|
1545
|
+
<tbody>
|
1546
|
+
<tr>
|
1547
|
+
<td style='vertical-align:top;' class='recommend' colspan='2'>
|
1548
|
+
<p id='_8daa3d74-90fd-4a57-9169-de457a68cfda'>Description text</p>
|
1549
|
+
</td>
|
1550
|
+
</tr>
|
1551
|
+
</tbody>
|
1552
|
+
</table>
|
1553
|
+
</div>
|
1554
|
+
</body>
|
1555
|
+
</html>
|
1581
1556
|
OUTPUT
|
1582
|
-
|
1583
|
-
|
1557
|
+
end
|
1584
1558
|
end
|