bookify 1.3.3 → 1.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/bookify/node.rb +1 -0
- data/lib/bookify/node/table.rb +30 -0
- data/lib/bookify/renderer.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5c57575da1ca752b89a9fd137fde5b123a62dfd
|
4
|
+
data.tar.gz: 40123b934a309e8a2cb09fb089c7ddf5f7ccd019
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaae898e40b3fdbc8d25e0e8ec0ab516f6d16c23a15aa6321e23f193556eca6bdfeae147afb5ed2e86151b676f0c96b32a3f620213db2ececa14c41a54a067d9
|
7
|
+
data.tar.gz: c1425276503470f09dcebae5c92f2253dd8bcd67e19280987a52787547ead475c29d8d6dede77d978d3c1bcd7c09faad7a389e46837cb175ef8e4f85a0250197
|
data/lib/bookify/node.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
module Bookify::Node
|
2
|
+
class Table < Base
|
3
|
+
def render
|
4
|
+
table table_data, header: true, width: bounds.width do
|
5
|
+
cells.borders = []
|
6
|
+
|
7
|
+
row(0).borders = [:top, :bottom]
|
8
|
+
row(0).border_top_width = 1
|
9
|
+
row(0).border_bottom_width = 0.5
|
10
|
+
row(0).font_style = :bold
|
11
|
+
|
12
|
+
row(-1).borders = [:bottom]
|
13
|
+
row(-1).border_bottom_width = 1
|
14
|
+
|
15
|
+
cells.columns(0).padding = [5, 5, 5, 0]
|
16
|
+
cells.columns(-1).padding = [5, 0, 5, 5]
|
17
|
+
end
|
18
|
+
|
19
|
+
move_down 15
|
20
|
+
end
|
21
|
+
|
22
|
+
def table_data
|
23
|
+
node.css("tr").map do |tr|
|
24
|
+
tr.css("th, td").map do |td|
|
25
|
+
decode_html(td.inner_html.strip)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/bookify/renderer.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joey Schoblaska
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- lib/bookify/node/image.rb
|
120
120
|
- lib/bookify/node/list.rb
|
121
121
|
- lib/bookify/node/paragraph.rb
|
122
|
+
- lib/bookify/node/table.rb
|
122
123
|
- lib/bookify/renderer.rb
|
123
124
|
homepage: https://github.com/joeyschoblaska/bookify
|
124
125
|
licenses:
|