mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Switch to Pygments.rb
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
require 'albino'
|
||||
require 'pygments'
|
||||
require 'yaml'
|
||||
|
||||
module Linguist
|
||||
@@ -55,16 +55,6 @@ module Linguist
|
||||
end
|
||||
end
|
||||
|
||||
# Internal: Test if system has Pygments
|
||||
#
|
||||
# Only used in tests to disable tests that require Pygments.
|
||||
#
|
||||
# Returns true if `pygmentize` in is PATH otherwise false.
|
||||
def self.has_pygments?
|
||||
`which #{Albino.bin}`
|
||||
$?.success?
|
||||
end
|
||||
|
||||
# Public: Get all Lexers
|
||||
#
|
||||
# Returns an Array of Lexers
|
||||
@@ -141,7 +131,7 @@ module Linguist
|
||||
#
|
||||
# Returns html String
|
||||
def colorize(text)
|
||||
Albino.new(text, self).colorize(:O => 'stripnl=false')
|
||||
Pygments.highlight(text, :lexer => aliases.first, :options => {:stripnl => false})
|
||||
end
|
||||
|
||||
# Public: Highlight syntax of text without the outer highlight div
|
||||
|
||||
Reference in New Issue
Block a user