class Bookfile::BookDef

Public Class Methods

new( opts={}, proc ) click to toggle source
# File lib/bookfile/book/book.rb, line 113
def initialize( opts={}, proc )
  @opts = opts
  @proc = proc    ## use name block (why,why not??)
  ## @block = block  ## save block as proc ?? ??
end

Public Instance Methods

build( unzip_dir ) click to toggle source
# File lib/bookfile/book/book.rb, line 119
def build( unzip_dir )
  defaults = {  templates_dir: "#{unzip_dir}/_templates",
                pages_dir:     "#{unzip_dir}/_pages"  }

  ## note:
  ##   (auto)build two versions:
  ##   1) multi-page version - for (easy) browsing
  ##   2) all-in-one-page version - for (easy)pdf conversion

  multi_page_ctx = BookCtx.new( BookConfig.new( defaults ))
  @proc.call( multi_page_ctx )  ## same as - ctx.instance_eval( &@codeblock ) -- use instance_eval - why, why not??

  one_page_ctx = BookCtx.new( BookConfig.new( defaults ), inline: true )
  @proc.call( one_page_ctx )  ## same as - ctx.instance_eval( &@codeblock ) -- use instance_eval - why, why not??
end