Class: Locomotive::Steam::Liquid::Template

Inherits:
Liquid::Template
  • Object
show all
Defined in:
lib/locomotive/steam/liquid/template.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(source, options = {}) ⇒ Object



20
21
22
23
24
25
# File 'lib/locomotive/steam/liquid/template.rb', line 20

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

Instance Method Details

#render(*args) ⇒ Object

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 }



10
11
12
13
14
15
16
17
# File 'lib/locomotive/steam/liquid/template.rb', line 10

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