Skip to content

Instantly share code, notes, and snippets.

@jamesgolick
Created March 26, 2010 15:54
Show Gist options
  • Save jamesgolick/345040 to your computer and use it in GitHub Desktop.
Save jamesgolick/345040 to your computer and use it in GitHub Desktop.
require 'syntax/convertors/html'
require 'uv'
module Code
BACKGROUND_COLOR = '#2B2B2B'
COLOR = '#E6E1DC'
COLORS = {
:keyword => '#CC7833',
:symbol => '#6E9CBE',
:constant => '#DA4939',
:attribute => '#D0D0FF',
:string => '#A5C261'
}
def code(opts={}, &block)
text = capture_erb(&block)
return if text.empty?
text.gsub!("<%%", "<%")
the_code = Uv.parse( text, "xhtml", opts[:type] || "ruby", false, "twilight")
concat_erb(the_code, block.binding)
end
end
Webby::Helpers.register(Code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment