0002-Pull-up-retrieve_supported_languages-private-class-m.patch

Mischa The Evil, 2017-05-28 15:56

Download (1.56 KB)

View differences:

lib/redmine/syntax_highlighting.rb
55 55
    module CodeRay
56 56
      require 'coderay'
57 57

  
58
      def self.retrieve_supported_languages
59
        ::CodeRay::Scanners.list +
60
        # Add CodeRay scanner aliases
61
        ::CodeRay::Scanners.plugin_hash.keys.map(&:to_sym) -
62
        # Remove internal CodeRay scanners
63
        %w(debug default raydebug scanner).map(&:to_sym)
64
      end
65
      private_class_method :retrieve_supported_languages
66

  
58 67
      class << self
59 68
        # Highlights +text+ as the content of +filename+
60 69
        # Should not return line numbers nor outer pre tag
......
70 79
        end
71 80

  
72 81
        def language_supported?(language)
73
          supported_languages =
74
            ::CodeRay::Scanners.list +
75
            ::CodeRay::Scanners.plugin_hash.keys.map(&:to_sym) -
76
            %w(debug default raydebug scanner).map(&:to_sym)
82
          supported_languages = retrieve_supported_languages
77 83
          supported_languages.include?(language.to_s.downcase.to_sym)
78 84
        rescue
79 85
          false
80
-