Sha256: 9ec2c7aafabb8bff73a7d51b9844c70d520a40cdd6d6ed7ee279b4dc673a9b50

Contents?: true

Size: 644 Bytes

Versions: 2

Compression:

Stored size: 644 Bytes

Contents

require 'slim'

module Jekyll
  class SlimConverter < Converter
    safe false
    priority :low

    def initialize(config)
      super
      self.ensure_config_integrity
    end

    def matches(ext)
      ext =~ /slim/i
    end

    def output_ext(ext)
      ".html"
    end

    def convert(content)
      begin
        ::Slim::Template.new(@symbolized_config) { content }.render(locals[:slim_context])
      rescue StandardError => e
        puts "(!) SLIM ERROR: " + e.message
      end
    end

    def ensure_config_integrity
      @config['slim'] ||= {}
      @symbolized_config = @config['slim'].deep_symbolize_keys
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jekyll-slim-0.9.1 lib/jekyll-slim/slim_converter.rb
jekyll-slim-0.9.0 lib/jekyll-slim/slim_converter.rb