Sha256: 0f0976c84f27edac90e4078cb45f62ebc733c843e09c90a13895f47fed078c33

Contents?: true

Size: 542 Bytes

Versions: 43

Compression:

Stored size: 542 Bytes

Contents

# frozen_string_literal: true

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

    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

43 entries across 43 versions & 1 rubygems

Version Path
nanoc-4.8.17 lib/nanoc/filters/mustache.rb
nanoc-4.8.16 lib/nanoc/filters/mustache.rb
nanoc-4.8.15 lib/nanoc/filters/mustache.rb
nanoc-4.8.14 lib/nanoc/filters/mustache.rb
nanoc-4.8.13 lib/nanoc/filters/mustache.rb
nanoc-4.8.12 lib/nanoc/filters/mustache.rb
nanoc-4.8.11 lib/nanoc/filters/mustache.rb
nanoc-4.8.10 lib/nanoc/filters/mustache.rb
nanoc-4.8.9 lib/nanoc/filters/mustache.rb
nanoc-4.8.8 lib/nanoc/filters/mustache.rb
nanoc-4.8.7 lib/nanoc/filters/mustache.rb
nanoc-4.8.6 lib/nanoc/filters/mustache.rb
nanoc-4.8.5 lib/nanoc/filters/mustache.rb
nanoc-4.8.4 lib/nanoc/filters/mustache.rb
nanoc-4.8.3 lib/nanoc/filters/mustache.rb
nanoc-4.8.2 lib/nanoc/filters/mustache.rb
nanoc-4.8.1 lib/nanoc/filters/mustache.rb
nanoc-4.8.0 lib/nanoc/filters/mustache.rb
nanoc-4.7.14 lib/nanoc/filters/mustache.rb
nanoc-4.7.13 lib/nanoc/filters/mustache.rb