* Updates for mappings change in tilt 2

* drop RedcarpetTemplate::Redcarpet2 which was removed in tilt 2

* require Tilt 2.0 or higher

* Make use of tilt 2's extensions_for method instead
This commit is contained in:
Kevin Glowacz 2016-09-08 17:18:34 -05:00 committed by Thomas Reynolds
parent ea2115f3f8
commit 197093b36c
5 changed files with 9 additions and 11 deletions

View file

@ -344,11 +344,11 @@ module Middleman
# Clean up missing Tilt exts
def prune_tilt_templates!
::Tilt.mappings.each_key do |key|
::Tilt.default_mapping.lazy_map.each_key do |key|
begin
::Tilt[".#{key}"]
rescue LoadError, NameError
::Tilt.mappings.delete(key)
::Tilt.default_mapping.lazy_map.delete(key)
end
end
end

View file

@ -3,8 +3,8 @@ require 'active_support/core_ext/string/output_safety'
require 'active_support/core_ext/module/delegation'
require 'middleman-core/contracts'
::Tilt.mappings.delete('html') # WTF, Tilt?
::Tilt.mappings.delete('csv')
::Tilt.default_mapping.lazy_map.delete('html')
::Tilt.default_mapping.lazy_map.delete('csv')
module Middleman
class FileRenderer
@ -123,8 +123,8 @@ module Middleman
# Find all the engines which handle this extension in tilt. Look for
# config variables of that name and merge it
extension_class = ::Middleman::Util.tilt_class(ext)
::Tilt.mappings.each do |mapping_ext, engines|
next unless engines.include? extension_class
::Tilt.default_mapping.extensions_for(extension_class).each do |mapping_ext|
engine_options = @app.config[mapping_ext.to_sym] || {}
options.merge!(engine_options)
end

View file

@ -3,7 +3,7 @@ require 'active_support/core_ext/module/attribute_accessors'
module Middleman
module Renderers
class RedcarpetTemplate < ::Tilt::RedcarpetTemplate::Redcarpet2
class RedcarpetTemplate < ::Tilt::RedcarpetTemplate
# because tilt has decided to convert these
# in the wrong direction
ALIASES = {

View file

@ -64,9 +64,7 @@ module Middleman
extension_class = ::Middleman::Util.tilt_class(options[:preferred_engine])
# Get a list of extensions for a preferred engine
preferred_engines += ::Tilt.mappings.select do |_, engines|
engines.include? extension_class
end.keys
preferred_engines += ::Tilt.default_mapping.extensions_for(extension_class)
end
preferred_engines << '*'

View file

@ -21,7 +21,7 @@ Gem::Specification.new do |s|
# Core
s.add_dependency('bundler', ['~> 1.1'])
s.add_dependency('rack', ['>= 1.4.5', '< 2.0'])
s.add_dependency('tilt', ['~> 1.4.1'])
s.add_dependency('tilt', ['~> 2.0'])
s.add_dependency('erubis')
s.add_dependency('fast_blank')
s.add_dependency('parallel')