Skip colorizing minified js

This commit is contained in:
Joshua Peek
2011-10-10 11:29:58 -05:00
parent 8c135a9eff
commit e562369110
2 changed files with 5 additions and 2 deletions

View File

@@ -562,7 +562,7 @@ module Linguist
#
# Returns html String
def colorize(options = {})
return if !text? || large?
return if !text? || large? || generated?
options[:options] ||= {}
options[:options][:encoding] ||= encoding
lexer.highlight(data, options)
@@ -575,7 +575,6 @@ module Linguist
#
# Returns html String
def colorize_without_wrapper(options = {})
return if !text? || large?
if text = colorize(options)
text[%r{<div class="highlight"><pre>(.*?)</pre>\s*</div>}m, 1]
else

View File

@@ -431,4 +431,8 @@ class TestBlob < Test::Unit::TestCase
<span class="k">end</span>
HTML
end
def test_colorize_skips_minified_files
assert_nil blob("jquery-1.6.1.min.js").colorize
end
end