Sha256: 14c31219307bfa8fd7ce8ae775bb5bd12fd1414c2e0031a1deebceeca44d8b8c

Contents?: true

Size: 720 Bytes

Versions: 9

Compression:

Stored size: 720 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

9 entries across 9 versions & 1 rubygems

Version Path
nanoc-3.7.4 lib/nanoc/filters/slim.rb
nanoc-3.7.3 lib/nanoc/filters/slim.rb
nanoc-3.7.2 lib/nanoc/filters/slim.rb
nanoc-3.7.1 lib/nanoc/filters/slim.rb
nanoc-3.7.0 lib/nanoc/filters/slim.rb
nanoc-3.6.11 lib/nanoc/filters/slim.rb
nanoc-3.6.10 lib/nanoc/filters/slim.rb
nanoc-3.6.9 lib/nanoc/filters/slim.rb
nanoc-3.6.8 lib/nanoc/filters/slim.rb