Module: Latexpdf

Defined in:
lib/latexpdf/pdf_generator.rb,
lib/latexpdf.rb,
lib/latexpdf/escaper.rb,
lib/latexpdf/railtie.rb,
lib/latexpdf/version.rb,
lib/latexpdf/configuration.rb,
lib/latexpdf/errors/latexpdf_error.rb

Overview

Handles the creation of a PDF

generate will generate a PDF cleanup removes the build dir and all related files. Should be called after generation of PDF; also after a failure errors will contain latex log on failure

Defined Under Namespace

Classes: Configuration, Escaper, LatexpdfError, PdfGenerator, Railtie

Constant Summary collapse

VERSION =
"0.6.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject



27
28
29
# File 'lib/latexpdf.rb', line 27

def self.configuration
  @configuration ||= Configuration.new
end

.loggerObject



35
36
37
# File 'lib/latexpdf.rb', line 35

def self.logger
  @logger ||= configuration.logger
end

Class Method Details

.compile(tex, target = nil) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'lib/latexpdf.rb', line 39

def self.compile(tex, target=nil)
  generator = PdfGenerator.new(tex)
  begin
    generator.generate target
    generator.content unless target
  ensure
    generator.cleanup
  end
end

.configure {|configuration| ... } ⇒ Object

Yields:



31
32
33
# File 'lib/latexpdf.rb', line 31

def self.configure
  yield configuration
end

.escape_latex(text) ⇒ Object



36
37
38
# File 'lib/latexpdf/escaper.rb', line 36

def self.escape_latex(text)
  latex_escaper.tex_safe(text)
end