Permalink
Browse files

Separated Pygments (pygments.rb) and Rygments.

  • Loading branch information...
1 parent 8160893 commit 5e5d2cc8d2096e5b6bbc7176cf1c2f64452b5c80 @jclem jclem committed Dec 12, 2011
Showing with 12 additions and 1 deletion.
  1. +12 −1 lib/rack/codehighlighter.rb
@@ -135,7 +135,18 @@ def pygments(string)
if refs
lang = refs[1]
str = unescape_html(string.sub(@opts[:pattern], ""))
- #Pygments.highlight(str, :lexer => lang, :formatter => 'html')
+ options = @opts[:options]
+ Pygments.highlight(str, :lexer => lang, :formatter => 'html', :options => options)
+ else
+ "<pre>#{string}</pre>"
+ end
+ end
+
+ def rygments(string)
+ refs = @opts[:pattern].match(string)
+ if refs
+ lang = refs[1]
+ str = unescape_html(string.sub(@opts[:pattern], ""))
Rygments.highlight_string(str, lang, 'html')
else
"<pre>#{string}</pre>"

0 comments on commit 5e5d2cc

Please sign in to comment.