From c2e613981a138bab2362519c5c3952b0d318c157 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 27 May 2017 08:36:13 +0000 Subject: [PATCH] Merged r16568 (#25634). git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@16571 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/syntax_highlighting.rb | 5 ++++- test/unit/helpers/application_helper_test.rb | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) 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 cbb4ce8a7..e7fcadd03 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/') -- 2.39.5