mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 20:38:47 +00:00
Axe colorize_without_wrapper
This commit is contained in:
@@ -343,19 +343,5 @@ module Linguist
|
|||||||
options[:options][:encoding] ||= encoding
|
options[:options][:encoding] ||= encoding
|
||||||
lexer.highlight(data, options)
|
lexer.highlight(data, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Public: Highlight syntax of blob without the outer highlight div
|
|
||||||
# wrapper.
|
|
||||||
#
|
|
||||||
# options - A Hash of options (defaults to {})
|
|
||||||
#
|
|
||||||
# Returns html String
|
|
||||||
def colorize_without_wrapper(options = {})
|
|
||||||
if text = colorize(options)
|
|
||||||
text[%r{<div class="highlight"><pre>(.*?)</pre>\s*</div>}m, 1]
|
|
||||||
else
|
|
||||||
''
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -321,13 +321,6 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
HTML
|
HTML
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_colorize_without_wrapper
|
|
||||||
assert_equal <<-HTML, blob("Ruby/foo.rb").colorize_without_wrapper
|
|
||||||
<span class="k">module</span> <span class="nn">Foo</span>
|
|
||||||
<span class="k">end</span>
|
|
||||||
HTML
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_colorize_does_skip_minified_files
|
def test_colorize_does_skip_minified_files
|
||||||
assert_nil blob("JavaScript/jquery-1.6.1.min.js").colorize
|
assert_nil blob("JavaScript/jquery-1.6.1.min.js").colorize
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user