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
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\">"</span><span class=\"content\">hello, world</span><span class=\"delimiter\">"</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/')