Sha256: c1b62e3fc86754bb77abeb3a4d996ce287254e844f366b673f271d317f151e83
Contents?: true
Size: 873 Bytes
Versions: 4
Compression:
Stored size: 873 Bytes
Contents
# encoding: utf-8 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
nanoc-4.0.0b2 | lib/nanoc/filters/handlebars.rb |
nanoc-4.0.0b1 | lib/nanoc/filters/handlebars.rb |
nanoc-4.0.0a2 | lib/nanoc/filters/handlebars.rb |
nanoc-4.0.0a1 | lib/nanoc/filters/handlebars.rb |