Do not reset options when calling highlight

This commit is contained in:
Daniel van Hoesel
2013-12-31 13:44:19 +01:00
parent 23a1ae5085
commit 83a742621f
2 changed files with 10 additions and 1 deletions

View File

@@ -485,7 +485,7 @@ module Linguist
#
# Returns html String
def colorize(text, options = {})
lexer.highlight(text, options = {})
lexer.highlight(text, options)
end
# Public: Return name as String representation

View File

@@ -384,6 +384,15 @@ class TestLanguage < Test::Unit::TestCase
<div class="highlight"><pre><span class="k">def</span> <span class="nf">foo</span>
<span class="s1">&#39;foo&#39;</span>
<span class="k">end</span>
</pre></div>
HTML
end
def test_colorize_with_options
assert_equal <<-HTML.chomp, Language['Ruby'].colorize("def foo\n 'foo'\nend\n", :options => { :cssclass => "highlight highlight-ruby" })
<div class="highlight highlight-ruby"><pre><span class="k">def</span> <span class="nf">foo</span>
<span class="s1">&#39;foo&#39;</span>
<span class="k">end</span>
</pre></div>
HTML
end