Skip to content

Instantly share code, notes, and snippets.

@rmanalan
Created May 7, 2009 20:15
Show Gist options
  • Select an option

  • Save rmanalan/108326 to your computer and use it in GitHub Desktop.

Select an option

Save rmanalan/108326 to your computer and use it in GitHub Desktop.
require 'redcloth'
module ActionView
class TextileRenderer < ActionView::TemplateHandler
include ActionView::TemplateHandlers::Compilable
def compile(template)
"textile_doc = RedCloth.new(template, [:hard_breaks]).to_html"
end
def cache_fragment(block, name = {}, options = nil)
@view.fragment_for(block, name, options) do
eval("textile_doc", block.binding)
end
end
end
end
ActionView::Template.register_template_handler :txtl, ActionView::TextileRenderer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment