fix-defect-25634.diff

patch - Go MAEDA, 2017-05-20 09:14

Download (1.64 KB)

View differences:

lib/redmine/syntax_highlighting.rb (working copy)
70 70
        end
71 71

  
72 72
        def language_supported?(language)
73
          ::CodeRay::Scanners.list.include?(language.to_s.downcase.to_sym)
73
          supported_languages =
74
            ::CodeRay::Scanners.list +
75
            ::CodeRay::Scanners.plugin_hash.keys.map(&:to_sym)
76
          supported_languages.include?(language.to_s.downcase.to_sym)
74 77
        rescue
75 78
          false
76 79
        end
test/unit/helpers/application_helper_test.rb (working copy)
1026 1026
    assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
1027 1027
  end
1028 1028

  
1029
  def test_syntax_highlight_by_coderay_alias
1030
    raw = <<-RAW
1031
<pre><code class="ecma_script">
1032
alert("hello, world");
1033
</code></pre>
1034
RAW
1035

  
1036
    expected = <<-EXPECTED
1037
<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>
1038
EXPECTED
1039

  
1040
    assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
1041
  end
1042

  
1029 1043
  def test_to_path_param
1030 1044
    assert_equal 'test1/test2', to_path_param('test1/test2')
1031 1045
    assert_equal 'test1/test2', to_path_param('/test1/test2/')