mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-02-15 12:49:30 +00:00
Skip colorizing minified js
This commit is contained in:
@@ -562,7 +562,7 @@ module Linguist
|
|||||||
#
|
#
|
||||||
# Returns html String
|
# Returns html String
|
||||||
def colorize(options = {})
|
def colorize(options = {})
|
||||||
return if !text? || large?
|
return if !text? || large? || generated?
|
||||||
options[:options] ||= {}
|
options[:options] ||= {}
|
||||||
options[:options][:encoding] ||= encoding
|
options[:options][:encoding] ||= encoding
|
||||||
lexer.highlight(data, options)
|
lexer.highlight(data, options)
|
||||||
@@ -575,7 +575,6 @@ module Linguist
|
|||||||
#
|
#
|
||||||
# Returns html String
|
# Returns html String
|
||||||
def colorize_without_wrapper(options = {})
|
def colorize_without_wrapper(options = {})
|
||||||
return if !text? || large?
|
|
||||||
if text = colorize(options)
|
if text = colorize(options)
|
||||||
text[%r{<div class="highlight"><pre>(.*?)</pre>\s*</div>}m, 1]
|
text[%r{<div class="highlight"><pre>(.*?)</pre>\s*</div>}m, 1]
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -431,4 +431,8 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
<span class="k">end</span>
|
<span class="k">end</span>
|
||||||
HTML
|
HTML
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_colorize_skips_minified_files
|
||||||
|
assert_nil blob("jquery-1.6.1.min.js").colorize
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user