]> source.dussan.org Git - redmine.git/commitdiff
Merged r16568 (#25634).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 27 May 2017 08:36:05 +0000 (08:36 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 27 May 2017 08:36:05 +0000 (08:36 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@16570 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/syntax_highlighting.rb
test/unit/helpers/application_helper_test.rb

index 7f4334977d9a9aaf4074fa8e90cddc4ae52dfe9f..4380627ac258eaf4388df2158d0d6dc1faa56c23 100644 (file)
@@ -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
index c82922cd007651f441b1458607fa563b1bd6843c..4b7eaea426155c2e703a097271fc0517c006a9f2 100644 (file)
@@ -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/')