Class: Octopress::Printable::LatexConverter

Inherits:
Converter
  • Object
show all
Defined in:
lib/octopress-printable/latex.rb

Instance Attribute Summary

Attributes inherited from Converter

#match

Instance Method Summary collapse

Methods inherited from Converter

#before_xelatex, #envs, get_includes, #header, #initialize, #last_xelatex, #pandoc_args, timestamp, #xelatex_args

Constructor Details

This class inherits a constructor from Octopress::Printable::Converter

Instance Method Details

#convert(line) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/octopress-printable/latex.rb', line 5

def convert(line)
  str = line
  while /{{\s+(?<arg>\S+)\s*\|\s*latex:(?<cmd>\S+)\s*\s*}}/ =~ str
    @match = true
    if ! arg.gsub!(/\A"|"\Z/, '')
      arg.gsub!(/\A'|'\Z/, '')
    end

    str.sub!(/{{\s+\S+\s*\|\s*latex:\S+\s*}}/, "(\\#{cmd}{#{arg}})")
  end

  str
end