module TexOutput

Public Instance Methods

add_newlines(str) click to toggle source
# File lib/ruql/tex_output.rb, line 3
def add_newlines(str)
  str.gsub(Regexp.new('<pre>(.*?)</pre>', Regexp::MULTILINE | Regexp::IGNORECASE) ) do |code_section|
    code_section.gsub!("\n"){"\\\\"}
    code_section.gsub!("  "){"\\hspace*{2em}"}      
  end
end
to_tex(str) click to toggle source
# File lib/ruql/tex_output.rb, line 18
def to_tex(str)
  str = str.gsub(@@tex_escape) { |match| "\\#{match}" }
  str = add_newlines(str)
  
  @@tex_replace.each_pair do |match, replace|
    str = str.gsub(match, replace)
  end
  str
end