From: Jean-Philippe Lang Date: Sat, 27 May 2017 08:36:05 +0000 (+0000) Subject: Merged r16568 (#25634). X-Git-Tag: 3.3.4~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e24ba3b90722aeaa1a6db19a6eb28a880472ebac;p=redmine.git Merged r16568 (#25634). git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@16570 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/lib/redmine/syntax_highlighting.rb b/lib/redmine/syntax_highlighting.rb index 7f4334977..4380627ac 100644 --- a/lib/redmine/syntax_highlighting.rb +++ b/lib/redmine/syntax_highlighting.rb @@ -70,7 +70,10 @@ module Redmine end def language_supported?(language) - ::CodeRay::Scanners.list.include?(language.to_s.downcase.to_sym) + supported_languages = + ::CodeRay::Scanners.list + + ::CodeRay::Scanners.plugin_hash.keys.map(&:to_sym) + supported_languages.include?(language.to_s.downcase.to_sym) rescue false end diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index c82922cd0..4b7eaea42 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -1020,6 +1020,20 @@ EXPECTED assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') end + def test_syntax_highlight_by_coderay_alias + raw = <<-RAW +

+alert("hello, world");
+
+RAW + + expected = <<-EXPECTED +
alert("hello, world");
+EXPECTED + + assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') + end + def test_to_path_param assert_equal 'test1/test2', to_path_param('test1/test2') assert_equal 'test1/test2', to_path_param('/test1/test2/')