Sha256: 5e50f941b86687e1f8af9f2a38a2ecc9bacfdf8c9473294290a6ccde98c551c0
Contents?: true
Size: 833 Bytes
Versions: 3
Compression:
Stored size: 833 Bytes
Contents
module Nanoc::Filters # @api private 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[:config] = assigns[:config] context[:yield] = assigns[:content] if assigns.key?(:layout) context[:layout] = assigns[:layout].attributes end handlebars = ::Handlebars::Context.new template = handlebars.compile(content) template.call(context) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nanoc-4.4.7 | lib/nanoc/filters/handlebars.rb |
nanoc-4.4.6 | lib/nanoc/filters/handlebars.rb |
nanoc-4.4.5 | lib/nanoc/filters/handlebars.rb |