# File lib/nanoc/filters/colorize_syntax.rb, line 187 def pygmentize(code, language, params={}) require 'systemu' check_availability('pygmentize', '-V') params[:encoding] ||= 'utf-8' params[:nowrap] ||= 'True' # Build command cmd = [ 'pygmentize', '-l', language, '-f', 'html' ] cmd << '-O' << params.map { |k,v| "#{k}=#{v}" }.join(',') unless params.empty? # Run command stdout = StringIO.new systemu cmd, 'stdin' => code, 'stdout' => stdout # Get result stdout.rewind stdout.read end