1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-06 23:51:31 +00:00

Highlight language aliases are no more supported (#25634).

Patch by Go MAEDA.

git-svn-id: http://svn.redmine.org/redmine/trunk@16568 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2017-05-27 07:53:16 +00:00
parent 7634d1a380
commit 8ba7b6a2b2
2 changed files with 18 additions and 1 deletions

View 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

View 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/')