Sha256: da784bdb4e0099facb8c1729acf9db24d01087c7f606201b1e94936882c88056
Contents?: true
Size: 854 Bytes
Versions: 39
Compression:
Stored size: 854 Bytes
Contents
module Nanoc::Filters # @since 3.4.0 # # @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
39 entries across 39 versions & 1 rubygems