bookify 2.1.1 → 2.2.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/renderer.rb +6 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5efda6174113c079df650774858604834a31f9c8730cc01526488186057fdb1e
|
4
|
+
data.tar.gz: c469a5f6aa68441251a53e8daa8fc6c76335a03c71f30dcaf471852a1edf152f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4521dca613962076e908c59acc7b7f1af57f23a667503969b5b32fd4d81495edde82018fb47bb891e5e5ae47967a40922a647d449c80e616a5770d7ea5fa9b15
|
7
|
+
data.tar.gz: e7d33822d208f7ed34a690ef92da5a670db6a177dff1ec5ae0145e6ada1203f3d45c28d671c30777385aae939cc1f125aadbe86eccf1c6943d78a13b79153af6
|
data/lib/bookify/renderer.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class Bookify::Renderer
|
2
2
|
MARKDOWN_CONVERTER = Redcarpet::Markdown.new(Redcarpet::Render::HTML, tables: true)
|
3
3
|
|
4
|
-
attr_accessor :input_file, :output_file, :layout, :columns, :input_text, :column_spacer, :margin
|
4
|
+
attr_accessor :input_file, :output_file, :layout, :columns, :input_text, :column_spacer, :margin, :page_size
|
5
5
|
|
6
6
|
def self.from_args(args)
|
7
7
|
if ["-l", "--landscape"].include?(args[0])
|
@@ -19,7 +19,7 @@ class Bookify::Renderer
|
|
19
19
|
new(layout: layout, columns: columns, input_file: input_file, output_file: output_file)
|
20
20
|
end
|
21
21
|
|
22
|
-
def initialize(layout: :
|
22
|
+
def initialize(layout: :portrait, columns: 2, output_file:, input_file: nil, input_text: nil, column_spacer: nil, margin: 50, page_size: nil)
|
23
23
|
@layout = layout
|
24
24
|
@columns = columns
|
25
25
|
@output_file = output_file
|
@@ -27,10 +27,13 @@ class Bookify::Renderer
|
|
27
27
|
@input_text = input_text
|
28
28
|
@column_spacer = column_spacer
|
29
29
|
@margin = margin
|
30
|
+
@page_size = page_size
|
30
31
|
end
|
31
32
|
|
32
33
|
def render
|
33
|
-
|
34
|
+
doc_opts = {margin: margin, page_layout: layout, page_size: page_size}.compact
|
35
|
+
|
36
|
+
Prawn::Document.generate(output_file, doc_opts) do |pdf|
|
34
37
|
font_path = "#{File.dirname(__FILE__)}/../../fonts"
|
35
38
|
|
36
39
|
pdf.font_families["Book Antiqua"] = {
|
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: 2.
|
4
|
+
version: 2.2.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: 2020-02-
|
11
|
+
date: 2020-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|