update albino to 1.2.3, handle bad code blocks gracefully

This commit is contained in:
rick
2011-01-12 15:00:58 -08:00
parent c5e4935e85
commit 9a4e2e39a8
4 changed files with 16 additions and 30 deletions
+2 -20
View File
@@ -1,30 +1,12 @@
require 'albino'
class Gollum::Albino < Albino
def self.bin
Albino.bin
end
def bin
Albino.bin
end
self.bin = ::Albino.bin
self.default_encoding = ::Albino.default_encoding
def colorize(options = {})
html = super.to_s
html.sub!(%r{</pre></div>\Z}, "</pre>\n</div>")
html
end
# Hotfix for vulnerable versions of Albino
if !instance_methods.include?('shell_escape')
def convert_options(options = {})
@options.merge(options).inject('') do |string, (flag, value)|
string + " -#{flag} #{shell_escape value}"
end
end
def shell_escape(str)
str.to_s.gsub("'", "\\\\'").gsub(";", '\\;')
end
end
end