Sha256: cae25c1440b5246fd2aa1d9b2f606be2d1bf3b24e81c70247142037357208b50

Contents?: true

Size: 489 Bytes

Versions: 1

Compression:

Stored size: 489 Bytes

Contents

module Nanoc::Filters
  # @api private
  class Mustache < Nanoc::Filter
    requires 'mustache'

    # Runs the content through
    # [Mustache](http://github.com/defunkt/mustache). This method takes no
    # options.
    #
    # @param [String] content The content to filter
    #
    # @return [String] The filtered content
    def run(content, _params = {})
      context = item.attributes.merge({ yield: assigns[:content] })
      ::Mustache.render(content, context)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nanoc-4.4.5 lib/nanoc/filters/mustache.rb