lib/review/latexutils.rb in review-1.7.2 vs lib/review/latexutils.rb in review-2.0.0.beta1
- old
+ new
@@ -15,22 +15,22 @@
module ReVIEW
module LaTeXUtils
METACHARS = {
- '#' => '\#',
- "$" => '\textdollar{}',
+ '#' => '\#',
+ "$" => '\textdollar{}',
'%' => '\%',
'&' => '\&',
'{' => '\{',
'}' => '\}',
- '_' => '\textunderscore{}',
+ '_' => '\textunderscore{}',
'^' => '\textasciicircum{}',
'~' => '\textasciitilde{}',
'|' => '\textbar{}',
- '<' => '\textless{}',
- '>' => '\textgreater{}',
+ '<' => '\textless{}',
+ '>' => '\textgreater{}',
"\\" => '\reviewbackslash{}',
"-" => '{-}',
'⓪' => '\UTF{24EA}',
'①' => '\UTF{2460}',
@@ -68,10 +68,10 @@
end
alias_method :escape, :escape_latex
def unescape_latex(str)
- metachars_invert_re = Regexp.new(METACHARS_INVERT.keys.collect{|key| Regexp.escape(key)}.join('|'))
+ metachars_invert_re = Regexp.new(METACHARS_INVERT.keys.collect{|key| Regexp.escape(key)}.join('|'))
str.gsub(metachars_invert_re) {|s|
METACHARS_INVERT[s] or raise "unknown trans char: #{s}"
}
end