Don't require the `scope` key in front matter defaults

Set defaults for `scope` in front matter defaults as per #2656
This commit is contained in:
Alfred Xing 2014-07-31 11:17:35 -07:00
parent 2642bd7415
commit 9437a7abcd
1 changed files with 3 additions and 3 deletions

View File

@ -63,7 +63,7 @@ module Jekyll
end
def applies_path?(scope, path)
return true if scope['path'].empty?
return true if !scope.has_key?('path') || scope['path'].empty?
scope_path = Pathname.new(scope['path'])
Pathname.new(sanitize_path(path)).ascend do |path|
@ -83,7 +83,7 @@ module Jekyll
#
# Returns true if the set is valid and can be used in this class
def valid?(set)
set.is_a?(Hash) && set['scope'].is_a?(Hash) && set['scope']['path'].is_a?(String) && set['values'].is_a?(Hash)
set.is_a?(Hash) && set['values'].is_a?(Hash)
end
# Determines if a new scope has precedence over an old one
@ -112,7 +112,7 @@ module Jekyll
# Returns an array of hashes
def matching_sets(path, type)
valid_sets.select do |set|
applies?(set['scope'], path, type)
!set.has_key?('scope') || applies?(set['scope'], path, type)
end
end