Rubocop: Style/CaseIndentation

- Indent when as deep as case
This commit is contained in:
Pat Hawks 2016-01-04 11:15:37 -08:00
parent 2c9a349f9a
commit f6fd9014ba
No known key found for this signature in database
GPG Key ID: F1746FF5F18B3D1B
4 changed files with 35 additions and 33 deletions

View File

@ -19,9 +19,9 @@ module Jekyll
def get_processor def get_processor
case @config["markdown"].downcase case @config["markdown"].downcase
when "redcarpet" then return RedcarpetParser.new(@config) when "redcarpet" then return RedcarpetParser.new(@config)
when "kramdown" then return KramdownParser.new(@config) when "kramdown" then return KramdownParser.new(@config)
when "rdiscount" then return RDiscountParser.new(@config) when "rdiscount" then return RDiscountParser.new(@config)
else else
get_custom_processor get_custom_processor
end end

View File

@ -13,19 +13,20 @@ module Jekyll
def update_deprecated_types(set) def update_deprecated_types(set)
return set unless set.key?('scope') && set['scope'].key?('type') return set unless set.key?('scope') && set['scope'].key?('type')
set['scope']['type'] = case set['scope']['type'] set['scope']['type'] =
when 'page' case set['scope']['type']
Deprecator.defaults_deprecate_type('page', 'pages') when 'page'
'pages' Deprecator.defaults_deprecate_type('page', 'pages')
when 'post' 'pages'
Deprecator.defaults_deprecate_type('post', 'posts') when 'post'
'posts' Deprecator.defaults_deprecate_type('post', 'posts')
when 'draft' 'posts'
Deprecator.defaults_deprecate_type('draft', 'drafts') when 'draft'
'drafts' Deprecator.defaults_deprecate_type('draft', 'drafts')
else 'drafts'
set['scope']['type'] else
end set['scope']['type']
end
set set
end end

View File

@ -50,13 +50,13 @@ module Jekyll
# Returns the contents of the data file. # Returns the contents of the data file.
def read_data_file(path) def read_data_file(path)
case File.extname(path).downcase case File.extname(path).downcase
when '.csv' when '.csv'
CSV.read(path, { CSV.read(path, {
:headers => true, :headers => true,
:encoding => site.config['encoding'] :encoding => site.config['encoding']
}).map(&:to_hash) }).map(&:to_hash)
else else
SafeYAML.load_file(path) SafeYAML.load_file(path)
end end
end end

View File

@ -164,16 +164,17 @@ module Jekyll
end end
# Replace each character sequence with a hyphen # Replace each character sequence with a hyphen
re = case mode re =
when 'raw' case mode
SLUGIFY_RAW_REGEXP when 'raw'
when 'default' SLUGIFY_RAW_REGEXP
SLUGIFY_DEFAULT_REGEXP when 'default'
when 'pretty' SLUGIFY_DEFAULT_REGEXP
# "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL when 'pretty'
# and is allowed in both extN and NTFS. # "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL
SLUGIFY_PRETTY_REGEXP # and is allowed in both extN and NTFS.
end SLUGIFY_PRETTY_REGEXP
end
# Strip according to the mode # Strip according to the mode
slug = string.gsub(re, '-') slug = string.gsub(re, '-')