Class: Henshin::LiquidPlugin

Inherits:
Layoutor show all
Defined in:
lib/henshin/plugins/liquid.rb

Defined Under Namespace

Modules: Filters Classes: Include

Instance Attribute Summary

Attributes inherited from Plugin

#config, #extensions, #priority

Instance Method Summary collapse

Methods inherited from Plugin

#<=>, subclasses

Constructor Details

#initialize(site) ⇒ LiquidPlugin

Returns a new instance of LiquidPlugin.



6
7
8
9
10
11
12
13
# File 'lib/henshin/plugins/liquid.rb', line 6

def initialize(site)
  @config = {}
  
  if site.config['liquid']
    @config = site.config['liquid']
    @config['include_dir'] = File.join(site.root, @config['include_dir'])
  end
end

Instance Method Details

#generate(content, data) ⇒ Object



15
16
17
18
# File 'lib/henshin/plugins/liquid.rb', line 15

def generate( content, data )
  reg = {:include_dir => @config['include_dir']}
  Liquid::Template.parse(content).render(data, :registers => reg)
end