lib/jackb/highlight.rb in jackb-0.0.5 vs lib/jackb/highlight.rb in jackb-0.0.6.beta

- old
+ new

@@ -1,17 +1,22 @@ -require 'albino' +require 'net/http' +require 'uri' module Jackb class Highlight def self.render(content) self.new.render(content) end def render(content) content.gsub(highlight_regex) do |s| - Albino.new(unescape($2), extract_lang($1)) + code, lang = unescape($2), extract_lang($1) + Net::HTTP.post_form( + URI.parse('http://pygments.appspot.com/'), + {:lang => lang, :code => code} + ).body end end private def unescape(content) @@ -28,6 +33,6 @@ def highlight_regex /<pre><code([^<>]*)>(.*?)<\/code><\/pre>/im end end -end \ No newline at end of file +end