mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-02-13 19:59:34 +00:00
Add colorize_without_wrapper
This commit is contained in:
@@ -137,5 +137,10 @@ module Linguist
|
||||
return if !text? || large?
|
||||
lexer.colorize(data)
|
||||
end
|
||||
|
||||
def colorize_without_wrapper
|
||||
return if !text? || large?
|
||||
lexer.colorize_without_wrapper(data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -81,6 +81,10 @@ module Linguist
|
||||
lexer.colorize(text)
|
||||
end
|
||||
|
||||
def colorize_without_wrapper(text)
|
||||
lexer.colorize_without_wrapper(text)
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
eql?(other)
|
||||
end
|
||||
|
||||
@@ -23,7 +23,15 @@ module Linguist
|
||||
end
|
||||
|
||||
def colorize(text)
|
||||
Albino.colorize(text, to_s)
|
||||
Albino.colorize(text, self)
|
||||
end
|
||||
|
||||
def colorize_without_wrapper(text)
|
||||
if text = colorize(text)
|
||||
text[%r{<div class="highlight"><pre>(.*?)</pre>\s*</div>}m, 1]
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
|
||||
Reference in New Issue
Block a user