Sha256: 3ebc59514fb2ab1079eb41476f5e00f8236c7b0f13011c13ab9e77d7d492ac85

Contents?: true

Size: 531 Bytes

Versions: 15

Compression:

Stored size: 531 Bytes

Contents

# encoding: utf-8

require 'coderay'

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

    # @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

15 entries across 15 versions & 1 rubygems

Version Path
nanoc-3.5.0 lib/nanoc/filters/coderay.rb
nanoc-3.5.0b2 lib/nanoc/filters/coderay.rb
nanoc-3.5.0b1 lib/nanoc/filters/coderay.rb
nanoc-3.4.3 lib/nanoc/filters/coderay.rb
nanoc-3.4.2 lib/nanoc/filters/coderay.rb
nanoc-3.4.1 lib/nanoc/filters/coderay.rb
nanoc-3.4.0 lib/nanoc/filters/coderay.rb
nanoc-3.3.7 lib/nanoc/filters/coderay.rb
nanoc-3.3.6 lib/nanoc/filters/coderay.rb
nanoc-3.3.5 lib/nanoc/filters/coderay.rb
nanoc-3.3.4 lib/nanoc/filters/coderay.rb
nanoc-3.3.3 lib/nanoc/filters/coderay.rb
nanoc-3.3.2 lib/nanoc/filters/coderay.rb
nanoc-3.3.1 lib/nanoc/filters/coderay.rb
nanoc-3.3.0 lib/nanoc/filters/coderay.rb