diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-05-27 08:36:13 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-05-27 08:36:13 +0000 |
commit | c2e613981a138bab2362519c5c3952b0d318c157 (patch) | |
tree | 4a6d85d96b528713100439a610274c7ecb7cf44f | |
parent | d54ede781b60207dc9163e5953c04a52bac82c42 (diff) | |
download | redmine-c2e613981a138bab2362519c5c3952b0d318c157.tar.gz redmine-c2e613981a138bab2362519c5c3952b0d318c157.zip |
Merged r16568 (#25634).
git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@16571 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | lib/redmine/syntax_highlighting.rb | 5 | ||||
-rw-r--r-- | test/unit/helpers/application_helper_test.rb | 14 |
2 files changed, 18 insertions, 1 deletions
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 +<pre><code class="ecma_script"> +alert("hello, world"); +</code></pre> +RAW + + expected = <<-EXPECTED +<pre><code class=\"ecma_script syntaxhl\"><span class=\"CodeRay\">alert(<span class=\"string\"><span class=\"delimiter\">"</span><span class=\"content\">hello, world</span><span class=\"delimiter\">"</span></span>);</span></code></pre> +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/') |