Move permalink styles data to constant (#8282)

Merge pull request 8282
This commit is contained in:
Alex Malaszkiewicz 2020-07-05 21:16:01 +02:00 committed by GitHub
parent f693faf1b6
commit 2c793fcf77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 14 deletions

View File

@ -269,21 +269,18 @@ module Jekyll
private
STYLE_TO_PERMALINK = {
:none => "/:categories/:title:output_ext",
:date => "/:categories/:year/:month/:day/:title:output_ext",
:ordinal => "/:categories/:year/:y_day/:title:output_ext",
:pretty => "/:categories/:year/:month/:day/:title/",
:weekdate => "/:categories/:year/W:week/:short_day/:title:output_ext",
}.freeze
private_constant :STYLE_TO_PERMALINK
def style_to_permalink(permalink_style)
case permalink_style.to_sym
when :pretty
"/:categories/:year/:month/:day/:title/"
when :none
"/:categories/:title:output_ext"
when :date
"/:categories/:year/:month/:day/:title:output_ext"
when :ordinal
"/:categories/:year/:y_day/:title:output_ext"
when :weekdate
"/:categories/:year/W:week/:short_day/:title:output_ext"
else
permalink_style.to_s
end
STYLE_TO_PERMALINK[permalink_style.to_sym] || permalink_style.to_s
end
def check_include_exclude(config)