jekyll 3.4.5 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jekyll might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rubocop.yml +38 -30
- data/exe/jekyll +2 -2
- data/lib/jekyll/collection.rb +2 -2
- data/lib/jekyll/command.rb +5 -0
- data/lib/jekyll/commands/new.rb +1 -1
- data/lib/jekyll/commands/serve.rb +7 -6
- data/lib/jekyll/configuration.rb +64 -42
- data/lib/jekyll/converter.rb +2 -2
- data/lib/jekyll/convertible.rb +5 -3
- data/lib/jekyll/document.rb +61 -44
- data/lib/jekyll/drops/site_drop.rb +4 -0
- data/lib/jekyll/entry_filter.rb +2 -1
- data/lib/jekyll/errors.rb +5 -4
- data/lib/jekyll/external.rb +14 -1
- data/lib/jekyll/filters.rb +23 -21
- data/lib/jekyll/filters/grouping_filters.rb +1 -1
- data/lib/jekyll/filters/url_filters.rb +22 -4
- data/lib/jekyll/hooks.rb +1 -1
- data/lib/jekyll/liquid_renderer/table.rb +2 -2
- data/lib/jekyll/page.rb +1 -1
- data/lib/jekyll/plugin.rb +1 -1
- data/lib/jekyll/plugin_manager.rb +19 -7
- data/lib/jekyll/reader.rb +1 -0
- data/lib/jekyll/readers/data_reader.rb +8 -2
- data/lib/jekyll/readers/theme_assets_reader.rb +1 -1
- data/lib/jekyll/renderer.rb +113 -66
- data/lib/jekyll/site.rb +5 -1
- data/lib/jekyll/tags/post_url.rb +1 -1
- data/lib/jekyll/theme.rb +4 -0
- data/lib/jekyll/url.rb +1 -8
- data/lib/jekyll/utils/win_tz.rb +2 -2
- data/lib/jekyll/version.rb +1 -1
- data/lib/site_template/404.html +24 -0
- data/lib/site_template/_config.yml +13 -4
- data/lib/site_template/about.md +7 -4
- metadata +5 -4
data/lib/jekyll/reader.rb
CHANGED
@@ -19,7 +19,7 @@ module Jekyll
|
|
19
19
|
@content
|
20
20
|
end
|
21
21
|
|
22
|
-
# Read and parse all .yaml, .yml, .json, and .
|
22
|
+
# Read and parse all .yaml, .yml, .json, .csv and .tsv
|
23
23
|
# files under <dir> and add them to the <data> variable.
|
24
24
|
#
|
25
25
|
# dir - The string absolute path of the directory to read.
|
@@ -30,7 +30,7 @@ module Jekyll
|
|
30
30
|
return unless File.directory?(dir) && !@entry_filter.symlink?(dir)
|
31
31
|
|
32
32
|
entries = Dir.chdir(dir) do
|
33
|
-
Dir["*.{yaml,yml,json,csv}"] + Dir["*"].select { |fn| File.directory?(fn) }
|
33
|
+
Dir["*.{yaml,yml,json,csv,tsv}"] + Dir["*"].select { |fn| File.directory?(fn) }
|
34
34
|
end
|
35
35
|
|
36
36
|
entries.each do |entry|
|
@@ -56,6 +56,12 @@ module Jekyll
|
|
56
56
|
:headers => true,
|
57
57
|
:encoding => site.config["encoding"],
|
58
58
|
}).map(&:to_hash)
|
59
|
+
when ".tsv"
|
60
|
+
CSV.read(path, {
|
61
|
+
:col_sep => "\t",
|
62
|
+
:headers => true,
|
63
|
+
:encoding => site.config["encoding"],
|
64
|
+
}).map(&:to_hash)
|
59
65
|
else
|
60
66
|
SafeYAML.load_file(path)
|
61
67
|
end
|
data/lib/jekyll/renderer.rb
CHANGED
@@ -33,50 +33,44 @@ module Jekyll
|
|
33
33
|
# Determine which converters to use based on this document's
|
34
34
|
# extension.
|
35
35
|
#
|
36
|
-
# Returns
|
36
|
+
# Returns Array of Converter instances.
|
37
37
|
def converters
|
38
38
|
@converters ||= site.converters.select { |c| c.matches(document.extname) }.sort
|
39
39
|
end
|
40
40
|
|
41
41
|
# Determine the extname the outputted file should have
|
42
42
|
#
|
43
|
-
# Returns the output extname including the leading period.
|
43
|
+
# Returns String the output extname including the leading period.
|
44
44
|
def output_ext
|
45
45
|
@output_ext ||= (permalink_ext || converter_output_ext)
|
46
46
|
end
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
# Prepare payload and render the document
|
49
|
+
#
|
50
|
+
# Returns String rendered document output
|
52
51
|
def run
|
53
52
|
Jekyll.logger.debug "Rendering:", document.relative_path
|
54
53
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
if document.is_a?(Document) && document.collection.label == "posts"
|
62
|
-
payload["site"]["related_posts"] = document.related_posts
|
63
|
-
else
|
64
|
-
payload["site"]["related_posts"] = nil
|
65
|
-
end
|
66
|
-
|
67
|
-
# render and transform content (this becomes the final content of the object)
|
68
|
-
payload["highlighter_prefix"] = converters.first.highlighter_prefix
|
69
|
-
payload["highlighter_suffix"] = converters.first.highlighter_suffix
|
54
|
+
assign_pages!
|
55
|
+
assign_related_posts!
|
56
|
+
assign_highlighter_options!
|
57
|
+
assign_layout_data!
|
70
58
|
|
71
59
|
Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path
|
72
60
|
document.trigger_hooks(:pre_render, payload)
|
73
61
|
|
62
|
+
render_document
|
63
|
+
end
|
64
|
+
|
65
|
+
# Render the document.
|
66
|
+
#
|
67
|
+
# Returns String rendered document output
|
68
|
+
# rubocop: disable AbcSize
|
69
|
+
def render_document
|
74
70
|
info = {
|
75
|
-
:registers => { :site => site, :page => payload["page"] }
|
71
|
+
:registers => { :site => site, :page => payload["page"] },
|
76
72
|
}
|
77
|
-
|
78
73
|
output = document.content
|
79
|
-
|
80
74
|
if document.render_with_liquid?
|
81
75
|
Jekyll.logger.debug "Rendering Liquid:", document.relative_path
|
82
76
|
output = render_liquid(output, payload, info, document.path)
|
@@ -88,21 +82,16 @@ module Jekyll
|
|
88
82
|
|
89
83
|
if document.place_in_layout?
|
90
84
|
Jekyll.logger.debug "Rendering Layout:", document.relative_path
|
91
|
-
place_in_layouts(
|
92
|
-
output,
|
93
|
-
payload,
|
94
|
-
info
|
95
|
-
)
|
96
|
-
else
|
97
|
-
output
|
85
|
+
output = place_in_layouts(output, payload, info)
|
98
86
|
end
|
87
|
+
|
88
|
+
output
|
99
89
|
end
|
90
|
+
# rubocop: enable AbcSize
|
100
91
|
|
101
|
-
# Convert the
|
102
|
-
#
|
103
|
-
# content - the raw, unconverted content
|
92
|
+
# Convert the document using the converters which match this renderer's document.
|
104
93
|
#
|
105
|
-
# Returns the converted content.
|
94
|
+
# Returns String the converted content.
|
106
95
|
def convert(content)
|
107
96
|
converters.reduce(content) do |output, converter|
|
108
97
|
begin
|
@@ -124,7 +113,7 @@ module Jekyll
|
|
124
113
|
# info -
|
125
114
|
# path - (optional) the path to the file, for use in ex
|
126
115
|
#
|
127
|
-
# Returns the content, rendered by Liquid.
|
116
|
+
# Returns String the content, rendered by Liquid.
|
128
117
|
def render_liquid(content, payload, info, path = nil)
|
129
118
|
template = site.liquid_renderer.file(path).parse(content)
|
130
119
|
template.warnings.each do |e|
|
@@ -144,26 +133,18 @@ module Jekyll
|
|
144
133
|
#
|
145
134
|
# layout - the layout to check
|
146
135
|
#
|
147
|
-
# Returns true if the layout is invalid, false if otherwise
|
136
|
+
# Returns Boolean true if the layout is invalid, false if otherwise
|
148
137
|
def invalid_layout?(layout)
|
149
138
|
!document.data["layout"].nil? && layout.nil? && !(document.is_a? Jekyll::Excerpt)
|
150
139
|
end
|
151
140
|
|
152
|
-
# Render layouts and place
|
141
|
+
# Render layouts and place document content inside.
|
153
142
|
#
|
154
|
-
#
|
155
|
-
#
|
156
|
-
#
|
157
|
-
# Returns the content placed in the Liquid-rendered layouts
|
143
|
+
# Returns String rendered content
|
158
144
|
def place_in_layouts(content, payload, info)
|
159
145
|
output = content.dup
|
160
146
|
layout = layouts[document.data["layout"]]
|
161
|
-
|
162
|
-
Jekyll.logger.warn(
|
163
|
-
"Build Warning:",
|
164
|
-
"Layout '#{document.data["layout"]}' requested in "\
|
165
|
-
"#{document.relative_path} does not exist."
|
166
|
-
) if invalid_layout? layout
|
147
|
+
validate_layout(layout)
|
167
148
|
|
168
149
|
used = Set.new([layout])
|
169
150
|
|
@@ -171,33 +152,97 @@ module Jekyll
|
|
171
152
|
payload["layout"] = nil
|
172
153
|
|
173
154
|
while layout
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
layout.content,
|
179
|
-
payload,
|
180
|
-
info,
|
181
|
-
layout.relative_path
|
182
|
-
)
|
183
|
-
|
184
|
-
# Add layout to dependency tree
|
185
|
-
site.regenerator.add_dependency(
|
186
|
-
site.in_source_dir(document.path),
|
187
|
-
site.in_source_dir(layout.path)
|
188
|
-
) if document.write?
|
189
|
-
|
190
|
-
if (layout = layouts[layout.data["layout"]])
|
155
|
+
output = render_layout(output, layout, info)
|
156
|
+
add_regenerator_dependencies(layout)
|
157
|
+
|
158
|
+
if (layout = site.layouts[layout.data["layout"]])
|
191
159
|
break if used.include?(layout)
|
192
160
|
used << layout
|
193
161
|
end
|
194
162
|
end
|
195
|
-
|
196
163
|
output
|
197
164
|
end
|
198
165
|
|
166
|
+
# Checks if the layout specified in the document actually exists
|
167
|
+
#
|
168
|
+
# layout - the layout to check
|
169
|
+
# Returns nothing
|
199
170
|
private
|
171
|
+
def validate_layout(layout)
|
172
|
+
return unless invalid_layout?(layout)
|
173
|
+
Jekyll.logger.warn(
|
174
|
+
"Build Warning:",
|
175
|
+
"Layout '#{document.data["layout"]}' requested "\
|
176
|
+
"in #{document.relative_path} does not exist."
|
177
|
+
)
|
178
|
+
end
|
200
179
|
|
180
|
+
# Render layout content into document.output
|
181
|
+
#
|
182
|
+
# Returns String rendered content
|
183
|
+
private
|
184
|
+
def render_layout(output, layout, info)
|
185
|
+
payload["content"] = output
|
186
|
+
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
|
187
|
+
|
188
|
+
render_liquid(
|
189
|
+
layout.content,
|
190
|
+
payload,
|
191
|
+
info,
|
192
|
+
layout.relative_path
|
193
|
+
)
|
194
|
+
end
|
195
|
+
|
196
|
+
private
|
197
|
+
def add_regenerator_dependencies(layout)
|
198
|
+
return unless document.write?
|
199
|
+
site.regenerator.add_dependency(
|
200
|
+
site.in_source_dir(document.path),
|
201
|
+
site.in_source_dir(layout.path)
|
202
|
+
)
|
203
|
+
end
|
204
|
+
|
205
|
+
# Set page content to payload and assign pager if document has one.
|
206
|
+
#
|
207
|
+
# Returns nothing
|
208
|
+
private
|
209
|
+
def assign_pages!
|
210
|
+
payload["page"] = document.to_liquid
|
211
|
+
payload["paginator"] = if document.respond_to?(:pager)
|
212
|
+
document.pager.to_liquid
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# Set related posts to payload if document is a post.
|
217
|
+
#
|
218
|
+
# Returns nothing
|
219
|
+
private
|
220
|
+
def assign_related_posts!
|
221
|
+
if document.is_a?(Document) && document.collection.label == "posts"
|
222
|
+
payload["site"]["related_posts"] = document.related_posts
|
223
|
+
else
|
224
|
+
payload["site"]["related_posts"] = nil
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# Set highlighter prefix and suffix
|
229
|
+
#
|
230
|
+
# Returns nothing
|
231
|
+
private
|
232
|
+
def assign_highlighter_options!
|
233
|
+
payload["highlighter_prefix"] = converters.first.highlighter_prefix
|
234
|
+
payload["highlighter_suffix"] = converters.first.highlighter_suffix
|
235
|
+
end
|
236
|
+
|
237
|
+
private
|
238
|
+
def assign_layout_data!
|
239
|
+
layout = layouts[document.data["layout"]]
|
240
|
+
if layout
|
241
|
+
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
private
|
201
246
|
def permalink_ext
|
202
247
|
if document.permalink && !document.permalink.end_with?("/")
|
203
248
|
permalink_ext = File.extname(document.permalink)
|
@@ -205,6 +250,7 @@ module Jekyll
|
|
205
250
|
end
|
206
251
|
end
|
207
252
|
|
253
|
+
private
|
208
254
|
def converter_output_ext
|
209
255
|
if output_exts.size == 1
|
210
256
|
output_exts.last
|
@@ -213,6 +259,7 @@ module Jekyll
|
|
213
259
|
end
|
214
260
|
end
|
215
261
|
|
262
|
+
private
|
216
263
|
def output_exts
|
217
264
|
@output_exts ||= converters.map do |c|
|
218
265
|
c.output_ext(document.extname)
|
data/lib/jekyll/site.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
|
2
3
|
require "csv"
|
3
4
|
|
4
5
|
module Jekyll
|
@@ -45,10 +46,13 @@ module Jekyll
|
|
45
46
|
@config = config.clone
|
46
47
|
|
47
48
|
%w(safe lsi highlighter baseurl exclude include future unpublished
|
48
|
-
show_drafts limit_posts keep_files
|
49
|
+
show_drafts limit_posts keep_files).each do |opt|
|
49
50
|
self.send("#{opt}=", config[opt])
|
50
51
|
end
|
51
52
|
|
53
|
+
# keep using `gems` to avoid breaking change
|
54
|
+
self.gems = config["plugins"]
|
55
|
+
|
52
56
|
configure_plugins
|
53
57
|
configure_theme
|
54
58
|
configure_include_paths
|
data/lib/jekyll/tags/post_url.rb
CHANGED
@@ -81,7 +81,7 @@ eos
|
|
81
81
|
site.posts.docs.each do |p|
|
82
82
|
next unless @post.deprecated_equality p
|
83
83
|
Jekyll::Deprecator.deprecation_message "A call to "\
|
84
|
-
"'{
|
84
|
+
"'{% post_url #{@post.name} %}' did not match " \
|
85
85
|
"a post using the new matching method of checking name " \
|
86
86
|
"(path-date-slug) equality. Please make sure that you " \
|
87
87
|
"change this tag to match the post's name exactly."
|
data/lib/jekyll/theme.rb
CHANGED
data/lib/jekyll/url.rb
CHANGED
@@ -35,15 +35,8 @@ module Jekyll
|
|
35
35
|
# The generated relative URL of the resource
|
36
36
|
#
|
37
37
|
# Returns the String URL
|
38
|
-
# Raises a Jekyll::Errors::InvalidURLError if the relative URL contains a colon
|
39
38
|
def to_s
|
40
|
-
|
41
|
-
if sanitized_url.include?(":")
|
42
|
-
raise Jekyll::Errors::InvalidURLError,
|
43
|
-
"The URL #{sanitized_url} is invalid because it contains a colon."
|
44
|
-
else
|
45
|
-
sanitized_url
|
46
|
-
end
|
39
|
+
sanitize_url(generated_permalink || generated_url)
|
47
40
|
end
|
48
41
|
|
49
42
|
# Generates a URL from the permalink
|
data/lib/jekyll/utils/win_tz.rb
CHANGED
@@ -46,7 +46,7 @@ module Jekyll
|
|
46
46
|
#
|
47
47
|
# Returns a rational number.
|
48
48
|
def rational_hour(seconds)
|
49
|
-
seconds.to_r/3600
|
49
|
+
seconds.to_r / 3600
|
50
50
|
end
|
51
51
|
|
52
52
|
# Private: Convert given seconds to an hour as an absolute number.
|
@@ -56,7 +56,7 @@ module Jekyll
|
|
56
56
|
#
|
57
57
|
# Returns an integer.
|
58
58
|
def absolute_hour(seconds)
|
59
|
-
seconds.abs/3600
|
59
|
+
seconds.abs / 3600
|
60
60
|
end
|
61
61
|
|
62
62
|
# Private: Perform a modulo operation on a given fraction.
|
data/lib/jekyll/version.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
---
|
4
|
+
|
5
|
+
<style type="text/css" media="screen">
|
6
|
+
.container {
|
7
|
+
margin: 10px auto;
|
8
|
+
max-width: 600px;
|
9
|
+
text-align: center;
|
10
|
+
}
|
11
|
+
h1 {
|
12
|
+
margin: 30px 0;
|
13
|
+
font-size: 4em;
|
14
|
+
line-height: 1;
|
15
|
+
letter-spacing: -1px;
|
16
|
+
}
|
17
|
+
</style>
|
18
|
+
|
19
|
+
<div class="container">
|
20
|
+
<h1>404</h1>
|
21
|
+
|
22
|
+
<p><strong>Page not found :(</strong></p>
|
23
|
+
<p>The requested page could not be found.</p>
|
24
|
+
</div>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
# You can create any custom variable you would like, and they will be accessible
|
15
15
|
# in the templates via {{ site.myvariable }}.
|
16
16
|
title: Your awesome title
|
17
|
-
email: your-email@
|
17
|
+
email: your-email@example.com
|
18
18
|
description: > # this means to ignore newlines until "baseurl:"
|
19
19
|
Write an awesome description for your new site here. You can edit this
|
20
20
|
line in _config.yml. It will appear in your document head meta (for
|
@@ -29,6 +29,15 @@ markdown: kramdown
|
|
29
29
|
theme: minima
|
30
30
|
gems:
|
31
31
|
- jekyll-feed
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
|
33
|
+
# Exclude from processing.
|
34
|
+
# The following items will not be processed, by default. Create a custom list
|
35
|
+
# to override the default setting.
|
36
|
+
# exclude:
|
37
|
+
# - Gemfile
|
38
|
+
# - Gemfile.lock
|
39
|
+
# - node_modules
|
40
|
+
# - vendor/bundle/
|
41
|
+
# - vendor/cache/
|
42
|
+
# - vendor/gems/
|
43
|
+
# - vendor/ruby/
|