class Rembrandt::Engines::Pygmentize

Public Class Methods

available?() click to toggle source
# File lib/rembrandt/engines/pygmentize.rb, line 13
def self.available?
  present_on_system?
end
present_on_system?() click to toggle source
# File lib/rembrandt/engines/pygmentize.rb, line 17
def self.present_on_system?
  !`which pygmentize`.empty?
end

Public Instance Methods

highlight(input, language) click to toggle source
# File lib/rembrandt/engines/pygmentize.rb, line 4
def highlight(input, language)
  tmp_file = File.open(".colorize_temp", "w")
  tmp_file.write(input)
  tmp_file.close
  output = `pygmentize -f html -l #{language} -O encoding=utf8 .colorize_temp`
  `rm .colorize_temp`
  output
end