Backwards-compatibilize 'exclude' and 'include' config tags. Fixes #1109

This commit is contained in:
Parker Moore 2013-05-16 00:25:16 +02:00
parent d1c626f2e2
commit 8e3ab9ea36
1 changed files with 25 additions and 0 deletions

View File

@ -145,6 +145,15 @@ module Jekyll
configuration.backwards_compatibilize configuration.backwards_compatibilize
end end
# Public: Split a CSV string into an array containing its values
#
# csv - the string of comma-separated values
#
# Returns an array of the values contained in the CSV
def csv_to_array(csv)
csv.split(",").map(&:strip)
end
# Public: Ensure the proper options are set in the configuration to allow for # Public: Ensure the proper options are set in the configuration to allow for
# backwards-compatibility with Jekyll pre-1.0 # backwards-compatibility with Jekyll pre-1.0
# #
@ -176,6 +185,22 @@ module Jekyll
config.delete('server_port') config.delete('server_port')
end end
if config.has_key?('exclude') && config['exclude'].is_a?(String)
Jekyll::Stevenson.warn "Deprecation:", "The 'exclude' configuration option" +
" must now be specified as an array, but you specified" +
" a string. For now, we've treated the string you provided" +
" as a list of comma-separated values."
config['exclude'] = csv_to_array(config['exclude'])
end
if config.has_key?('include') && config['include'].is_a?(String)
Jekyll::Stevenson.warn "Deprecation:", "The 'include' configuration option" +
" must now be specified as an array, but you specified" +
" a string. For now, we've treated the string you provided" +
" as a list of comma-separated values."
config['include'] = csv_to_array(config['include'])
end
config config
end end