fix some uncaught regressions

This commit is contained in:
Thomas Reynolds 2014-08-18 14:53:15 -07:00
parent d4010c9dc4
commit ad93f3d8ae
3 changed files with 14 additions and 2 deletions

View file

@ -148,7 +148,18 @@ module Middleman
# Setup callbacks which can exclude paths from the sitemap
config.define_setting :ignored_sitemap_matchers, {
# Files starting with an underscore, but not a double-underscore
partials: proc { |file| File.basename(file[:relative_path]).match %r{^_[^_]} },
partials: proc { |file|
ignored = false
file[:relative_path].ascend do |f|
if f.basename.to_s.match %r{^_[^_]}
ignored = true
break
end
end
ignored
},
layout: proc { |file, _sitemap_app|
file[:relative_path].to_s.start_with?('layout.') ||

View file

@ -17,6 +17,7 @@ module Middleman
@data_store = DataStore.new(app, DATA_FILE_MATCHER)
app.config.define_setting :data_dir, 'data', 'The directory data files are stored in'
app.add_to_instance(:data, &method(:data_store))
app.add_to_config_context(:data, &method(:data_store))
start_watching(app.config[:data_dir])

View file

@ -39,7 +39,7 @@ module Middleman
build_path = 'Not built' if ignored?
props['Build Path'] = build_path if @resource.path != build_path
props['URL'] = content_tag(:a, @resource.url, href: @resource.url) unless ignored?
props['Source File'] = @resource.source_file[:full_path].to_s
props['Source File'] = @resource.source_file ? @resource.source_file[:full_path].to_s : 'Dynamic'
data = @resource.data
props['Data'] = data.inspect unless data.empty?