Sha256: ccebec414b34ebe60598b5f27e7619807b5f70c22c11ddedf45486c4f2e82093

Contents?: true

Size: 538 Bytes

Versions: 9

Compression:

Stored size: 538 Bytes

Contents

# encoding: utf-8

module Nanoc::Filters
  class CodeRay < Nanoc::Filter

    requires 'coderay'

    # @deprecated Use the `:colorize_syntax` filter instead.
    def run(content, params = {})
      # Warn
      warn 'The :coderay filter is deprecated; consider using the :colorize_syntax filter instead.'

      # Check params
      raise ArgumentError, 'CodeRay filter requires a :language argument which is missing' if params[:language].nil?

      # Get result
      ::CodeRay.scan(content, params[:language]).html
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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