From e5623691100d498b23599a83cdfa648f262beb40 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 10 Oct 2011 11:29:58 -0500 Subject: [PATCH] Skip colorizing minified js --- lib/linguist/blob_helper.rb | 3 +-- test/test_blob.rb | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/linguist/blob_helper.rb b/lib/linguist/blob_helper.rb index 069e7372..be4483cf 100644 --- a/lib/linguist/blob_helper.rb +++ b/lib/linguist/blob_helper.rb @@ -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{
(.*?)
\s*
}m, 1] else diff --git a/test/test_blob.rb b/test/test_blob.rb index 56cd7f5e..adcdd226 100644 --- a/test/test_blob.rb +++ b/test/test_blob.rb @@ -431,4 +431,8 @@ class TestBlob < Test::Unit::TestCase end HTML end + + def test_colorize_skips_minified_files + assert_nil blob("jquery-1.6.1.min.js").colorize + end end