Module: Polytexnic::Postprocessor::Latex

Included in:
Polytexnic::Postprocessor
Defined in:
lib/polytexnic/postprocessors/latex.rb

Instance Method Summary collapse

Instance Method Details

#extra_escape(string) ⇒ Object

Escapes backslashes even more. Have I mentioned how much I hate backslashes?



20
21
22
# File 'lib/polytexnic/postprocessors/latex.rb', line 20

def extra_escape(string)
  string.gsub('\\', '\\\\\\')
end

#replace_hashes(polytex) ⇒ Object

Restores literal environments (verbatim, code, math, etc.).



8
9
10
11
12
13
14
15
16
# File 'lib/polytexnic/postprocessors/latex.rb', line 8

def replace_hashes(polytex)
  puts polytex if debug?
  polytex.tap do
    literal_cache.each do |key, value|
      puts value.inspect if debug?
      polytex.gsub!(key, extra_escape(escape_backslashes(value)))
    end
  end
end