Sha256: e0a821bf821da68242b635d790c4dbf3a7841e632a5a9c9c94b6a6d1b5fb1b0c

Contents?: true

Size: 718 Bytes

Versions: 8

Compression:

Stored size: 718 Bytes

Contents

# encoding: utf-8

module Nanoc::Filters

  # @since 3.2.0
  class Slim < Nanoc::Filter

    requires 'slim'

    # 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

8 entries across 8 versions & 1 rubygems

Version Path
nanoc-3.6.7 lib/nanoc/filters/slim.rb
nanoc-3.6.6 lib/nanoc/filters/slim.rb
nanoc-3.6.5 lib/nanoc/filters/slim.rb
nanoc-3.6.4 lib/nanoc/filters/slim.rb
nanoc-3.6.3 lib/nanoc/filters/slim.rb
nanoc-3.6.2 lib/nanoc/filters/slim.rb
nanoc-3.6.1 lib/nanoc/filters/slim.rb
nanoc-3.6.0 lib/nanoc/filters/slim.rb