Sha256: 8dbacc98a07d56f1217e7f527fc5cde7508b733692d8d61d641e82f4ed19d081

Contents?: true

Size: 877 Bytes

Versions: 17

Compression:

Stored size: 877 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

17 entries across 17 versions & 1 rubygems

Version Path
locomotivecms_steam-1.8.0.alpha2 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.8.0.alpha1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.7.1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.7.0 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.6.1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.6.0 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.6.0.rc1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.6.0.beta1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.5.3 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.5.2 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.5.1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.5.0 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.5.0.rc1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.5.0.rc0 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.5.0.beta3 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.5.0.beta2 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.5.0.beta1 lib/locomotive/steam/liquid/template.rb