FrontmatterDefaults#update_deprecated_types deals with a set, not a scope

This commit is contained in:
Parker Moore 2014-08-12 12:22:39 -04:00
parent 9c090c862f
commit e36d433100
1 changed files with 17 additions and 12 deletions

View File

@ -10,19 +10,24 @@ module Jekyll
@site = site @site = site
end end
def update_deprecated_types(scope) def update_deprecated_types(set)
if scope['type'].eql?('page') return set unless set.key?('scope') && set['scope'].key?('type')
defaults_deprecate_type('page', 'pages')
scope['type'] = 'pages' set['scope']['type'] = case set['scope']['type']
elsif scope['type'].eql?('post') when 'page'
defaults_deprecate_type('post', 'posts') Deprecator.defaults_deprecate_type('page', 'pages')
type.to_s.eql?('posts') 'pages'
scope['type'] = 'posts' when 'post'
elsif scope['type'].eql?('draft') Deprecator.defaults_deprecate_type('post', 'posts')
defaults_deprecate_type('draft', 'drafts') 'posts'
scope['type'] = 'drafts' when 'draft'
Deprecator.defaults_deprecate_type('draft', 'drafts')
'drafts'
else
set['scope']['type']
end end
scope
set
end end
# Finds a default value for a given setting, filtered by path and type # Finds a default value for a given setting, filtered by path and type