From 1d869b0c084843c769f927d2f1689c7371dd5f0b Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Sat, 6 Apr 2013 14:23:10 -0700 Subject: [PATCH] Simplify frontmatter by removing its resource_list_manipulator --- .../core_extensions/front_matter.rb | 34 ++++--------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb index d84da600..25210333 100644 --- a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb +++ b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb @@ -28,11 +28,6 @@ module Middleman::CoreExtensions app.after_configuration do ::Middleman::Sitemap::Resource.send :include, ResourceInstanceMethods - sitemap.register_resource_list_manipulator( - :frontmatter, - frontmatter_manager - ) - sitemap.provides_metadata do |path| fmdata = frontmatter_manager.data(path).first || {} @@ -165,44 +160,28 @@ module Middleman::CoreExtensions def normalize_path(path) path.sub(%r{^#{@app.source_dir}\/}, "") end - - # Update the main sitemap resource list - # @return [void] - def manipulate_resource_list(resources) - resources.each do |r| - if !r.proxy? && !r.data.nil? && r.data["ignored"] == true - r.frontmatter_ignored = true - end - end - - resources - end end module ResourceInstanceMethods - def frontmatter_ignored? - @_frontmatter_ignored || false - end - - def frontmatter_ignored=(v) - @_frontmatter_ignored = v - end - def ignored? - if frontmatter_ignored? + if !proxy? && data["ignored"] == true true else super end end - # This page's frontmatter + # This page's frontmatter without being enhanced for access by either symbols or strings. + # Used internally + # @private # @return [Hash] def raw_data app.frontmatter_manager.data(source_file).first end + # This page's frontmatter + # @return [Hash] def data ::Middleman::Util.recursively_enhance(raw_data).freeze end @@ -221,7 +200,6 @@ module Middleman::CoreExtensions def template_data_for_file(path) frontmatter_manager.data(path).last end - end end end