Class: Template::Handlers::ERBLatex

Inherits:
ERB
  • Object
show all
Defined in:
lib/rails-latex/erb_latex.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(template, source = nil) ⇒ Object



9
10
11
12
# File 'lib/rails-latex/erb_latex.rb', line 9

def self.call(template, source = nil)
  source ||= template.source
  new.compile(template, source)
end

Instance Method Details

#compile(template, source) ⇒ Object



14
15
16
17
18
# File 'lib/rails-latex/erb_latex.rb', line 14

def compile(template, source)
  erb = "<% __in_erb_template=true %>#{source}"
  out=self.class.erb_implementation.new(erb, :trim=>(self.class.erb_trim_mode == "-")).src
  out + ";LatexToPdf.generate_pdf(@output_buffer.to_s, @latex_config||{})"
end