Created
June 21, 2009 05:19
-
-
Save tenderlove/133413 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
module ActionView | |
module TemplateHandlers | |
class Nokogiri < TemplateHandler | |
include Compilable | |
def compile template | |
<<-eotemplate | |
_set_controller_content_type(Mime::XML) | |
builder = ::Nokogiri::XML::Builder.new do |xml| | |
#{template.source} | |
end | |
builder.to_xml | |
eotemplate | |
end | |
end | |
end | |
end | |
ActionView::Template.register_template_handler :nokogiri, | |
ActionView::TemplateHandlers::Nokogiri |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment