]> source.dussan.org Git - redmine.git/commitdiff
Highlight language aliases are no more supported (#25634).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 27 May 2017 07:53:16 +0000 (07:53 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 27 May 2017 07:53:16 +0000 (07:53 +0000)
Patch by Go MAEDA.

git-svn-id: http://svn.redmine.org/redmine/trunk@16568 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 500fbd86e783b6dd6740873758b5fc7683b1ab77..ec90151e507637e00a66f792f09745d7498d502a 100644 (file)
@@ -1026,6 +1026,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/')