Skip to content

Commit

Permalink
Use Rouge's supported lexers to determine language support
Browse files Browse the repository at this point in the history
This fixes syntax highlighting in all pages that use textilizable() for
formatting (ex: Issues, Wiki pages, etc)
  • Loading branch information
alexbevi committed Jan 11, 2018
1 parent 0701599 commit f9ae069
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ def stream(tokens, &b)
end

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)
Rouge::Lexer.all.map(&:filenames).flatten.map { |l| l.gsub('*.', '') }.sort
end
private_class_method :retrieve_supported_languages

Expand Down Expand Up @@ -58,7 +54,7 @@ def highlight_by_language(text, language)
end

def language_supported?(language)
SUPPORTED_LANGUAGES.include?(language.to_s.downcase.to_sym)
SUPPORTED_LANGUAGES.include?(language.to_s.downcase)
rescue
false
end
Expand Down

0 comments on commit f9ae069

Please sign in to comment.