Parent

Methods

Class/Module Index [+]

Quicksearch

Nanoc::Filters::Handlebars

@since 3.4.0

Public Instance Methods

run(content, params={}) click to toggle source

Runs the content through [Handlebars](handlebarsjs.com/) using [Handlebars.rb](github.com/cowboyd/handlebars.rb). This method takes no options.

@param [String] content The content to filter

@return [String] The filtered content

# File lib/nanoc/filters/handlebars.rb, line 17
def run(content, params={})
  context = item.attributes.dup
  context[:item]   = assigns[:item].attributes
  context[:layout] = assigns[:layout].attributes
  context[:config] = assigns[:config]
  context[:yield]  = assigns[:content]

  handlebars = ::Handlebars::Context.new
  template = handlebars.compile(content)
  template.call(context)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.