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 there is no extension, look for one
if File.extname(path).empty? 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) if app.template_extensions.has_key?(input_ext)
path << ".#{app.template_extensions[input_ext]}" path << ".#{app.template_extensions[input_ext]}"
end end
end end
end
path path
end end

View file

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

View file

@ -13,6 +13,10 @@ module Middleman::Renderers::Liquid
# Require Gem # Require Gem
require "liquid" require "liquid"
app.before_configuration do
template_extensions :liquid => :html
end
# After config, setup liquid partial paths # After config, setup liquid partial paths
app.after_configuration do app.after_configuration do
Liquid::Template.file_system = Liquid::LocalFileSystem.new(source_dir) 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, :redcarpet
app.set :markdown_engine_prefix, ::Tilt 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 # Once configuration is parsed
app.after_configuration do app.after_configuration do

View file

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

View file

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