Sha256: db96d47ac991b914ffca71bb10fe3bb623691aa8089c4c7e80a1881fcb65dce4
Contents?: true
Size: 782 Bytes
Versions: 1
Compression:
Stored size: 782 Bytes
Contents
require "nokogiri" require "we_bridge/html_builder/version" require "we_bridge/html_builder/handler" module WeBridge module HtmlBuilder def markup(tag_name=nil, option={}) root = Nokogiri::HTML::DocumentFragment.parse('') Nokogiri::HTML::Builder.with(root) do |doc| if tag_name doc.send(tag_name, options) do yield doc end else yield doc end end r = root.to_html r = r.html_safe if r.respond_to? :html_safe r end def self.register_template_handler(extension = nil) handler = WeBridge::HtmlBuilder::Handler ActionView::Template.register_template_handler(extension || handler.default_extension, handler) if defined? ActionView::Template end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
we_bridge-html_builder-0.1.0 | lib/we_bridge/html_builder.rb |