Sha256: 64a9dd7a3ed3808b07bd6defe15bfdf481010cc37d666bc6a67071963d098509
Contents?: true
Size: 803 Bytes
Versions: 1
Compression:
Stored size: 803 Bytes
Contents
# encoding: utf-8 require 'handlebars' module Nanoc::Filters # @since 3.4.0 class Handlebars < Nanoc::Filter # Runs the content through # [Handlebars](http://handlebarsjs.com/) using # [Handlebars.rb](https://github.com/cowboyd/handlebars.rb). # This method takes no options. # # @param [String] content The content to filter # # @return [String] The filtered content 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nanoc-3.4.3 | lib/nanoc/filters/handlebars.rb |