Switch to Pygments.rb

This commit is contained in:
Joshua Peek
2011-08-22 10:55:39 -05:00
parent e70ffb93ba
commit bb11317546
5 changed files with 36 additions and 52 deletions

View File

@@ -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