Sha256: cc7307c7c849904a4a9d332e29788d6b85bbd171742b10a639f4cc30e6ecf880

Contents?: true

Size: 547 Bytes

Versions: 3

Compression:

Stored size: 547 Bytes

Contents

module PufferPages
  module Liquid
    module Tags

      class Yield < ::Liquid::Tag
        Syntax = /(\w+)/

        def initialize(tag_name, markup, tokens)
          if markup =~ Syntax
            @name = $1
          else
            @name = PufferPages.primary_page_part_name
          end

          super
        end

        def render(context)
          swallow_nil{context.registers[:page].part(@name).render(context)}
        end
      end

    end
  end
end

Liquid::Template.register_tag('yield', PufferPages::Liquid::Tags::Yield)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
puffer_pages-0.0.5 lib/puffer_pages/liquid/tags/yield.rb
puffer_pages-0.0.4 lib/puffer_pages/liquid/tags/yield.rb
puffer_pages-0.0.3 lib/puffer_pages/liquid/tags/yield.rb