Sha256: c20c615e290511f4dd1dcf1b8caaca2670349f115fc1c72d8c8294b026e0f49b

Contents?: true

Size: 882 Bytes

Versions: 8

Compression:

Stored size: 882 Bytes

Contents

module Locomotive
  module Steam
    module Liquid

      class Template < ::Liquid::Template

        # When we render a Locomotive template, we need to know what are
        # the default content of all the editable elements.
        # Without this, developers are unable to use statements like
        # the following: {{ page.editable_elements.content.header.title }}
        def render(*args)
          if args.first && args.first.is_a?(::Liquid::Context)
            content = @options[:default_editable_content]
            args.first.registers[:default_editable_content] = content
          end

          super
        end

        class << self

          def parse(source, options = {})
            template = new
            template.parse(source, options.merge({
              line_numbers: true
            }))
          end

        end

      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
locomotivecms_steam-1.4.1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.4.0 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.4.0.rc2 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.4.0.rc1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.4.0.pre.rc.1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.3.0 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.3.0.rc2 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.3.0.rc1 lib/locomotive/steam/liquid/template.rb