class Tilt::PrawnTemplate


Prawn template implementation. See: prawnpdf.org

def allows_script?

def allows_script?
  false
end

def evaluate(scope, locals, &block)

def evaluate(scope, locals, &block)
  pdf = @engine
  if data.respond_to?(:to_str)
    locals[:pdf] = pdf
    super(scope, locals, &block)
  elsif data.kind_of?(Proc)
    data.call(pdf)
  end
  @output ||= pdf.render
end

def prawn_options

def prawn_options
  # defaults to A4 instead of crazy US Letter format. 
  { :page_size => "A4", :page_layout => :portrait }.merge(options)
end

def precompiled_template(locals)

def precompiled_template(locals)
  data.to_str
end

def prepare

def prepare
  @engine = ::Prawn::Document.new(prawn_options)
end