jekyll 4.1.1 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +150 -4
- data/README.markdown +2 -6
- data/lib/blank_template/_layouts/default.html +1 -1
- data/lib/jekyll.rb +2 -16
- data/lib/jekyll/cleaner.rb +1 -1
- data/lib/jekyll/commands/doctor.rb +19 -15
- data/lib/jekyll/commands/new_theme.rb +0 -2
- data/lib/jekyll/commands/serve.rb +3 -0
- data/lib/jekyll/configuration.rb +11 -14
- data/lib/jekyll/convertible.rb +17 -11
- data/lib/jekyll/document.rb +20 -12
- data/lib/jekyll/drops/collection_drop.rb +3 -3
- data/lib/jekyll/drops/document_drop.rb +4 -15
- data/lib/jekyll/drops/drop.rb +98 -20
- data/lib/jekyll/drops/site_drop.rb +3 -3
- data/lib/jekyll/drops/static_file_drop.rb +4 -4
- data/lib/jekyll/drops/url_drop.rb +2 -2
- data/lib/jekyll/filters.rb +6 -9
- data/lib/jekyll/filters/url_filters.rb +5 -2
- data/lib/jekyll/frontmatter_defaults.rb +2 -2
- data/lib/jekyll/hooks.rb +20 -16
- data/lib/jekyll/layout.rb +5 -0
- data/lib/jekyll/page.rb +20 -13
- data/lib/jekyll/path_manager.rb +53 -10
- data/lib/jekyll/reader.rb +11 -6
- data/lib/jekyll/readers/data_reader.rb +3 -0
- data/lib/jekyll/readers/post_reader.rb +1 -1
- data/lib/jekyll/related_posts.rb +1 -1
- data/lib/jekyll/renderer.rb +8 -4
- data/lib/jekyll/site.rb +17 -2
- data/lib/jekyll/static_file.rb +2 -2
- data/lib/jekyll/tags/include.rb +21 -27
- data/lib/jekyll/tags/link.rb +2 -1
- data/lib/jekyll/tags/post_url.rb +3 -4
- data/lib/jekyll/url.rb +8 -5
- data/lib/jekyll/utils/platforms.rb +34 -49
- data/lib/jekyll/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ada984c6843d26b182a1b999fa99cba4f98af9aa15c4193d65116fa897e16da
|
4
|
+
data.tar.gz: '009c07098270b070724e1e17a9f02197b5ff8d4a9664ac26d1f6c835824f1627'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b02fd6e6d2bcfcafd407528257ae71a17232bc8238d1174624c0967f2d1c60b30904bb0e2ee4b6f2e8297a19999c51833bfd6104b1d11f5bf435c64a598b573
|
7
|
+
data.tar.gz: 893e7d2991544d816fc4873b6906d55d6a0dc64d3274fac9b689025e1c50ce86776308d8e51b3713b826bccb50aad094e250f8b69259c141492a43a8b97881c8
|
data/.rubocop.yml
CHANGED
@@ -22,6 +22,8 @@ AllCops:
|
|
22
22
|
- vendor/**/*
|
23
23
|
- tmp/**/*
|
24
24
|
|
25
|
+
Layout/BeginEndAlignment:
|
26
|
+
Enabled: true
|
25
27
|
Layout/EmptyComment:
|
26
28
|
Enabled: false
|
27
29
|
Layout/EmptyLinesAroundAttributeAccessor:
|
@@ -50,26 +52,84 @@ Layout/MultilineOperationIndentation:
|
|
50
52
|
EnforcedStyle: indented
|
51
53
|
Layout/SpaceAroundMethodCallOperator:
|
52
54
|
Enabled: true
|
55
|
+
Layout/SpaceInsideHashLiteralBraces:
|
56
|
+
Enabled: true
|
57
|
+
Exclude:
|
58
|
+
- test/**/*.rb
|
53
59
|
|
54
|
-
Lint/
|
60
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
61
|
+
Enabled: true
|
62
|
+
Lint/ConstantDefinitionInBlock:
|
63
|
+
Enabled: true
|
55
64
|
Exclude:
|
56
|
-
- test
|
65
|
+
- test/**/*.rb
|
57
66
|
Lint/DeprecatedOpenSSLConstant:
|
58
67
|
Enabled: true
|
68
|
+
Lint/DuplicateBranch:
|
69
|
+
Enabled: true
|
70
|
+
Lint/DuplicateElsifCondition:
|
71
|
+
Enabled: true
|
72
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
73
|
+
Enabled: true
|
74
|
+
Lint/DuplicateRescueException:
|
75
|
+
Enabled: true
|
76
|
+
Lint/DuplicateRequire:
|
77
|
+
Enabled: true
|
78
|
+
Lint/EmptyBlock:
|
79
|
+
Enabled: true
|
80
|
+
Lint/EmptyClass:
|
81
|
+
Enabled: true
|
82
|
+
Lint/EmptyConditionalBody:
|
83
|
+
Enabled: true
|
84
|
+
Lint/EmptyFile:
|
85
|
+
Enabled: true
|
86
|
+
Lint/FloatComparison:
|
87
|
+
Enabled: true
|
88
|
+
Lint/HashCompareByIdentity:
|
89
|
+
Enabled: true
|
90
|
+
Lint/IdentityComparison:
|
91
|
+
Enabled: true
|
92
|
+
Lint/MissingSuper:
|
93
|
+
Enabled: false
|
59
94
|
Lint/MixedRegexpCaptureTypes:
|
60
95
|
Enabled: false
|
96
|
+
Lint/NestedPercentLiteral:
|
97
|
+
Exclude:
|
98
|
+
- test/test_site.rb
|
99
|
+
Lint/NoReturnInBeginEndBlocks:
|
100
|
+
Enabled: true
|
101
|
+
Lint/OutOfRangeRegexpRef:
|
102
|
+
Enabled: true
|
61
103
|
Lint/RaiseException:
|
62
104
|
Enabled: true
|
105
|
+
Lint/RedundantSafeNavigation:
|
106
|
+
Enabled: true
|
107
|
+
Lint/SelfAssignment:
|
108
|
+
Enabled: true
|
63
109
|
Lint/StructNewOverride:
|
64
110
|
Enabled: true
|
111
|
+
Lint/ToEnumArguments:
|
112
|
+
Enabled: false
|
113
|
+
Lint/TopLevelReturnWithArgument:
|
114
|
+
Enabled: true
|
115
|
+
Lint/TrailingCommaInAttributeDeclaration:
|
116
|
+
Enabled: true
|
117
|
+
Lint/UnmodifiedReduceAccumulator:
|
118
|
+
Enabled: true
|
65
119
|
Lint/UnreachableCode:
|
66
120
|
Severity: error
|
121
|
+
Lint/UnreachableLoop:
|
122
|
+
Enabled: true
|
123
|
+
Lint/UselessMethodDefinition:
|
124
|
+
Enabled: true
|
125
|
+
Lint/UselessTimes:
|
126
|
+
Enabled: true
|
67
127
|
Lint/Void:
|
68
128
|
Exclude:
|
69
129
|
- lib/jekyll/site.rb
|
70
130
|
|
71
131
|
Metrics/AbcSize:
|
72
|
-
Max:
|
132
|
+
Max: 23
|
73
133
|
Metrics/BlockLength:
|
74
134
|
Exclude:
|
75
135
|
- test/**/*.rb
|
@@ -100,7 +160,7 @@ Metrics/ModuleLength:
|
|
100
160
|
Metrics/ParameterLists:
|
101
161
|
Max: 4
|
102
162
|
Metrics/PerceivedComplexity:
|
103
|
-
Max:
|
163
|
+
Max: 13
|
104
164
|
|
105
165
|
Naming/FileName:
|
106
166
|
Enabled: false
|
@@ -114,6 +174,39 @@ Naming/MemoizedInstanceVariableName:
|
|
114
174
|
- lib/jekyll/drops/unified_payload_drop.rb
|
115
175
|
- lib/jekyll/page_without_a_file.rb
|
116
176
|
|
177
|
+
Performance/AncestorsInclude:
|
178
|
+
Enabled: false
|
179
|
+
Performance/ArraySemiInfiniteRangeSlice:
|
180
|
+
Enabled: true
|
181
|
+
Performance/BigDecimalWithNumericArgument:
|
182
|
+
Enabled: true
|
183
|
+
Performance/BlockGivenWithExplicitBlock:
|
184
|
+
Enabled: true
|
185
|
+
Performance/ChainArrayAllocation:
|
186
|
+
Enabled: true
|
187
|
+
Performance/CollectionLiteralInLoop:
|
188
|
+
Enabled: true
|
189
|
+
Performance/ConstantRegexp:
|
190
|
+
Enabled: true
|
191
|
+
Performance/MethodObjectAsBlock:
|
192
|
+
Enabled: true
|
193
|
+
Performance/RedundantSortBlock:
|
194
|
+
Enabled: true
|
195
|
+
Performance/RedundantStringChars:
|
196
|
+
Enabled: true
|
197
|
+
Performance/ReverseFirst:
|
198
|
+
Enabled: true
|
199
|
+
Performance/SortReverse:
|
200
|
+
Enabled: false
|
201
|
+
Performance/Squeeze:
|
202
|
+
Enabled: true
|
203
|
+
Performance/StringInclude:
|
204
|
+
Enabled: true
|
205
|
+
Exclude:
|
206
|
+
- lib/jekyll/utils/platforms.rb
|
207
|
+
Performance/Sum:
|
208
|
+
Enabled: true
|
209
|
+
|
117
210
|
Security/MarshalLoad:
|
118
211
|
Exclude:
|
119
212
|
- !ruby/regexp /test\/.*.rb$/
|
@@ -123,21 +216,41 @@ Security/YAMLLoad:
|
|
123
216
|
- !ruby/regexp /features\/.*.rb/
|
124
217
|
- !ruby/regexp /test\/.*.rb$/
|
125
218
|
|
219
|
+
Style/ArgumentsForwarding:
|
220
|
+
Enabled: false
|
221
|
+
Style/ArrayCoercion:
|
222
|
+
Enabled: true
|
126
223
|
Style/AccessModifierDeclarations:
|
127
224
|
Enabled: false
|
225
|
+
Style/AccessorGrouping:
|
226
|
+
Enabled: false
|
128
227
|
Style/Alias:
|
129
228
|
EnforcedStyle: prefer_alias_method
|
130
229
|
Style/AndOr:
|
131
230
|
Severity: error
|
231
|
+
Style/BisectedAttrAccessor:
|
232
|
+
Enabled: true
|
233
|
+
Style/CaseLikeIf:
|
234
|
+
Enabled: true
|
132
235
|
Style/ClassAndModuleChildren:
|
133
236
|
Exclude:
|
134
237
|
- test/**/*.rb
|
238
|
+
Style/ClassEqualityComparison:
|
239
|
+
Enabled: true
|
240
|
+
Style/CollectionCompact:
|
241
|
+
Enabled: true
|
242
|
+
Style/CombinableLoops:
|
243
|
+
Enabled: true
|
135
244
|
Style/Documentation:
|
136
245
|
Enabled: false
|
246
|
+
Style/DocumentDynamicEvalDefinition:
|
247
|
+
Enabled: true
|
137
248
|
Style/DoubleNegation:
|
138
249
|
Enabled: false
|
139
250
|
Style/ExponentialNotation:
|
140
251
|
Enabled: true
|
252
|
+
Style/ExplicitBlockArgument:
|
253
|
+
Enabled: false
|
141
254
|
Style/FormatStringToken:
|
142
255
|
Exclude:
|
143
256
|
- lib/jekyll/utils/ansi.rb
|
@@ -145,10 +258,16 @@ Style/FormatStringToken:
|
|
145
258
|
- lib/jekyll/profiler.rb
|
146
259
|
Style/FrozenStringLiteralComment:
|
147
260
|
EnforcedStyle: always
|
261
|
+
Style/GlobalStdStream:
|
262
|
+
Enabled: true
|
148
263
|
Style/GuardClause:
|
149
264
|
Enabled: false
|
265
|
+
Style/HashAsLastArrayItem:
|
266
|
+
Enabled: true
|
150
267
|
Style/HashEachMethods:
|
151
268
|
Enabled: true
|
269
|
+
Style/HashLikeCase:
|
270
|
+
Enabled: true
|
152
271
|
Style/HashSyntax:
|
153
272
|
EnforcedStyle: hash_rockets
|
154
273
|
Severity: error
|
@@ -156,6 +275,8 @@ Style/HashTransformKeys:
|
|
156
275
|
Enabled: false
|
157
276
|
Style/HashTransformValues:
|
158
277
|
Enabled: true
|
278
|
+
Style/KeywordParametersOrder:
|
279
|
+
Enabled: true
|
159
280
|
Style/MixinUsage:
|
160
281
|
Exclude:
|
161
282
|
- test/helper.rb
|
@@ -163,6 +284,12 @@ Style/ModuleFunction:
|
|
163
284
|
Enabled: false
|
164
285
|
Style/MultilineTernaryOperator:
|
165
286
|
Severity: error
|
287
|
+
Style/NegatedIfElseCondition:
|
288
|
+
Enabled: true
|
289
|
+
Style/NilLambda:
|
290
|
+
Enabled: true
|
291
|
+
Style/OptionalBooleanParameter:
|
292
|
+
Enabled: true
|
166
293
|
Style/PercentLiteralDelimiters:
|
167
294
|
PreferredDelimiters:
|
168
295
|
"%q": "{}"
|
@@ -172,12 +299,20 @@ Style/PercentLiteralDelimiters:
|
|
172
299
|
"%w": "()"
|
173
300
|
"%W": "()"
|
174
301
|
"%x": "()"
|
302
|
+
Style/RedundantArgument:
|
303
|
+
Enabled: true
|
304
|
+
Style/RedundantAssignment:
|
305
|
+
Enabled: true
|
175
306
|
Style/RedundantFetchBlock:
|
176
307
|
Enabled: false
|
308
|
+
Style/RedundantFileExtensionInRequire:
|
309
|
+
Enabled: true
|
177
310
|
Style/RedundantRegexpCharacterClass:
|
178
311
|
Enabled: true
|
179
312
|
Style/RedundantRegexpEscape:
|
180
313
|
Enabled: true
|
314
|
+
Style/RedundantSelfAssignment:
|
315
|
+
Enabled: true
|
181
316
|
Style/RegexpLiteral:
|
182
317
|
EnforcedStyle: percent_r
|
183
318
|
Style/RescueModifier:
|
@@ -187,12 +322,23 @@ Style/SafeNavigation:
|
|
187
322
|
- lib/jekyll/document.rb
|
188
323
|
Style/SignalException:
|
189
324
|
EnforcedStyle: only_raise
|
325
|
+
Style/SingleArgumentDig:
|
326
|
+
Enabled: true
|
190
327
|
Style/SlicingWithRange:
|
191
328
|
Enabled: false
|
329
|
+
Style/SoleNestedConditional:
|
330
|
+
Enabled: true
|
192
331
|
Style/StringLiterals:
|
193
332
|
EnforcedStyle: double_quotes
|
333
|
+
Style/StringConcatenation:
|
334
|
+
Enabled: true
|
335
|
+
Exclude:
|
336
|
+
- lib/jekyll/commands/*.rb
|
337
|
+
- test/**/*.rb
|
194
338
|
Style/StringLiteralsInInterpolation:
|
195
339
|
EnforcedStyle: double_quotes
|
340
|
+
Style/SwapValues:
|
341
|
+
Enabled: true
|
196
342
|
Style/SymbolArray:
|
197
343
|
EnforcedStyle: brackets
|
198
344
|
Style/TrailingCommaInArrayLiteral:
|
data/README.markdown
CHANGED
@@ -1,19 +1,15 @@
|
|
1
1
|
# [Jekyll](https://jekyllrb.com/)
|
2
2
|
|
3
3
|
[![Gem Version](https://img.shields.io/gem/v/jekyll.svg)][ruby-gems]
|
4
|
-
[![Linux Build Status](https://
|
4
|
+
[![Linux Build Status](https://github.com/jekyll/jekyll/workflows/Continuous%20Integration/badge.svg)][ci-workflow]
|
5
5
|
[![Windows Build status](https://img.shields.io/appveyor/ci/jekyll/jekyll/master.svg?label=Windows%20build)][appveyor]
|
6
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges/8ba0cb5b17bb9848e128/maintainability)][codeclimate]
|
7
|
-
[![Test Coverage](https://api.codeclimate.com/v1/badges/8ba0cb5b17bb9848e128/test_coverage)][coverage]
|
8
6
|
[![Security](https://hakiri.io/github/jekyll/jekyll/master.svg)][hakiri]
|
9
7
|
[![Backers on Open Collective](https://opencollective.com/jekyll/backers/badge.svg)](#backers)
|
10
8
|
[![Sponsors on Open Collective](https://opencollective.com/jekyll/sponsors/badge.svg)](#sponsors)
|
11
9
|
|
12
10
|
[ruby-gems]: https://rubygems.org/gems/jekyll
|
13
|
-
[codeclimate]: https://codeclimate.com/github/jekyll/jekyll
|
14
|
-
[coverage]: https://codeclimate.com/github/jekyll/jekyll/coverage
|
15
11
|
[hakiri]: https://hakiri.io/github/jekyll/jekyll/master
|
16
|
-
[
|
12
|
+
[ci-workflow]: https://github.com/jekyll/jekyll/actions?query=workflow%3A%22Continuous+Integration%22+branch%3Amaster
|
17
13
|
[appveyor]: https://ci.appveyor.com/project/jekyll/jekyll/branch/master
|
18
14
|
|
19
15
|
Jekyll is a simple, blog-aware, static site generator perfect for personal, project, or organization sites. Think of it like a file-based CMS, without all the complexity. Jekyll takes your content, renders Markdown and Liquid templates, and spits out a complete, static website ready to be served by Apache, Nginx or another web server. Jekyll is the engine behind [GitHub Pages](https://pages.github.com), which you can use to host sites right from your GitHub repositories.
|
data/lib/jekyll.rb
CHANGED
@@ -173,23 +173,9 @@ module Jekyll
|
|
173
173
|
# Returns the sanitized path.
|
174
174
|
def sanitized_path(base_directory, questionable_path)
|
175
175
|
return base_directory if base_directory.eql?(questionable_path)
|
176
|
+
return base_directory if questionable_path.nil?
|
176
177
|
|
177
|
-
|
178
|
-
clean_path.insert(0, "/") if clean_path.start_with?("~")
|
179
|
-
clean_path = File.expand_path(clean_path, "/")
|
180
|
-
|
181
|
-
return clean_path if clean_path.eql?(base_directory)
|
182
|
-
|
183
|
-
# remove any remaining extra leading slashes not stripped away by calling
|
184
|
-
# `File.expand_path` above.
|
185
|
-
clean_path.squeeze!("/")
|
186
|
-
|
187
|
-
if clean_path.start_with?(base_directory.sub(%r!\z!, "/"))
|
188
|
-
clean_path
|
189
|
-
else
|
190
|
-
clean_path.sub!(%r!\A\w:/!, "/")
|
191
|
-
File.join(base_directory, clean_path)
|
192
|
-
end
|
178
|
+
+Jekyll::PathManager.sanitized_path(base_directory, questionable_path)
|
193
179
|
end
|
194
180
|
|
195
181
|
# Conditional optimizations
|
data/lib/jekyll/cleaner.rb
CHANGED
@@ -44,7 +44,7 @@ module Jekyll
|
|
44
44
|
dirs = keep_dirs
|
45
45
|
|
46
46
|
Utils.safe_glob(site.in_dest_dir, ["**", "*"], File::FNM_DOTMATCH).each do |file|
|
47
|
-
next if file
|
47
|
+
next if HIDDEN_FILE_REGEX.match?(file) || regex.match?(file) || dirs.include?(file)
|
48
48
|
|
49
49
|
files << file
|
50
50
|
end
|
@@ -67,15 +67,16 @@ module Jekyll
|
|
67
67
|
|
68
68
|
def conflicting_urls(site)
|
69
69
|
conflicting_urls = false
|
70
|
-
|
71
|
-
urls = collect_urls(urls, site.pages, site.dest)
|
72
|
-
urls = collect_urls(urls, site.posts.docs, site.dest)
|
73
|
-
urls.each do |url, paths|
|
70
|
+
destination_map(site).each do |dest, paths|
|
74
71
|
next unless paths.size > 1
|
75
72
|
|
76
73
|
conflicting_urls = true
|
77
|
-
Jekyll.logger.warn "Conflict:",
|
78
|
-
|
74
|
+
Jekyll.logger.warn "Conflict:",
|
75
|
+
"The following destination is shared by multiple files."
|
76
|
+
Jekyll.logger.warn "", "The written file may end up with unexpected contents."
|
77
|
+
Jekyll.logger.warn "", dest.to_s.cyan
|
78
|
+
paths.each { |path| Jekyll.logger.warn "", " - #{path}" }
|
79
|
+
Jekyll.logger.warn ""
|
79
80
|
end
|
80
81
|
conflicting_urls
|
81
82
|
end
|
@@ -84,7 +85,7 @@ module Jekyll
|
|
84
85
|
return true unless Utils::Platforms.osx?
|
85
86
|
|
86
87
|
if Dir.pwd != `pwd`.strip
|
87
|
-
Jekyll.logger.error
|
88
|
+
Jekyll.logger.error <<~STR
|
88
89
|
We have detected that there might be trouble using fsevent on your
|
89
90
|
operating system, you can read https://github.com/thibaudgg/rb-fsevent/wiki/no-fsevents-fired-(OSX-bug)
|
90
91
|
for possible work arounds or you can work around it immediately
|
@@ -122,16 +123,19 @@ module Jekyll
|
|
122
123
|
|
123
124
|
private
|
124
125
|
|
125
|
-
def
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
126
|
+
def destination_map(site)
|
127
|
+
{}.tap do |result|
|
128
|
+
site.each_site_file do |thing|
|
129
|
+
next if allow_used_permalink?(thing)
|
130
|
+
|
131
|
+
dest_path = thing.destination(site.dest)
|
132
|
+
(result[dest_path] ||= []) << thing.path
|
132
133
|
end
|
133
134
|
end
|
134
|
-
|
135
|
+
end
|
136
|
+
|
137
|
+
def allow_used_permalink?(item)
|
138
|
+
defined?(JekyllRedirectFrom) && item.is_a?(JekyllRedirectFrom::RedirectPage)
|
135
139
|
end
|
136
140
|
|
137
141
|
def case_insensitive_urls(things, destination)
|
@@ -20,7 +20,6 @@ module Jekyll
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
# rubocop:disable Metrics/AbcSize
|
24
23
|
def process(args, opts)
|
25
24
|
if !args || args.empty?
|
26
25
|
raise Jekyll::Errors::InvalidThemeName, "You must specify a theme name."
|
@@ -35,7 +34,6 @@ module Jekyll
|
|
35
34
|
" is ready for you in #{theme.path.to_s.cyan}!"
|
36
35
|
Jekyll.logger.info "For help getting started, read #{theme.path}/README.md."
|
37
36
|
end
|
38
|
-
# rubocop:enable Metrics/AbcSize
|
39
37
|
end
|
40
38
|
end
|
41
39
|
end
|
@@ -249,6 +249,9 @@ module Jekyll
|
|
249
249
|
|
250
250
|
def default_url(opts)
|
251
251
|
config = configuration_from_options(opts)
|
252
|
+
auth = config.values_at("host", "port").join(":")
|
253
|
+
return config["url"] if auth == "127.0.0.1:4000"
|
254
|
+
|
252
255
|
format_url(
|
253
256
|
config["ssl_cert"] && config["ssl_key"],
|
254
257
|
config["host"] == "127.0.0.1" ? "localhost" : config["host"],
|
data/lib/jekyll/configuration.rb
CHANGED
@@ -269,21 +269,18 @@ module Jekyll
|
|
269
269
|
|
270
270
|
private
|
271
271
|
|
272
|
+
STYLE_TO_PERMALINK = {
|
273
|
+
:none => "/:categories/:title:output_ext",
|
274
|
+
:date => "/:categories/:year/:month/:day/:title:output_ext",
|
275
|
+
:ordinal => "/:categories/:year/:y_day/:title:output_ext",
|
276
|
+
:pretty => "/:categories/:year/:month/:day/:title/",
|
277
|
+
:weekdate => "/:categories/:year/W:week/:short_day/:title:output_ext",
|
278
|
+
}.freeze
|
279
|
+
|
280
|
+
private_constant :STYLE_TO_PERMALINK
|
281
|
+
|
272
282
|
def style_to_permalink(permalink_style)
|
273
|
-
|
274
|
-
when :pretty
|
275
|
-
"/:categories/:year/:month/:day/:title/"
|
276
|
-
when :none
|
277
|
-
"/:categories/:title:output_ext"
|
278
|
-
when :date
|
279
|
-
"/:categories/:year/:month/:day/:title:output_ext"
|
280
|
-
when :ordinal
|
281
|
-
"/:categories/:year/:y_day/:title:output_ext"
|
282
|
-
when :weekdate
|
283
|
-
"/:categories/:year/W:week/:short_day/:title:output_ext"
|
284
|
-
else
|
285
|
-
permalink_style.to_s
|
286
|
-
end
|
283
|
+
STYLE_TO_PERMALINK[permalink_style.to_sym] || permalink_style.to_s
|
287
284
|
end
|
288
285
|
|
289
286
|
def check_include_exclude(config)
|