Implied extensions. Closes #304

This commit is contained in:
Thomas Reynolds 2012-03-29 18:34:25 +01:00
parent e769477e93
commit 183e9d68f3
6 changed files with 31 additions and 3 deletions

View file

@ -178,12 +178,15 @@ module Middleman::Sitemap
# If there is no extension, look for one
if File.extname(path).empty?
input_ext = File.extname(file).split(".").last.to_sym
input_ext = File.extname(file)
if !input_ext.empty?
input_ext = input_ext.split(".").last.to_sym
if app.template_extensions.has_key?(input_ext)
path << ".#{app.template_extensions[input_ext]}"
end
end
end
path
end

View file

@ -11,6 +11,10 @@ module Middleman::Renderers::Haml
# Add haml helpers to context
app.send :include, ::Haml::Helpers
app.before_configuration do
template_extensions :haml => :html
end
# Setup haml helper paths
app.ready do
init_haml_helpers

View file

@ -13,6 +13,10 @@ module Middleman::Renderers::Liquid
# Require Gem
require "liquid"
app.before_configuration do
template_extensions :liquid => :html
end
# After config, setup liquid partial paths
app.after_configuration do
Liquid::Template.file_system = Liquid::LocalFileSystem.new(source_dir)

View file

@ -18,6 +18,14 @@ module Middleman::Renderers::Markdown
app.set :markdown_engine, :redcarpet
app.set :markdown_engine_prefix, ::Tilt
app.before_configuration do
template_extensions :markdown => :html,
:mdown => :html,
:md => :html,
:mkd => :html,
:mkdn => :html
end
# Once configuration is parsed
app.after_configuration do

View file

@ -16,6 +16,11 @@ module Middleman::Renderers::Sass
def registered(app)
# Default sass options
app.set :sass, {}
app.before_configuration do
template_extensions :scss => :css,
:sass => :css
end
end
alias :included :registered

View file

@ -12,6 +12,10 @@ module Middleman::Renderers::Slim
# Load gem
require "slim"
app.before_configuration do
template_extensions :slim => :html
end
# Setup Slim options to work with partials
Slim::Engine.set_default_options(:buffer => '@_out_buf', :generator => Temple::Generators::StringBuffer) if defined?(Slim)
rescue LoadError