Ruby 1.9.1 Fixes

Some more fixes to deal with Ruby 1.9.1.
This commit is contained in:
Jacques Distler 2009-12-02 12:46:15 -06:00
parent 063a8ca5a7
commit f7044ecbb4
4 changed files with 11 additions and 6 deletions

View file

@ -338,19 +338,19 @@ Otherwise, a standard `verbatim` environment is used.
\\end{#{name}}\n"
end
SAFE_CHARS = Set.new((?a..?z).to_a + (?A..?Z).to_a)
SAFE_CHARS = Set.new(('a'..'z').to_a + ('A'..'Z').to_a)
# the ultimate escaping
# (is much better than using \verb)
def latex_escape(source)
s="";
source.each_byte do |b|
if b == ?\
source.each_char do |b|
if b == '\\'
s << '~'
elsif SAFE_CHARS.include? b
s << b
else
s += "\\char%d" % b
s += "\\char%d" % b.ord
end
end
s