Sha256: 3531201a1be3de58db4da5133f4ca9ae9779782df22a8a18fc7805dac21deb28
Contents?: true
Size: 912 Bytes
Versions: 35
Compression:
Stored size: 912 Bytes
Contents
module Scrivito module TagRenderer VOID_TAGS = %w[area base br col command embed hr img input keygen link meta param source track wbr] def render(given_options = {}, &block) TagRenderer.render(view, self, given_options, &block) end def html_options {} end class << self def render(view, tag, given_options, &block) content = tag.content(&block) tag_name = tag.tag_name options = given_options .merge(tag.html_options) .merge(formatted_options(tag)) if VOID_TAGS.include?(tag_name.to_s) view.tag(tag_name, options) else view.content_tag(tag_name, content, options) end end private def formatted_options(tag) formatted_options = {} tag.options.each do |key, value| formatted_options["data-scrivito-#{key}"] = value end formatted_options end end end end
Version data entries
35 entries across 35 versions & 1 rubygems