summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/redmine/syntax_highlighting.rb5
-rw-r--r--test/unit/helpers/application_helper_test.rb14
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 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
+<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\">&quot;</span><span class=\"content\">hello, world</span><span class=\"delimiter\">&quot;</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/')