bookify 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bookify/renderer.rb +6 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d440b7412142dae84f47b9653733a33f826d5057
4
- data.tar.gz: 515bbecc3fd4ee92fca7434812e4ca00a60d21ea
3
+ metadata.gz: f23a775e5028eaf16b107b248c9dffa70db37f9a
4
+ data.tar.gz: e7d2856954ca690cd95eabeee2fa5fe6813bcb7b
5
5
  SHA512:
6
- metadata.gz: 4a7fffa9f6cac1980f5dd80cb97bdafc73ba13fdf6c0879a74e2a63e14527ba4701146e32068f1da29776870e20a0c77b099d01e2d021755c47586c8f5d8ad64
7
- data.tar.gz: 9afd804f9f1d614dab9d21995d6ef08a3c944a43acafc2304fa091755c1bf5d3e4b4109daf502a16abe031d127b18d331a538060bac01e63e33094ad6930c166
6
+ metadata.gz: fe2864dff4466b630ea3bda1c62801da54ade54536c1c5b708303a19dfb64383bb3bea17ae9e1d5d228803b1902e9d01d8026fe85338dc106838808bf529d437
7
+ data.tar.gz: 414358a289aed313ab20f212e9d811045e26f194c9df23a40d801bc0125157ac937b45b3a2beccfc957eb1fcc0269e2946d1dad9d2a51ab41fbc822695aa3b5c
@@ -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
4
+ attr_accessor :input_file, :output_file, :layout, :columns, :input_text, :column_spacer, :margin
5
5
 
6
6
  def self.from_args(args)
7
7
  if ["-l", "--landscape"].include?(args[0])
@@ -19,16 +19,18 @@ 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: :landscape, columns: 2, output_file:, input_file: nil, input_text: nil)
22
+ def initialize(layout: :landscape, columns: 2, output_file:, input_file: nil, input_text: nil, column_spacer: nil, margin: 50)
23
23
  @layout = layout
24
24
  @columns = columns
25
25
  @output_file = output_file
26
26
  @input_file = input_file
27
27
  @input_text = input_text
28
+ @column_spacer = column_spacer
29
+ @margin = margin
28
30
  end
29
31
 
30
32
  def render
31
- Prawn::Document.generate(output_file, margin: 50, page_layout: layout) do |pdf|
33
+ Prawn::Document.generate(output_file, margin: margin, page_layout: layout) do |pdf|
32
34
  font_path = "#{File.dirname(__FILE__)}/../../fonts"
33
35
 
34
36
  pdf.font_families["Book Antiqua"] = {
@@ -43,7 +45,7 @@ class Bookify::Renderer
43
45
  pdf.line_width(0.5)
44
46
  pdf.default_leading 0.5
45
47
 
46
- pdf.column_box [0, pdf.cursor], columns: columns, width: pdf.bounds.width do
48
+ pdf.column_box [0, pdf.cursor], columns: columns, width: pdf.bounds.width, spacer: (column_spacer || pdf.font_size) do
47
49
  doc.children.each { |c| Bookify::Node.render(c, pdf) }
48
50
  end
49
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookify
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joey Schoblaska