lib/jekyll/albino.rb in jsjohnst-jekyll-0.4.1.999.4 vs lib/jekyll/albino.rb in jsjohnst-jekyll-0.4.1.999.6
- old
+ new
@@ -42,30 +42,36 @@
# GitHub // http://github.com
#
require 'open4'
class Albino
- @@bin = Rails.development? ? 'pygmentize' : '/usr/bin/pygmentize' rescue 'pygmentize'
+ @@bin = '/usr/local/bin/pygmentize'
def self.bin=(path)
@@bin = path
end
def self.colorize(*args)
new(*args).colorize
end
- def initialize(target, lexer = :text, format = :html)
+ def initialize(target, lexer = :text, format = :html )
@target = File.exists?(target) ? File.read(target) : target rescue target
@options = { :l => lexer, :f => format }
end
def execute(command)
output = ''
Open4.popen4(command) do |pid, stdin, stdout, stderr|
stdin.puts @target
stdin.close
+
output = stdout.read.strip
+
+# puts "pid : #{ pid }"
+# puts "stdout : #{ stdout.read.strip }"
+# puts "stderr : #{ stderr.read.strip }"
+
end
# rdiscount wants the closing pre on a line by itself
output.gsub( %r(</pre></div>), "</pre>\n</div>" )
end