Sha256: c577a66b005d3f62d4f880f07dded3459bd9b6178f70f466d9ef26b005b170a4
Contents?: true
Size: 813 Bytes
Versions: 71
Compression:
Stored size: 813 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 class << self def render(view, tag, given_options, &block) tag_name = tag.tag_name options = given_options.merge(formatted_options(tag)) if VOID_TAGS.include?(tag_name.to_s) view.tag(tag_name, options) else view.content_tag(tag_name, tag.content(&block), 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
71 entries across 71 versions & 1 rubygems