Class: JekyllPandocMultipleFormats::Binder

Inherits:
Printer
  • Object
show all
Defined in:
lib/jekyll-pandoc-multiple-formats-jekyll34/binder.rb

Constant Summary

Constants inherited from Printer

Printer::SHEET_SIZES, Printer::TEMPLATE

Instance Attribute Summary

Attributes inherited from Printer

#extra_options, #nup, #original_file, #output_file, #pages, #papersize, #relative_path, #sheetsize, #template

Instance Method Summary collapse

Methods inherited from Printer

#is_landscape?, #render_template, #round_to_nearest, #write

Constructor Details

#initialize(file, papersize = nil, sheetsize = nil, extra_options = nil) ⇒ Binder

Returns a new instance of Binder.



26
27
28
29
30
31
32
# File 'lib/jekyll-pandoc-multiple-formats-jekyll34/binder.rb', line 26

def initialize(file, papersize = nil, sheetsize = nil, extra_options = nil)
  super
  @output_file   = file.gsub(/\.pdf\Z/, '-binder.pdf')

  render_template
  self
end

Instance Method Details

#to_nupObject



34
35
36
37
38
39
40
41
42
43
# File 'lib/jekyll-pandoc-multiple-formats-jekyll34/binder.rb', line 34

def to_nup
  @pages.times.map{|i|i+1}.map do |page|
    sheet=[]
    @nup.times do
      sheet << page
    end

    sheet
  end.flatten
end