isodoc 0.0.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/cleanup.rb +8 -14
- data/lib/isodoc/html.rb +1 -2
- data/lib/isodoc/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0679d357232b392889d42dff130949b390726397'
|
4
|
+
data.tar.gz: 1c5eb12db5f8c9b1cb29802a5a538bf66dbb8ea9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4fe6d944d1cd243db21b7faca859d7658f22fa8ae5076d31920ef3f979e5804e10a57da7073cbf54a2366fa9b4ac0261aa3289cb146905ebf9e74c7c13e6808
|
7
|
+
data.tar.gz: 1d0fcdd12674101553cac3a3834a787179000933a22ce07365c6c820557d4c763c17060d2e9cde04039d86a18bc948f6a35bf5975896de500474a5ad6637f9a0
|
data/lib/isodoc/cleanup.rb
CHANGED
@@ -34,14 +34,14 @@ module IsoDoc
|
|
34
34
|
dt = key.add_child("<dt></dt>").first
|
35
35
|
dd = key.add_child("<dd></dd>").first
|
36
36
|
fnref.parent = dt
|
37
|
-
aside.xpath(".//p").each do |a|
|
37
|
+
aside.xpath(".//p").each do |a|
|
38
38
|
a.delete("class")
|
39
|
-
a.parent = dd
|
39
|
+
a.parent = dd
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
def figure_cleanup(docxml)
|
44
|
-
# move footnotes into key, and get rid of footnote reference
|
44
|
+
# move footnotes into key, and get rid of footnote reference
|
45
45
|
# since it is in diagram
|
46
46
|
docxml.xpath(FIGURE_WITH_FOOTNOTES).each do |f|
|
47
47
|
key = figure_get_or_make_dl(f)
|
@@ -68,9 +68,7 @@ module IsoDoc
|
|
68
68
|
docxml.xpath('//div/span[@style="MsoCommentReference"]').
|
69
69
|
each do |x|
|
70
70
|
prev = x.previous_element
|
71
|
-
|
72
|
-
x.parent = prev
|
73
|
-
end
|
71
|
+
x.parent = prev unless prev.nil?
|
74
72
|
end
|
75
73
|
docxml
|
76
74
|
end
|
@@ -79,9 +77,7 @@ module IsoDoc
|
|
79
77
|
docxml.xpath('//div[@style="mso-element:footnote"]/a').
|
80
78
|
each do |x|
|
81
79
|
n = x.next_element
|
82
|
-
|
83
|
-
n.children.first.add_previous_sibling(x.remove)
|
84
|
-
end
|
80
|
+
n&.children&.first&.add_previous_sibling(x.remove)
|
85
81
|
end
|
86
82
|
docxml
|
87
83
|
end
|
@@ -89,7 +85,7 @@ module IsoDoc
|
|
89
85
|
def merge_fnref_into_fn_text(a)
|
90
86
|
fn = a.at('.//a[@class="zzFootnote"]')
|
91
87
|
n = fn.next_element
|
92
|
-
n
|
88
|
+
n&.children&.first&.add_previous_sibling(fn.remove)
|
93
89
|
end
|
94
90
|
|
95
91
|
TABLE_WITH_FOOTNOTES = "//table[descendant::aside]".freeze
|
@@ -118,9 +114,7 @@ module IsoDoc
|
|
118
114
|
tfoot = t.at(".//tfoot")
|
119
115
|
else
|
120
116
|
# nuke its bottom border
|
121
|
-
tfoot.xpath(".//td | .//th").each
|
122
|
-
remove_bottom_border(td)
|
123
|
-
end
|
117
|
+
tfoot.xpath(".//td | .//th").each { |td| remove_bottom_border(td) }
|
124
118
|
end
|
125
119
|
tfoot
|
126
120
|
end
|
@@ -129,7 +123,7 @@ module IsoDoc
|
|
129
123
|
# how many columns in the table?
|
130
124
|
cols = 0
|
131
125
|
t.at(".//tr").xpath("./td | ./th").each do |td|
|
132
|
-
cols += (
|
126
|
+
cols += (td["colspan"] ? td["colspan"].to_i : 1)
|
133
127
|
end
|
134
128
|
style = %{border-top:0pt;mso-border-top-alt:0pt;
|
135
129
|
border-bottom:#{SW} 1.5pt;mso-border-bottom-alt:#{SW} 1.5pt;}
|
data/lib/isodoc/html.rb
CHANGED
@@ -33,8 +33,7 @@ module IsoDoc
|
|
33
33
|
title = docxml.at("//*[local-name() = 'head']/*[local-name() = 'title']")
|
34
34
|
head = docxml.at("//*[local-name() = 'head']")
|
35
35
|
css = htmlstylesheet
|
36
|
-
if title.nil?
|
37
|
-
head.children.first.add_previous_sibling css
|
36
|
+
if title.nil? then head.children.first.add_previous_sibling css
|
38
37
|
else
|
39
38
|
title.add_next_sibling css
|
40
39
|
end
|
data/lib/isodoc/version.rb
CHANGED