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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a71a4a0a73c02b270f94815ef98e89c018cba0f5
4
- data.tar.gz: 3acd56ba011084eb9d4096febc874d8f9e864ad0
3
+ metadata.gz: a5c57575da1ca752b89a9fd137fde5b123a62dfd
4
+ data.tar.gz: 40123b934a309e8a2cb09fb089c7ddf5f7ccd019
5
5
  SHA512:
6
- metadata.gz: 92c988dd791388426165c03c47191dc4d04fa7ee0c59176ca630d8e1399d16128453284f85a2f3da49328940588e06837c5f74dfb889a7177efa363ad965bf3f
7
- data.tar.gz: a37bb39a942d96ff683bf926c3860900a022ecd8494ea7d357d3ea2dd9c1123aa749dfd93e553419e6819fd76c432f1633701d492ae75f433f9884f370c63289
6
+ metadata.gz: aaae898e40b3fdbc8d25e0e8ec0ab516f6d16c23a15aa6321e23f193556eca6bdfeae147afb5ed2e86151b676f0c96b32a3f620213db2ececa14c41a54a067d9
7
+ data.tar.gz: c1425276503470f09dcebae5c92f2253dd8bcd67e19280987a52787547ead475c29d8d6dede77d978d3c1bcd7c09faad7a389e46837cb175ef8e4f85a0250197
@@ -12,6 +12,7 @@ module Bookify::Node
12
12
  img: Image,
13
13
  ol: List,
14
14
  p: Paragraph,
15
+ table: Table,
15
16
  ul: List
16
17
  }
17
18
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  class Bookify::Renderer
2
- MARKDOWN_CONVERTER = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
2
+ MARKDOWN_CONVERTER = Redcarpet::Markdown.new(Redcarpet::Render::HTML, tables: true)
3
3
 
4
4
  attr_accessor :input_file, :output_file, :layout, :columns
5
5
 
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.3.3
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-25 00:00:00.000000000 Z
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: