Rescue syntax highlighter exceptions.

git-svn-id: http://svn.redmine.org/redmine/trunk@12451 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-12-23 12:39:18 +00:00
parent 0dc98aabe6
commit 6311ade827
1 changed files with 12 additions and 1 deletions

View File

@ -20,7 +20,6 @@ module Redmine
class << self class << self
attr_reader :highlighter attr_reader :highlighter
delegate :highlight_by_filename, :highlight_by_language, :to => :highlighter
def highlighter=(name) def highlighter=(name)
if name.is_a?(Module) if name.is_a?(Module)
@ -29,6 +28,18 @@ module Redmine
@highlighter = const_get(name) @highlighter = const_get(name)
end end
end end
def highlight_by_filename(text, filename)
highlighter.highlight_by_filename(text, filename)
rescue
ERB::Util.h(text)
end
def highlight_by_language(text, language)
highlighter.highlight_by_language(text, language)
rescue
ERB::Util.h(text)
end
end end
module CodeRay module CodeRay