Rescue syntax highlighter exceptions.
git-svn-id: http://svn.redmine.org/redmine/trunk@12451 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
0dc98aabe6
commit
6311ade827
|
@ -20,7 +20,6 @@ module Redmine
|
|||
|
||||
class << self
|
||||
attr_reader :highlighter
|
||||
delegate :highlight_by_filename, :highlight_by_language, :to => :highlighter
|
||||
|
||||
def highlighter=(name)
|
||||
if name.is_a?(Module)
|
||||
|
@ -29,6 +28,18 @@ module Redmine
|
|||
@highlighter = const_get(name)
|
||||
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
|
||||
|
||||
module CodeRay
|
||||
|
|
Loading…
Reference in New Issue