Sha256: 32ac3a121fbce9e0b5a4c5ea406b3a51aa428654c4d903c05bdf6d586073eb22

Contents?: true

Size: 702 Bytes

Versions: 7

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

# Include other published content
#
# == Basic usage:
#    {%include 'navigation'}
#
# == Advanced usage:
#    {%include 'navigation' title:"Menu"}
#
# This allows you pass variables to the included content, which will only available there
#
class IncludeTag < LiquidumTag
  def render(context)
    super

    content = context.registers['file_system'].read_template_file(argv1)

    result = ''
    context.stack do
      context['include'] = Scribo::IncludeDrop.new(attr_args.deep_stringify_keys)
      result += Liquidum.render(content, context: context, registers: context.registers)
    end
    result
  end
end

Liquid::Template.register_tag('include', IncludeTag)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
scribo-1.0.44 lib/scribo/liquid/tags/include_tag.rb
scribo-1.0.43 lib/scribo/liquid/tags/include_tag.rb
scribo-1.0.42 lib/scribo/liquid/tags/include_tag.rb
scribo-1.0.41 lib/scribo/liquid/tags/include_tag.rb
scribo-1.0.40 lib/scribo/liquid/tags/include_tag.rb
scribo-1.0.39 lib/scribo/liquid/tags/include_tag.rb
scribo-1.0.38 lib/scribo/liquid/tags/include_tag.rb