Sha256: 7c7ff1b3af9bb8fd7846ae6504f280f774c042cdfbf06502ffe8d830ed061f6c
Contents?: true
Size: 810 Bytes
Versions: 7
Compression:
Stored size: 810 Bytes
Contents
# encoding: utf-8 module Nanoc::Filters # @since 3.4.0 class Handlebars < Nanoc::Filter requires 'handlebars' # 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
7 entries across 7 versions & 1 rubygems