Sha256: 87789359e199b03184b15cda0ad1bb8933488b66aab98bd355718d60e8097d32
Contents?: true
Size: 1018 Bytes
Versions: 1
Compression:
Stored size: 1018 Bytes
Contents
module ExpressTemplates module Components # Provide a wrapper for the content_for helper which # accepts a block of express template code. # # Example: # # ```ruby # content_for(:header) { # h1 "Title" # } # ``` class ContentFor < Container include Capabilities::Configurable def compile children_markup = compile_children content_label = @args[0] result = %Q|\ncontent_for(:#{content_label}| if children_markup.empty? if @args[1].kind_of?(String) children_markup = @args[1] # append children as argument result << %Q|, "#{children_markup}".html_safe).to_s| else # no markup specified - must be referencing the content result << ").to_s" end else # append children in block form result << %Q|) { (#{children_markup.gsub(/^\s+/, '')}).html_safe }.to_s| end result end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
express_templates-0.3.1 | lib/express_templates/components/content_for.rb |