Sha256: f6c16154ddc0e426d8c32b06a5f9fd3ec4b579294d365baab8f018f1c979c9f9

Contents?: true

Size: 712 Bytes

Versions: 3

Compression:

Stored size: 712 Bytes

Contents

# encoding: utf-8

require 'slim'

module Nanoc::Filters

  # @since 3.2.0
  class Slim < Nanoc::Filter

    # Runs the content through [Slim](http://slim-lang.com/)
    # This method takes no options.
    #
    # @param [String] content The content to filter
    #
    # @return [String] The filtered content
    def run(content, params={})
      params = {
        :disable_capture => true,      # Capture managed by nanoc
        :buffer          => '_erbout', # Force slim to output to the buffer used by nanoc
      }.merge params

      # Create context
      context = ::Nanoc::Context.new(assigns)

      ::Slim::Template.new(params) { content }.render(context) { assigns[:content] }
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nanoc-3.4.3 lib/nanoc/filters/slim.rb
nanoc-3.4.2 lib/nanoc/filters/slim.rb
nanoc-3.4.1 lib/nanoc/filters/slim.rb