isodoc 1.6.3 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +2 -12
- data/.hound.yml +3 -1
- data/.rubocop.yml +3 -5
- data/isodoc.gemspec +1 -1
- data/lib/isodoc.rb +0 -2
- data/lib/isodoc/convert.rb +4 -0
- data/lib/isodoc/function/cleanup.rb +52 -43
- data/lib/isodoc/function/inline.rb +7 -7
- data/lib/isodoc/function/section.rb +29 -16
- data/lib/isodoc/function/to_word_html.rb +6 -3
- data/lib/isodoc/function/utils.rb +181 -163
- data/lib/isodoc/headlesshtml_convert.rb +8 -7
- data/lib/isodoc/html_function/comments.rb +2 -0
- data/lib/isodoc/html_function/footnotes.rb +14 -7
- data/lib/isodoc/html_function/html.rb +30 -26
- data/lib/isodoc/html_function/postprocess.rb +16 -13
- data/lib/isodoc/pdf_convert.rb +11 -13
- data/lib/isodoc/presentation_function/bibdata.rb +43 -22
- data/lib/isodoc/presentation_function/inline.rb +20 -15
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/postprocess.rb +50 -36
- data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
- data/lib/isodoc/xref/xref_sect_gen.rb +4 -4
- data/spec/assets/scripts_override.html +3 -0
- data/spec/isodoc/blocks_spec.rb +196 -245
- data/spec/isodoc/inline_spec.rb +442 -289
- data/spec/isodoc/postproc_spec.rb +111 -50
- data/spec/isodoc/presentation_xml_spec.rb +354 -277
- data/spec/isodoc/terms_spec.rb +83 -83
- metadata +5 -4
data/lib/isodoc/version.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
require "fileutils"
|
2
|
-
require_relative "./postprocess_cover
|
2
|
+
require_relative "./postprocess_cover"
|
3
3
|
|
4
4
|
module IsoDoc::WordFunction
|
5
5
|
module Postprocess
|
6
6
|
# add namespaces for Word fragments
|
7
7
|
WORD_NOKOHEAD = <<~HERE.freeze
|
8
|
-
|
9
|
-
|
10
|
-
xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"
|
11
|
-
xmlns:w="urn:schemas-microsoft-com:office:word"
|
12
|
-
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
13
|
-
|
14
|
-
|
8
|
+
<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
9
|
+
<html xmlns="http://www.w3.org/1999/xhtml"
|
10
|
+
xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"
|
11
|
+
xmlns:w="urn:schemas-microsoft-com:office:word"
|
12
|
+
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
13
|
+
<head> <title></title> <meta charset="UTF-8" /> </head>
|
14
|
+
<body> </body> </html>
|
15
15
|
HERE
|
16
16
|
|
17
17
|
def to_word_xhtml_fragment(xml)
|
@@ -22,7 +22,8 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
22
22
|
def table_note_cleanup(docxml)
|
23
23
|
super
|
24
24
|
# preempt html2doc putting MsoNormal there
|
25
|
-
docxml.xpath("//p[not(self::*[@class])][ancestor::*[@class = 'Note']]")
|
25
|
+
docxml.xpath("//p[not(self::*[@class])][ancestor::*[@class = 'Note']]")
|
26
|
+
.each do |p|
|
26
27
|
p["class"] = "Note"
|
27
28
|
end
|
28
29
|
end
|
@@ -38,16 +39,21 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
38
39
|
def toWord(result, filename, dir, header)
|
39
40
|
result = from_xhtml(word_cleanup(to_xhtml(result)))
|
40
41
|
@wordstylesheet = wordstylesheet_update
|
41
|
-
Html2Doc.process(
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
Html2Doc.process(
|
43
|
+
result,
|
44
|
+
filename: filename,
|
45
|
+
stylesheet: @wordstylesheet&.path,
|
46
|
+
header_file: header&.path, dir: dir,
|
47
|
+
asciimathdelims: [@openmathdelim, @closemathdelim],
|
48
|
+
liststyles: { ul: @ulstyle, ol: @olstyle }
|
49
|
+
)
|
45
50
|
header&.unlink
|
46
|
-
@wordstylesheet
|
51
|
+
@wordstylesheet.unlink if @wordstylesheet.is_a?(Tempfile)
|
47
52
|
end
|
48
53
|
|
49
|
-
def wordstylesheet_update
|
54
|
+
def wordstylesheet_update
|
50
55
|
return if @wordstylesheet.nil?
|
56
|
+
|
51
57
|
f = File.open(@wordstylesheet.path, "a")
|
52
58
|
@landscapestyle.empty? or f.write(@landscapestyle)
|
53
59
|
if @wordstylesheet_override && @wordstylesheet
|
@@ -62,7 +68,8 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
62
68
|
|
63
69
|
def word_admonition_images(docxml)
|
64
70
|
docxml.xpath("//div[@class = 'Admonition']//img").each do |i|
|
65
|
-
i["width"], i["height"] =
|
71
|
+
i["width"], i["height"] =
|
72
|
+
Html2Doc.image_resize(i, image_localfile(i), @maxheight, 300)
|
66
73
|
end
|
67
74
|
end
|
68
75
|
|
@@ -88,21 +95,23 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
88
95
|
cells2d = {}
|
89
96
|
docxml.xpath("//table[colgroup]").each do |t|
|
90
97
|
w = colgroup_widths(t)
|
91
|
-
t.xpath(".//tr").each_with_index { |
|
98
|
+
t.xpath(".//tr").each_with_index { |_tr, r| cells2d[r] = {} }
|
92
99
|
t.xpath(".//tr").each_with_index do |tr, r|
|
93
|
-
tr.xpath("./td | ./th").each_with_index do |td,
|
100
|
+
tr.xpath("./td | ./th").each_with_index do |td, _i|
|
94
101
|
x = 0
|
95
102
|
rs = td&.attr("rowspan")&.to_i || 1
|
96
103
|
cs = td&.attr("colspan")&.to_i || 1
|
97
|
-
while cells2d[r][x]
|
98
|
-
x += 1
|
104
|
+
while cells2d[r][x]
|
105
|
+
x += 1
|
99
106
|
end
|
100
|
-
|
101
|
-
|
107
|
+
(r..(r + rs - 1)).each do |y2|
|
108
|
+
(x..(x + cs - 1)).each do |x2|
|
102
109
|
cells2d[y2][x2] = 1
|
103
110
|
end
|
104
111
|
end
|
105
|
-
width = (x..(x+cs-1)).each_with_object({width: 0})
|
112
|
+
width = (x..(x + cs - 1)).each_with_object({ width: 0 }) do |z, m|
|
113
|
+
m[:width] += w[z]
|
114
|
+
end
|
106
115
|
td["width"] = "#{width[:width]}%"
|
107
116
|
x += cs
|
108
117
|
end
|
@@ -111,8 +120,8 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
111
120
|
end
|
112
121
|
|
113
122
|
# assume percentages
|
114
|
-
def colgroup_widths(
|
115
|
-
|
123
|
+
def colgroup_widths(table)
|
124
|
+
table.xpath("./colgroup/col").each_with_object([]) do |c, m|
|
116
125
|
m << c["width"].sub(/%$/, "").to_f
|
117
126
|
end
|
118
127
|
end
|
@@ -127,12 +136,13 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
127
136
|
|
128
137
|
def style_update(node, css)
|
129
138
|
return unless node
|
130
|
-
|
139
|
+
|
140
|
+
node["style"] = node["style"] ? node["style"].sub(/;?$/, ";#{css}") : css
|
131
141
|
end
|
132
142
|
|
133
143
|
def word_image_caption(docxml)
|
134
|
-
docxml.xpath("//p[@class = 'FigureTitle' or @class = 'SourceTitle']")
|
135
|
-
each do |t|
|
144
|
+
docxml.xpath("//p[@class = 'FigureTitle' or @class = 'SourceTitle']")
|
145
|
+
.each do |t|
|
136
146
|
if t&.previous_element&.name == "img"
|
137
147
|
img = t.previous_element
|
138
148
|
t.previous_element.swap("<p class=\'figure\'>#{img.to_xml}</p>")
|
@@ -150,7 +160,8 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
150
160
|
xpath.each do |list|
|
151
161
|
(list.xpath(".//li") - list.xpath(".//ol//li | .//ul//li")).each do |l|
|
152
162
|
l.xpath("./p | ./div | ./table").each_with_index do |p, i|
|
153
|
-
next if i
|
163
|
+
next if i.zero?
|
164
|
+
|
154
165
|
p.wrap(%{<div class="ListContLevel#{lvl}"/>})
|
155
166
|
end
|
156
167
|
list_add(l.xpath(".//ul") - l.xpath(".//ul//ul | .//ol//ul"), lvl + 1)
|
@@ -162,20 +173,21 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
162
173
|
def word_table_align(docxml)
|
163
174
|
docxml.xpath("//td[@align]/p | //th[@align]/p").each do |p|
|
164
175
|
next if p["align"]
|
165
|
-
|
176
|
+
|
177
|
+
style_update(p, "text-align: #{p.parent['align']}")
|
166
178
|
end
|
167
179
|
end
|
168
180
|
|
169
181
|
def word_table_separator(docxml)
|
170
182
|
docxml.xpath("//p[@class = 'TableTitle']").each do |t|
|
171
183
|
next unless t.children.empty?
|
184
|
+
|
172
185
|
t["style"] = t["style"].sub(/;?$/, ";font-size:0pt;")
|
173
186
|
t.children = " "
|
174
187
|
end
|
175
188
|
end
|
176
189
|
|
177
|
-
def word_annex_cleanup(docxml)
|
178
|
-
end
|
190
|
+
def word_annex_cleanup(docxml); end
|
179
191
|
|
180
192
|
def word_example_cleanup(docxml)
|
181
193
|
docxml.xpath("//div[@class = 'example']//p[not(@class)]").each do |p|
|
@@ -194,19 +206,21 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
194
206
|
docxml.xpath("//div[p/br]").each do |d|
|
195
207
|
/^WordSection\d+_\d+$/.match(d["class"]) or next
|
196
208
|
d.elements[0].name == "p" && !d.elements[0].elements.empty? or next
|
197
|
-
d.elements[0].elements[0].name == "br" &&
|
198
|
-
"
|
209
|
+
d.elements[0].elements[0].name == "br" &&
|
210
|
+
d.elements[0].elements[0]["style"] ==
|
211
|
+
"mso-special-character:line-break;page-break-before:always" or next
|
199
212
|
d.elements[0].remove
|
200
213
|
end
|
201
214
|
end
|
202
215
|
|
203
216
|
def word_footnote_format(docxml)
|
204
|
-
# the content is in a[@epub:type = 'footnote']//sup, but in Word,
|
217
|
+
# the content is in a[@epub:type = 'footnote']//sup, but in Word,
|
205
218
|
# we need to inject content around the autonumbered footnote reference
|
206
219
|
docxml.xpath("//a[@epub:type = 'footnote']").each do |x|
|
207
220
|
footnote_reference_format(x)
|
208
221
|
end
|
209
|
-
docxml.xpath("//a[@class = 'TableFootnoteRef'] |
|
222
|
+
docxml.xpath("//a[@class = 'TableFootnoteRef'] | "\
|
223
|
+
"//span[@class = 'TableFootnoteRef']").each do |x|
|
210
224
|
table_footnote_reference_format(x)
|
211
225
|
end
|
212
226
|
docxml
|
@@ -8,25 +8,27 @@ module IsoDoc::XrefGen
|
|
8
8
|
"-"
|
9
9
|
end
|
10
10
|
|
11
|
-
def subfigure_increment(
|
12
|
-
if
|
11
|
+
def subfigure_increment(idx, counter, elem)
|
12
|
+
if elem.parent.name == "figure" then idx += 1
|
13
13
|
else
|
14
|
-
|
15
|
-
|
14
|
+
idx = 0
|
15
|
+
counter.increment(elem)
|
16
16
|
end
|
17
|
-
|
17
|
+
idx
|
18
18
|
end
|
19
19
|
|
20
20
|
def sequential_figure_names(clause)
|
21
21
|
c = Counter.new
|
22
22
|
j = 0
|
23
|
-
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
|
24
|
-
each do |t|
|
23
|
+
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
|
24
|
+
.each do |t|
|
25
25
|
j = subfigure_increment(j, c, t)
|
26
26
|
label = c.print + (j.zero? ? "" : "-#{j}")
|
27
27
|
next if t["id"].nil? || t["id"].empty?
|
28
|
-
|
29
|
-
|
28
|
+
|
29
|
+
@anchors[t["id"]] = anchor_struct(
|
30
|
+
label, nil, @labels["figure"], "figure", t["unnumbered"]
|
31
|
+
)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
@@ -34,8 +36,11 @@ module IsoDoc::XrefGen
|
|
34
36
|
c = Counter.new
|
35
37
|
clause.xpath(ns(".//table")).each do |t|
|
36
38
|
next if t["id"].nil? || t["id"].empty?
|
37
|
-
|
38
|
-
|
39
|
+
|
40
|
+
@anchors[t["id"]] = anchor_struct(
|
41
|
+
c.increment(t).print, nil,
|
42
|
+
@labels["table"], "table", t["unnumbered"]
|
43
|
+
)
|
39
44
|
end
|
40
45
|
end
|
41
46
|
|
@@ -43,10 +48,12 @@ module IsoDoc::XrefGen
|
|
43
48
|
c = Counter.new
|
44
49
|
clause.xpath(ns(".//formula")).each do |t|
|
45
50
|
next if t["id"].nil? || t["id"].empty?
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
51
|
+
|
52
|
+
@anchors[t["id"]] = anchor_struct(
|
53
|
+
c.increment(t).print, t,
|
54
|
+
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
55
|
+
"formula", t["unnumbered"]
|
56
|
+
)
|
50
57
|
end
|
51
58
|
end
|
52
59
|
|
@@ -57,22 +64,27 @@ module IsoDoc::XrefGen
|
|
57
64
|
c = Counter.new
|
58
65
|
clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
|
59
66
|
next if t["id"].nil? || t["id"].empty?
|
67
|
+
|
60
68
|
id = c.increment(t).print
|
61
69
|
@anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
|
62
70
|
sequential_permission_names2(t, id)
|
63
71
|
end
|
64
72
|
end
|
65
73
|
|
66
|
-
def sequential_permission_names2(
|
67
|
-
sequential_permission_names1(
|
68
|
-
|
69
|
-
sequential_permission_names1(
|
74
|
+
def sequential_permission_names2(elem, ident)
|
75
|
+
sequential_permission_names1(elem, ident, "permission",
|
76
|
+
@labels["permission"])
|
77
|
+
sequential_permission_names1(elem, ident, "requirement",
|
78
|
+
@labels["requirement"])
|
79
|
+
sequential_permission_names1(elem, ident, "recommendation",
|
80
|
+
@labels["recommendation"])
|
70
81
|
end
|
71
82
|
|
72
83
|
def sequential_permission_names1(block, lbl, klass, label)
|
73
84
|
c = Counter.new
|
74
85
|
block.xpath(ns("./#{klass}")).each do |t|
|
75
86
|
next if t["id"].nil? || t["id"].empty?
|
87
|
+
|
76
88
|
id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
|
77
89
|
@anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
|
78
90
|
sequential_permission_names2(t, id)
|
@@ -85,20 +97,22 @@ module IsoDoc::XrefGen
|
|
85
97
|
sequential_formula_names(clause)
|
86
98
|
sequential_permission_names(clause, "permission", @labels["permission"])
|
87
99
|
sequential_permission_names(clause, "requirement", @labels["requirement"])
|
88
|
-
sequential_permission_names(clause, "recommendation",
|
100
|
+
sequential_permission_names(clause, "recommendation",
|
101
|
+
@labels["recommendation"])
|
89
102
|
end
|
90
103
|
|
91
104
|
def hierarchical_figure_names(clause, num)
|
92
105
|
c = Counter.new
|
93
106
|
j = 0
|
94
|
-
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
|
95
|
-
each do |t|
|
107
|
+
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
|
108
|
+
.each do |t|
|
96
109
|
j = subfigure_increment(j, c, t)
|
97
110
|
label = "#{num}#{hiersep}#{c.print}" +
|
98
111
|
(j.zero? ? "" : "#{hierfigsep}#{j}")
|
99
112
|
next if t["id"].nil? || t["id"].empty?
|
100
|
-
|
101
|
-
|
113
|
+
|
114
|
+
@anchors[t["id"]] = anchor_struct(label, nil, @labels["figure"],
|
115
|
+
"figure", t["unnumbered"])
|
102
116
|
end
|
103
117
|
end
|
104
118
|
|
@@ -106,6 +120,7 @@ module IsoDoc::XrefGen
|
|
106
120
|
c = Counter.new
|
107
121
|
clause.xpath(ns(".//table")).each do |t|
|
108
122
|
next if t["id"].nil? || t["id"].empty?
|
123
|
+
|
109
124
|
@anchors[t["id"]] =
|
110
125
|
anchor_struct("#{num}#{hiersep}#{c.increment(t).print}",
|
111
126
|
nil, @labels["table"], "table", t["unnumbered"])
|
@@ -116,7 +131,8 @@ module IsoDoc::XrefGen
|
|
116
131
|
hierarchical_table_names(clause, num)
|
117
132
|
hierarchical_figure_names(clause, num)
|
118
133
|
hierarchical_formula_names(clause, num)
|
119
|
-
hierarchical_permission_names(clause, num, "permission",
|
134
|
+
hierarchical_permission_names(clause, num, "permission",
|
135
|
+
@labels["permission"])
|
120
136
|
hierarchical_permission_names(clause, num, "requirement",
|
121
137
|
@labels["requirement"])
|
122
138
|
hierarchical_permission_names(clause, num, "recommendation",
|
@@ -127,10 +143,12 @@ module IsoDoc::XrefGen
|
|
127
143
|
c = Counter.new
|
128
144
|
clause.xpath(ns(".//formula")).each do |t|
|
129
145
|
next if t["id"].nil? || t["id"].empty?
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
146
|
+
|
147
|
+
@anchors[t["id"]] = anchor_struct(
|
148
|
+
"#{num}#{hiersep}#{c.increment(t).print}", nil,
|
149
|
+
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
150
|
+
"formula", t["unnumbered"]
|
151
|
+
)
|
134
152
|
end
|
135
153
|
end
|
136
154
|
|
@@ -138,24 +156,31 @@ module IsoDoc::XrefGen
|
|
138
156
|
c = Counter.new
|
139
157
|
clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
|
140
158
|
next if t["id"].nil? || t["id"].empty?
|
159
|
+
|
141
160
|
id = "#{num}#{hiersep}#{c.increment(t).print}"
|
142
|
-
@anchors[t["id"]] =
|
161
|
+
@anchors[t["id"]] =
|
162
|
+
anchor_struct(id, nil, label, klass, t["unnumbered"])
|
143
163
|
hierarchical_permission_names2(t, id)
|
144
164
|
end
|
145
165
|
end
|
146
166
|
|
147
|
-
def hierarchical_permission_names2(
|
148
|
-
hierarchical_permission_names1(
|
149
|
-
|
150
|
-
hierarchical_permission_names1(
|
167
|
+
def hierarchical_permission_names2(elem, ident)
|
168
|
+
hierarchical_permission_names1(elem, ident, "permission",
|
169
|
+
@labels["permission"])
|
170
|
+
hierarchical_permission_names1(elem, ident, "requirement",
|
171
|
+
@labels["requirement"])
|
172
|
+
hierarchical_permission_names1(elem, ident, "recommendation",
|
173
|
+
@labels["recommendation"])
|
151
174
|
end
|
152
175
|
|
153
176
|
def hierarchical_permission_names1(block, lbl, klass, label)
|
154
177
|
c = Counter.new
|
155
178
|
block.xpath(ns("./#{klass}")).each do |t|
|
156
179
|
next if t["id"].nil? || t["id"].empty?
|
180
|
+
|
157
181
|
id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
|
158
|
-
@anchors[t["id"]] =
|
182
|
+
@anchors[t["id"]] =
|
183
|
+
anchor_struct(id, nil, label, klass, t["unnumbered"])
|
159
184
|
hierarchical_permission_names2(t, id)
|
160
185
|
end
|
161
186
|
end
|
@@ -60,17 +60,17 @@ module IsoDoc::XrefGen
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
def middle_section_asset_names(
|
63
|
+
def middle_section_asset_names(doc)
|
64
64
|
middle_sections = "//clause[@type = 'scope'] | "\
|
65
65
|
"#{@klass.norm_ref_xpath} | "\
|
66
66
|
"//sections/terms | //preface/* | "\
|
67
67
|
"//sections/definitions | //clause[parent::sections]"
|
68
|
-
sequential_asset_names(
|
68
|
+
sequential_asset_names(doc.xpath(ns(middle_sections)))
|
69
69
|
end
|
70
70
|
|
71
|
-
def clause_names(docxml,
|
71
|
+
def clause_names(docxml, num)
|
72
72
|
docxml.xpath(ns(@klass.middle_clause(docxml))).each_with_index do |c, _i|
|
73
|
-
section_names(c,
|
73
|
+
section_names(c, num, 1)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -472,96 +472,90 @@ RSpec.describe IsoDoc do
|
|
472
472
|
end
|
473
473
|
|
474
474
|
it "processes paragraphs containing notes" do
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
</p>
|
503
|
-
</div>
|
504
|
-
<p class='zzSTDTitle1'/>
|
505
|
-
</div>
|
506
|
-
</body>
|
507
|
-
</html>
|
508
|
-
OUTPUT
|
509
|
-
end
|
510
|
-
|
511
|
-
it "processes paragraphs containing notes (Word)" do
|
512
|
-
expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
|
513
|
-
.convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
514
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
515
|
-
<preface><foreword>
|
516
|
-
<p id="A">ABC <note id="B"><name>NOTE 1</name><p id="C">XYZ</p></note>
|
517
|
-
<note id="B1"><name>NOTE 2</name><p id="C1">XYZ1</p></note></p>
|
518
|
-
</foreword></preface>
|
519
|
-
</iso-standard>
|
520
|
-
INPUT
|
521
|
-
<html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
|
522
|
-
<head>
|
523
|
-
<style/>
|
524
|
-
</head>
|
525
|
-
<body lang='EN-US' link='blue' vlink='#954F72'>
|
526
|
-
<div class='WordSection1'>
|
527
|
-
<p> </p>
|
528
|
-
</div>
|
529
|
-
<p>
|
530
|
-
<br clear='all' class='section'/>
|
531
|
-
</p>
|
532
|
-
<div class='WordSection2'>
|
533
|
-
<p>
|
534
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
535
|
-
</p>
|
536
|
-
<div>
|
537
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
538
|
-
<p id='A'>ABC </p>
|
539
|
-
<div id='B' class='Note'>
|
540
|
-
<p class='Note'>
|
541
|
-
<span class='note_label'>NOTE 1</span>
|
542
|
-
<span style='mso-tab-count:1'>  </span>
|
543
|
-
XYZ
|
544
|
-
</p>
|
545
|
-
</div>
|
546
|
-
<div id='B1' class='Note'>
|
547
|
-
<p class='Note'>
|
548
|
-
<span class='note_label'>NOTE 2</span>
|
549
|
-
<span style='mso-tab-count:1'>  </span>
|
550
|
-
XYZ1
|
475
|
+
input = <<~INPUT
|
476
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
477
|
+
<preface><foreword>
|
478
|
+
<p id="A">ABC <note id="B"><name>NOTE 1</name><p id="C">XYZ</p></note>
|
479
|
+
<note id="B1"><name>NOTE 2</name><p id="C1">XYZ1</p></note></p>
|
480
|
+
</foreword></preface>
|
481
|
+
</iso-standard>
|
482
|
+
INPUT
|
483
|
+
html = <<~OUTPUT
|
484
|
+
#{HTML_HDR}
|
485
|
+
<br/>
|
486
|
+
<div>
|
487
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
488
|
+
<p id='A'>
|
489
|
+
ABC
|
490
|
+
<div id='B' class='Note'>
|
491
|
+
<p>
|
492
|
+
<span class='note_label'>NOTE 1</span>
|
493
|
+
  XYZ
|
494
|
+
</p>
|
495
|
+
</div>
|
496
|
+
<div id='B1' class='Note'>
|
497
|
+
<p>
|
498
|
+
<span class='note_label'>NOTE 2</span>
|
499
|
+
  XYZ1
|
500
|
+
</p>
|
501
|
+
</div>
|
551
502
|
</p>
|
552
503
|
</div>
|
504
|
+
<p class='zzSTDTitle1'/>
|
553
505
|
</div>
|
554
|
-
|
555
|
-
|
506
|
+
</body>
|
507
|
+
</html>
|
508
|
+
OUTPUT
|
509
|
+
|
510
|
+
doc = <<~OUTPUT
|
511
|
+
<html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
|
512
|
+
<head>
|
513
|
+
<style/>
|
514
|
+
</head>
|
515
|
+
<body lang='EN-US' link='blue' vlink='#954F72'>
|
516
|
+
<div class='WordSection1'>
|
517
|
+
<p> </p>
|
518
|
+
</div>
|
519
|
+
<p>
|
520
|
+
<br clear='all' class='section'/>
|
521
|
+
</p>
|
522
|
+
<div class='WordSection2'>
|
556
523
|
<p>
|
557
|
-
<br clear='all'
|
524
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
558
525
|
</p>
|
559
|
-
<div
|
560
|
-
<
|
526
|
+
<div>
|
527
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
528
|
+
<p id='A'>ABC </p>
|
529
|
+
<div id='B' class='Note'>
|
530
|
+
<p class='Note'>
|
531
|
+
<span class='note_label'>NOTE 1</span>
|
532
|
+
<span style='mso-tab-count:1'>  </span>
|
533
|
+
XYZ
|
534
|
+
</p>
|
535
|
+
</div>
|
536
|
+
<div id='B1' class='Note'>
|
537
|
+
<p class='Note'>
|
538
|
+
<span class='note_label'>NOTE 2</span>
|
539
|
+
<span style='mso-tab-count:1'>  </span>
|
540
|
+
XYZ1
|
541
|
+
</p>
|
542
|
+
</div>
|
561
543
|
</div>
|
562
|
-
|
563
|
-
|
564
|
-
|
544
|
+
<p> </p>
|
545
|
+
</div>
|
546
|
+
<p>
|
547
|
+
<br clear='all' class='section'/>
|
548
|
+
</p>
|
549
|
+
<div class='WordSection3'>
|
550
|
+
<p class='zzSTDTitle1'/>
|
551
|
+
</div>
|
552
|
+
</body>
|
553
|
+
</html>
|
554
|
+
OUTPUT
|
555
|
+
expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({})
|
556
|
+
.convert("test", input, true)))).to be_equivalent_to xmlpp(html)
|
557
|
+
expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
|
558
|
+
.convert("test", input, true)))).to be_equivalent_to xmlpp(doc)
|
565
559
|
end
|
566
560
|
|
567
561
|
it "processes figures" do
|
@@ -823,7 +817,7 @@ RSpec.describe IsoDoc do
|
|
823
817
|
|
824
818
|
it "converts SVG (Word)" do
|
825
819
|
FileUtils.rm_rf "spec/assets/odf1.emf"
|
826
|
-
|
820
|
+
input = <<~INPUT
|
827
821
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
828
822
|
<preface><foreword>
|
829
823
|
<figure id="figureA-1">
|
@@ -835,6 +829,7 @@ RSpec.describe IsoDoc do
|
|
835
829
|
</foreword></preface>
|
836
830
|
</iso-standard>
|
837
831
|
INPUT
|
832
|
+
output = <<~OUTPUT
|
838
833
|
<html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
|
839
834
|
<head>
|
840
835
|
<style>
|
@@ -871,6 +866,12 @@ RSpec.describe IsoDoc do
|
|
871
866
|
</body>
|
872
867
|
</html>
|
873
868
|
OUTPUT
|
869
|
+
expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
|
870
|
+
.convert("test", input, true)
|
871
|
+
.gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.emf['"]/, "'_.emf'")
|
872
|
+
.gsub(/['"][^'".]+\.(gif|xml)['"]/, "'_.\\1'")
|
873
|
+
.gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref"))))
|
874
|
+
.to be_equivalent_to xmlpp(output)
|
874
875
|
end
|
875
876
|
|
876
877
|
context "disable inkscape" do
|
@@ -881,58 +882,63 @@ RSpec.describe IsoDoc do
|
|
881
882
|
allow_any_instance_of(IsoDoc::WordFunction::Body)
|
882
883
|
.to receive(:inkscape_installed?)
|
883
884
|
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
</iso-standard>
|
885
|
+
input = <<~INPUT
|
886
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
887
|
+
<preface><foreword>
|
888
|
+
<figure id="figureA-1">
|
889
|
+
<image src="spec/assets/odf.svg" mimetype="image/svg+xml"/>
|
890
|
+
<image src="spec/assets/odf1.svg" mimetype="image/svg+xml"/>
|
891
|
+
<image src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICA8Y2lyY2xlIGZpbGw9IiMwMDkiIHI9IjQ1IiBjeD0iNTAiIGN5PSI1MCIvPgogIDxwYXRoIGQ9Ik0zMywyNkg3OEEzNywzNywwLDAsMSwzMyw4M1Y1N0g1OVY0M0gzM1oiIGZpbGw9IiNGRkYiLz4KPC9zdmc+Cg==" id="_d3731866-1a07-435a-a6c2-1acd41023a4e" mimetype="image/svg+xml" height="auto" width="auto"/>
|
892
|
+
</figure>
|
893
|
+
</foreword></preface>
|
894
|
+
</iso-standard>
|
895
895
|
INPUT
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
896
|
+
output = <<~OUTPUT
|
897
|
+
<html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
|
898
|
+
<head>
|
899
|
+
<style>
|
900
|
+
</style>
|
901
|
+
</head>
|
902
|
+
<body lang='EN-US' link='blue' vlink='#954F72'>
|
903
|
+
<div class='WordSection1'>
|
904
|
+
<p> </p>
|
905
|
+
</div>
|
906
|
+
<p>
|
907
|
+
<br clear='all' class='section'/>
|
908
|
+
</p>
|
909
|
+
<div class='WordSection2'>
|
910
|
+
<p>
|
911
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
912
|
+
</p>
|
913
|
+
<div>
|
914
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
915
|
+
<div id='figureA-1' class='figure'>
|
916
|
+
<img src='spec/assets/odf.emf'/>
|
917
|
+
<img src='spec/assets/odf1.svg'/>
|
918
|
+
<img src='_.svg' height='auto' width='auto'/>
|
919
|
+
</div>
|
920
|
+
</div>
|
921
|
+
<p> </p>
|
922
|
+
</div>
|
923
|
+
<p>
|
924
|
+
<br clear='all' class='section'/>
|
925
|
+
</p>
|
926
|
+
<div class='WordSection3'>
|
927
|
+
<p class='zzSTDTitle1'/>
|
928
|
+
</div>
|
929
|
+
</body>
|
930
|
+
</html>
|
930
931
|
OUTPUT
|
932
|
+
expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
|
933
|
+
.convert("test", input, true)
|
934
|
+
.gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.svg['"]/, "'_.svg'")
|
935
|
+
.gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref"))))
|
936
|
+
.to be_equivalent_to xmlpp(output)
|
931
937
|
end
|
932
938
|
end
|
933
939
|
|
934
|
-
it "processes examples
|
935
|
-
|
940
|
+
it "processes examples" do
|
941
|
+
input = <<~INPUT
|
936
942
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
937
943
|
<preface><foreword>
|
938
944
|
<example id="samplecode" keep-with-next="true" keep-lines-together="true">
|
@@ -945,6 +951,7 @@ RSpec.describe IsoDoc do
|
|
945
951
|
</foreword></preface>
|
946
952
|
</iso-standard>
|
947
953
|
INPUT
|
954
|
+
presxml = <<~OUTPUT
|
948
955
|
<?xml version='1.0'?>
|
949
956
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
950
957
|
<preface>
|
@@ -960,22 +967,8 @@ RSpec.describe IsoDoc do
|
|
960
967
|
</preface>
|
961
968
|
</iso-standard>
|
962
969
|
OUTPUT
|
963
|
-
end
|
964
970
|
|
965
|
-
|
966
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
967
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
968
|
-
<preface>
|
969
|
-
<foreword>
|
970
|
-
<example id='samplecode' keep-with-next='true' keep-lines-together='true'>
|
971
|
-
<name>EXAMPLE — Title</name>
|
972
|
-
<p>Hello</p>
|
973
|
-
<sourcecode id='X'><name>Sample</name></sourcecode>
|
974
|
-
</example>
|
975
|
-
</foreword>
|
976
|
-
</preface>
|
977
|
-
</iso-standard>
|
978
|
-
INPUT
|
971
|
+
html = <<~OUTPUT
|
979
972
|
#{HTML_HDR}
|
980
973
|
<br/>
|
981
974
|
<div>
|
@@ -983,7 +976,12 @@ RSpec.describe IsoDoc do
|
|
983
976
|
<div id="samplecode" class="example" style="page-break-after: avoid;page-break-inside: avoid;">
|
984
977
|
<p class="example-title">EXAMPLE — Title</p>
|
985
978
|
<p>Hello</p>
|
986
|
-
<pre id='X' class='prettyprint '
|
979
|
+
<pre id='X' class='prettyprint '>
|
980
|
+
<br/>
|
981
|
+
         
|
982
|
+
<br/>
|
983
|
+
       
|
984
|
+
</pre>
|
987
985
|
<p class='SourceTitle' style='text-align:center;'>Sample</p>
|
988
986
|
</div>
|
989
987
|
</div>
|
@@ -992,22 +990,7 @@ RSpec.describe IsoDoc do
|
|
992
990
|
</body>
|
993
991
|
</html>
|
994
992
|
OUTPUT
|
995
|
-
|
996
|
-
|
997
|
-
it "processes examples (Word)" do
|
998
|
-
expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
999
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
1000
|
-
<preface>
|
1001
|
-
<foreword>
|
1002
|
-
<example id='samplecode' keep-with-next='true' keep-lines-together='true'>
|
1003
|
-
<name>EXAMPLE — Title</name>
|
1004
|
-
<p>Hello</p>
|
1005
|
-
<sourcecode id='X'><name>Sample</name></sourcecode>
|
1006
|
-
</example>
|
1007
|
-
</foreword>
|
1008
|
-
</preface>
|
1009
|
-
</iso-standard>
|
1010
|
-
INPUT
|
993
|
+
doc = <<~OUTPUT
|
1011
994
|
<html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'><head><style>
|
1012
995
|
</style>
|
1013
996
|
</head>
|
@@ -1027,7 +1010,12 @@ RSpec.describe IsoDoc do
|
|
1027
1010
|
<div id='samplecode' class='example' style='page-break-after: avoid;page-break-inside: avoid;'>
|
1028
1011
|
<p class='example-title'>EXAMPLE — Title</p>
|
1029
1012
|
<p>Hello</p>
|
1030
|
-
<p id='X' class='Sourcecode'
|
1013
|
+
<p id='X' class='Sourcecode'>
|
1014
|
+
<br/>
|
1015
|
+
         
|
1016
|
+
<br/>
|
1017
|
+
       
|
1018
|
+
</p>
|
1031
1019
|
<p class='SourceTitle' style='text-align:center;'>Sample</p>
|
1032
1020
|
</div>
|
1033
1021
|
</div>
|
@@ -1042,10 +1030,13 @@ RSpec.describe IsoDoc do
|
|
1042
1030
|
</body>
|
1043
1031
|
</html>
|
1044
1032
|
OUTPUT
|
1033
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
1034
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
1035
|
+
expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(doc)
|
1045
1036
|
end
|
1046
1037
|
|
1047
1038
|
it "processes sequences of examples" do
|
1048
|
-
|
1039
|
+
input = <<~INPUT
|
1049
1040
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1050
1041
|
<preface><foreword>
|
1051
1042
|
<example id="samplecode">
|
@@ -1061,6 +1052,7 @@ RSpec.describe IsoDoc do
|
|
1061
1052
|
</foreword></preface>
|
1062
1053
|
</iso-standard>
|
1063
1054
|
INPUT
|
1055
|
+
output = <<~OUTPUT
|
1064
1056
|
<?xml version='1.0'?>
|
1065
1057
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
1066
1058
|
<preface>
|
@@ -1081,10 +1073,11 @@ RSpec.describe IsoDoc do
|
|
1081
1073
|
</preface>
|
1082
1074
|
</iso-standard>
|
1083
1075
|
OUTPUT
|
1076
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1084
1077
|
end
|
1085
1078
|
|
1086
|
-
it "processes sourcecode
|
1087
|
-
|
1079
|
+
it "processes sourcecode" do
|
1080
|
+
input = <<~INPUT
|
1088
1081
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1089
1082
|
<preface><foreword>
|
1090
1083
|
<sourcecode lang="ruby" id="samplecode">
|
@@ -1097,6 +1090,7 @@ RSpec.describe IsoDoc do
|
|
1097
1090
|
</foreword></preface>
|
1098
1091
|
</iso-standard>
|
1099
1092
|
INPUT
|
1093
|
+
presxml = <<~OUTPUT
|
1100
1094
|
<?xml version='1.0'?>
|
1101
1095
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
1102
1096
|
<preface>
|
@@ -1113,98 +1107,55 @@ RSpec.describe IsoDoc do
|
|
1113
1107
|
</preface>
|
1114
1108
|
</iso-standard>
|
1115
1109
|
OUTPUT
|
1116
|
-
end
|
1117
1110
|
|
1118
|
-
|
1119
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1120
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
1121
|
-
<preface>
|
1122
|
-
<foreword>
|
1123
|
-
<sourcecode lang='ruby' id='samplecode'>
|
1124
|
-
<name>
|
1125
|
-
Figure 1 — Ruby
|
1126
|
-
<em>code</em>
|
1127
|
-
</name>
|
1128
|
-
puts x
|
1129
|
-
</sourcecode>
|
1130
|
-
<sourcecode unnumbered='true'>
|
1131
|
-
Que?
|
1132
|
-
</sourcecode>
|
1133
|
-
</foreword>
|
1134
|
-
</preface>
|
1135
|
-
</iso-standard>
|
1136
|
-
INPUT
|
1111
|
+
html = <<~OUTPUT
|
1137
1112
|
#{HTML_HDR}
|
1138
1113
|
<br/>
|
1139
1114
|
<div>
|
1140
1115
|
<h1 class="ForewordTitle">Foreword</h1>
|
1141
|
-
<pre id="samplecode" class="prettyprint lang-rb"><br/>        <br/>  puts x<br
|
1116
|
+
<pre id="samplecode" class="prettyprint lang-rb"><br/>        <br/>         puts x<br/>     </pre>
|
1142
1117
|
<p class="SourceTitle" style="text-align:center;">Figure 1 — Ruby <i>code</i></p>
|
1143
|
-
<pre class='prettyprint '>
|
1144
|
-
<br/>
|
1145
|
-
Que?
|
1146
|
-
<br/>
|
1147
|
-
</pre>
|
1118
|
+
<pre class='prettyprint '> Que? </pre>
|
1148
1119
|
</div>
|
1149
1120
|
<p class="zzSTDTitle1"/>
|
1150
1121
|
</div>
|
1151
1122
|
</body>
|
1152
1123
|
</html>
|
1153
1124
|
OUTPUT
|
1154
|
-
end
|
1155
1125
|
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
<p> </p>
|
1180
|
-
</div>
|
1181
|
-
<p>
|
1182
|
-
<br clear="all" class="section"/>
|
1183
|
-
</p>
|
1184
|
-
<div class="WordSection2">
|
1185
|
-
<p>
|
1186
|
-
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
1187
|
-
</p>
|
1188
|
-
<div>
|
1189
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
1190
|
-
<p id="samplecode" class="Sourcecode"><br/>        <br/>  puts x<br/></p><p class="SourceTitle" style="text-align:center;">Figure 1 — Ruby <i>code</i></p>
|
1191
|
-
<p class='Sourcecode'>
|
1192
|
-
<br/>
|
1193
|
-
Que?
|
1194
|
-
<br/>
|
1126
|
+
doc = <<~OUTPUT
|
1127
|
+
<html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
|
1128
|
+
<head><style/></head>
|
1129
|
+
<body lang="EN-US" link="blue" vlink="#954F72">
|
1130
|
+
<div class="WordSection1">
|
1131
|
+
<p> </p>
|
1132
|
+
</div>
|
1133
|
+
<p>
|
1134
|
+
<br clear="all" class="section"/>
|
1135
|
+
</p>
|
1136
|
+
<div class="WordSection2">
|
1137
|
+
<p>
|
1138
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
1139
|
+
</p>
|
1140
|
+
<div>
|
1141
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
1142
|
+
<p id="samplecode" class="Sourcecode"><br/>        <br/>         puts x<br/>      </p><p class="SourceTitle" style="text-align:center;">Figure 1 — Ruby <i>code</i></p>
|
1143
|
+
<p class='Sourcecode'> Que? </p>
|
1144
|
+
</div>
|
1145
|
+
<p> </p>
|
1146
|
+
</div>
|
1147
|
+
<p>
|
1148
|
+
<br clear="all" class="section"/>
|
1195
1149
|
</p>
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
</p>
|
1202
|
-
<div class="WordSection3">
|
1203
|
-
<p class="zzSTDTitle1"/>
|
1204
|
-
</div>
|
1205
|
-
</body>
|
1206
|
-
</html>
|
1150
|
+
<div class="WordSection3">
|
1151
|
+
<p class="zzSTDTitle1"/>
|
1152
|
+
</div>
|
1153
|
+
</body>
|
1154
|
+
</html>
|
1207
1155
|
OUTPUT
|
1156
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
1157
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
1158
|
+
expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(doc)
|
1208
1159
|
end
|
1209
1160
|
|
1210
1161
|
it "processes sourcecode with escapes preserved" do
|