summaryrefslogtreecommitdiffstats
path: root/lib/redmine/syntax_highlighting.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-12-23 12:39:18 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-12-23 12:39:18 +0000
commit6311ade82708b63b83d30278a1af4c05af4aee6e (patch)
treed4fdc5c91427078e1f8f0f35d520ceaaa0a68d6a /lib/redmine/syntax_highlighting.rb
parent0dc98aabe6352df8875c3a02b6326d0c96fad0c7 (diff)
downloadredmine-6311ade82708b63b83d30278a1af4c05af4aee6e.tar.gz
redmine-6311ade82708b63b83d30278a1af4c05af4aee6e.zip
Rescue syntax highlighter exceptions.
git-svn-id: http://svn.redmine.org/redmine/trunk@12451 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/syntax_highlighting.rb')
-rw-r--r--lib/redmine/syntax_highlighting.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/redmine/syntax_highlighting.rb b/lib/redmine/syntax_highlighting.rb
index a1f94a175..b388262c3 100644
--- a/lib/redmine/syntax_highlighting.rb
+++ b/lib/redmine/syntax_highlighting.rb
@@ -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