Sha256: 03e9ec73948e1834727848ebd5ca15b2ed71822531a73e283148f48998eaa99f

Contents?: true

Size: 536 Bytes

Versions: 2

Compression:

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

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-3.8.0 lib/nanoc/filters/coderay.rb
nanoc-3.7.5 lib/nanoc/filters/coderay.rb