]> source.dussan.org Git - redmine.git/commitdiff
Pull-up retrieve_supported_languages private class method (#26055).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 6 Jun 2017 21:55:29 +0000 (21:55 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 6 Jun 2017 21:55:29 +0000 (21:55 +0000)
Patch by Mischa The Evil.

git-svn-id: http://svn.redmine.org/redmine/trunk@16623 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/syntax_highlighting.rb

index 6d0eab371172923046f5f652ed50544f685c093e..580ed68771a729d85517f0944ac8480338a49ff8 100644 (file)
@@ -55,6 +55,15 @@ 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
+
       class << self
         # Highlights +text+ as the content of +filename+
         # Should not return line numbers nor outer pre tag
@@ -70,10 +79,7 @@ module Redmine
         end
 
         def language_supported?(language)
-          supported_languages =
-            ::CodeRay::Scanners.list +
-            ::CodeRay::Scanners.plugin_hash.keys.map(&:to_sym) -
-            %w(debug default raydebug scanner).map(&:to_sym)
+          supported_languages = retrieve_supported_languages
           supported_languages.include?(language.to_s.downcase.to_sym)
         rescue
           false