Class: Md2Pdf::Template

Inherits:
Struct
  • Object
show all
Defined in:
lib/md2pdf/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



7
8
9
# File 'lib/md2pdf/template.rb', line 7

def name
  @name
end

#template_locationObject

Returns the value of attribute template_location

Returns:

  • (Object)

    the current value of template_location



7
8
9
# File 'lib/md2pdf/template.rb', line 7

def template_location
  @template_location
end

Instance Method Details

#create(shell) ⇒ Object



12
13
14
15
16
# File 'lib/md2pdf/template.rb', line 12

def create(shell)
  raise TemplateExistsError.new("template #{name} already exists") if exists?
  FileUtils.mkdir_p(template_location.path_for(name))
  shell.exec("pandoc -D latex > #{template_location.path_for(tex_template_path)}")
end

#create_pdf_converter(shell, temp_filename_creator = TempFileCreator) ⇒ Object



8
9
10
# File 'lib/md2pdf/template.rb', line 8

def create_pdf_converter(shell, temp_filename_creator = TempFileCreator)
  wrap_in_backgrounder PandocConverter.new(shell, pandoc_tex_template), shell, temp_filename_creator
end

#exists?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/md2pdf/template.rb', line 18

def exists?
  template_location.contains?(tex_template_path)
end