allow extensionless files to be previewed and built. fixes #270, but requires alternative layouts be placed in a layouts/ directory now.

This commit is contained in:
Thomas Reynolds 2012-02-12 11:45:42 -08:00
parent baaa3fd148
commit 5842bf8e5b
15 changed files with 85 additions and 16 deletions

View file

@ -19,8 +19,12 @@ module Middleman::CoreExtensions::Sitemap
# Files starting with an underscore, but not a double-underscore
:partials => proc { |file, path| (file.match(/\/_/) && !file.match(/\/__/)) },
:layout => proc { |file, path|
file.match(/^source\/layout\./) || file.match(/^source\/layouts\//)
},
# Files without any output extension (layouts, partials)
:extensionless => proc { |file, path| !path.match(/\./) },
# :extensionless => proc { |file, path| !path.match(/\./) },
}
# Include instance methods

View file

@ -88,7 +88,10 @@ module Middleman::Sitemap
def page_by_destination(destination_path)
# TODO: memoize this
destination_path = normalize_path(destination_path)
pages.find {|p| p.destination_path == destination_path }
pages.find do |p|
p.destination_path == destination_path ||
p.destination_path == destination_path.sub("/#{@app.index_file}", "")
end
end
# Whether a path is ignored