summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-07 19:35:27 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-07 19:35:27 +0000
commit49108983cb69f00e7adf1544284bd03a1d97e575 (patch)
tree1d574a2c55e8ea8bb8e2d813c91d5b05d66c0779 /lib
parent635daf888aca1f029011e1bebde5ac94dd0d4083 (diff)
downloadredmine-49108983cb69f00e7adf1544284bd03a1d97e575.tar.gz
redmine-49108983cb69f00e7adf1544284bd03a1d97e575.zip
Merged r16622 to r16625 (#26055).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@16630 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/syntax_highlighting.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/redmine/syntax_highlighting.rb b/lib/redmine/syntax_highlighting.rb
index 4380627ac..feff4f6b7 100644
--- a/lib/redmine/syntax_highlighting.rb
+++ b/lib/redmine/syntax_highlighting.rb
@@ -55,6 +55,17 @@ module Redmine
module CodeRay
require 'coderay'
+ def self.retrieve_supported_languages
+ ::CodeRay::Scanners.list +
+ # Add CodeRay scanner aliases
+ ::CodeRay::Scanners.plugin_hash.keys.map(&:to_sym) -
+ # Remove internal CodeRay scanners
+ %w(debug default raydebug scanner).map(&:to_sym)
+ end
+ private_class_method :retrieve_supported_languages
+
+ SUPPORTED_LANGUAGES = retrieve_supported_languages
+
class << self
# Highlights +text+ as the content of +filename+
# Should not return line numbers nor outer pre tag
@@ -70,10 +81,7 @@ module Redmine
end
def language_supported?(language)
- supported_languages =
- ::CodeRay::Scanners.list +
- ::CodeRay::Scanners.plugin_hash.keys.map(&:to_sym)
- supported_languages.include?(language.to_s.downcase.to_sym)
+ SUPPORTED_LANGUAGES.include?(language.to_s.downcase.to_sym)
rescue
false
end