jekyll 3.10.0 → 4.0.0.pre.alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +27 -50
- data/LICENSE +1 -1
- data/README.markdown +46 -17
- data/lib/blank_template/_config.yml +3 -0
- data/lib/blank_template/_layouts/default.html +12 -0
- data/lib/blank_template/_sass/main.scss +9 -0
- data/lib/blank_template/assets/css/main.scss +4 -0
- data/lib/blank_template/index.md +8 -0
- data/lib/jekyll/cache.rb +183 -0
- data/lib/jekyll/cleaner.rb +2 -1
- data/lib/jekyll/collection.rb +78 -8
- data/lib/jekyll/command.rb +31 -6
- data/lib/jekyll/commands/build.rb +11 -20
- data/lib/jekyll/commands/clean.rb +2 -0
- data/lib/jekyll/commands/doctor.rb +15 -8
- data/lib/jekyll/commands/help.rb +1 -1
- data/lib/jekyll/commands/new.rb +37 -42
- data/lib/jekyll/commands/new_theme.rb +30 -28
- data/lib/jekyll/commands/serve/live_reload_reactor.rb +6 -10
- data/lib/jekyll/commands/serve/servlet.rb +15 -19
- data/lib/jekyll/commands/serve.rb +46 -86
- data/lib/jekyll/configuration.rb +26 -26
- data/lib/jekyll/converters/identity.rb +18 -0
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +1 -10
- data/lib/jekyll/converters/markdown.rb +49 -40
- data/lib/jekyll/converters/smartypants.rb +34 -14
- data/lib/jekyll/convertible.rb +11 -13
- data/lib/jekyll/deprecator.rb +1 -3
- data/lib/jekyll/document.rb +44 -41
- data/lib/jekyll/drops/collection_drop.rb +2 -3
- data/lib/jekyll/drops/document_drop.rb +2 -1
- data/lib/jekyll/drops/drop.rb +3 -6
- data/lib/jekyll/drops/excerpt_drop.rb +4 -0
- data/lib/jekyll/drops/site_drop.rb +4 -13
- data/lib/jekyll/drops/unified_payload_drop.rb +1 -0
- data/lib/jekyll/drops/url_drop.rb +1 -0
- data/lib/jekyll/entry_filter.rb +2 -1
- data/lib/jekyll/excerpt.rb +45 -34
- data/lib/jekyll/external.rb +10 -5
- data/lib/jekyll/filters/date_filters.rb +6 -3
- data/lib/jekyll/filters/grouping_filters.rb +1 -2
- data/lib/jekyll/filters/url_filters.rb +6 -1
- data/lib/jekyll/filters.rb +72 -31
- data/lib/jekyll/frontmatter_defaults.rb +35 -19
- data/lib/jekyll/hooks.rb +2 -3
- data/lib/jekyll/liquid_extensions.rb +0 -2
- data/lib/jekyll/liquid_renderer/file.rb +14 -3
- data/lib/jekyll/liquid_renderer/table.rb +67 -65
- data/lib/jekyll/liquid_renderer.rb +13 -1
- data/lib/jekyll/log_adapter.rb +5 -1
- data/lib/jekyll/mime.types +80 -195
- data/lib/jekyll/page.rb +10 -26
- data/lib/jekyll/page_without_a_file.rb +0 -4
- data/lib/jekyll/plugin.rb +5 -11
- data/lib/jekyll/plugin_manager.rb +2 -0
- data/lib/jekyll/reader.rb +38 -8
- data/lib/jekyll/readers/data_reader.rb +5 -5
- data/lib/jekyll/readers/layout_reader.rb +2 -12
- data/lib/jekyll/readers/post_reader.rb +29 -17
- data/lib/jekyll/readers/static_file_reader.rb +1 -1
- data/lib/jekyll/readers/theme_assets_reader.rb +7 -5
- data/lib/jekyll/regenerator.rb +4 -12
- data/lib/jekyll/renderer.rb +14 -25
- data/lib/jekyll/site.rb +78 -34
- data/lib/jekyll/static_file.rb +47 -11
- data/lib/jekyll/stevenson.rb +7 -5
- data/lib/jekyll/tags/highlight.rb +22 -52
- data/lib/jekyll/tags/include.rb +27 -48
- data/lib/jekyll/tags/link.rb +11 -7
- data/lib/jekyll/tags/post_url.rb +17 -16
- data/lib/jekyll/theme.rb +12 -23
- data/lib/jekyll/theme_builder.rb +91 -89
- data/lib/jekyll/url.rb +3 -2
- data/lib/jekyll/utils/ansi.rb +1 -1
- data/lib/jekyll/utils/exec.rb +0 -1
- data/lib/jekyll/utils/internet.rb +2 -4
- data/lib/jekyll/utils/platforms.rb +8 -8
- data/lib/jekyll/utils/thread_event.rb +1 -5
- data/lib/jekyll/utils/win_tz.rb +47 -18
- data/lib/jekyll/utils.rb +5 -4
- data/lib/jekyll/version.rb +1 -1
- data/lib/jekyll.rb +5 -0
- data/lib/site_template/.gitignore +2 -0
- data/lib/site_template/404.html +1 -0
- data/lib/site_template/_config.yml +17 -5
- data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +5 -1
- data/lib/theme_template/gitignore.erb +1 -0
- data/rubocop/jekyll/assert_equal_literal_actual.rb +149 -0
- metadata +70 -71
- data/lib/jekyll/commands/serve/mime_types_charset.json +0 -71
- data/lib/jekyll/converters/markdown/rdiscount_parser.rb +0 -37
- data/lib/jekyll/converters/markdown/redcarpet_parser.rb +0 -112
- data/lib/jekyll/utils/rouge.rb +0 -22
- /data/lib/site_template/{about.md → about.markdown} +0 -0
- /data/lib/site_template/{index.md → index.markdown} +0 -0
@@ -43,7 +43,7 @@ module Jekyll
|
|
43
43
|
|
44
44
|
# This class inserts the LiveReload script tags into HTML as it is served
|
45
45
|
class BodyProcessor
|
46
|
-
HEAD_TAG_REGEX = %r!<head>|<head[^(er)][^<]
|
46
|
+
HEAD_TAG_REGEX = %r!<head>|<head[^(er)][^<]*>!.freeze
|
47
47
|
|
48
48
|
attr_reader :content_length, :new_body, :livereload_added
|
49
49
|
|
@@ -121,9 +121,7 @@ module Jekyll
|
|
121
121
|
if @options["livereload_max_delay"]
|
122
122
|
src += "&maxdelay=#{@options["livereload_max_delay"]}"
|
123
123
|
end
|
124
|
-
if @options["livereload_port"]
|
125
|
-
src += "&port=#{@options["livereload_port"]}"
|
126
|
-
end
|
124
|
+
src += "&port=#{@options["livereload_port"]}" if @options["livereload_port"]
|
127
125
|
src
|
128
126
|
end
|
129
127
|
end
|
@@ -137,13 +135,14 @@ module Jekyll
|
|
137
135
|
def initialize(server, root, callbacks)
|
138
136
|
# So we can access them easily.
|
139
137
|
@jekyll_opts = server.config[:JekyllOptions]
|
140
|
-
@mime_types_charset = server.config[:MimeTypesCharset]
|
141
138
|
set_defaults
|
142
139
|
super
|
143
140
|
end
|
144
141
|
|
145
142
|
def search_index_file(req, res)
|
146
|
-
super ||
|
143
|
+
super ||
|
144
|
+
search_file(req, res, ".html") ||
|
145
|
+
search_file(req, res, ".xhtml")
|
147
146
|
end
|
148
147
|
|
149
148
|
# Add the ability to tap file.html the same way that Nginx does on our
|
@@ -152,7 +151,9 @@ module Jekyll
|
|
152
151
|
|
153
152
|
def search_file(req, res, basename)
|
154
153
|
# /file.* > /file/index.html > /file.html
|
155
|
-
super ||
|
154
|
+
super ||
|
155
|
+
super(req, res, "#{basename}.html") ||
|
156
|
+
super(req, res, "#{basename}.xhtml")
|
156
157
|
end
|
157
158
|
|
158
159
|
# rubocop:disable Naming/MethodName
|
@@ -173,7 +174,7 @@ module Jekyll
|
|
173
174
|
end
|
174
175
|
end
|
175
176
|
|
176
|
-
|
177
|
+
validate_and_ensure_charset(req, res)
|
177
178
|
res.header.merge!(@headers)
|
178
179
|
rtn
|
179
180
|
end
|
@@ -181,20 +182,15 @@ module Jekyll
|
|
181
182
|
|
182
183
|
private
|
183
184
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
#
|
188
|
-
# Refer `script/vendor-mimes` in the repository for further details.
|
189
|
-
def conditionally_inject_charset(res)
|
190
|
-
typ = res.header["content-type"]
|
191
|
-
return unless @mime_types_charset.key?(typ)
|
192
|
-
return if %r!;\s*charset=!.match?(typ)
|
185
|
+
def validate_and_ensure_charset(_req, res)
|
186
|
+
key = res.header.keys.grep(%r!content-type!i).first
|
187
|
+
typ = res.header[key]
|
193
188
|
|
194
|
-
|
189
|
+
unless typ =~ %r!;\s*charset=!
|
190
|
+
res.header[key] = "#{typ}; charset=#{@jekyll_opts["encoding"]}"
|
191
|
+
end
|
195
192
|
end
|
196
193
|
|
197
|
-
#
|
198
194
|
def set_defaults
|
199
195
|
hash_ = @jekyll_opts.fetch("webrick", {}).fetch("headers", {})
|
200
196
|
DEFAULTS.each_with_object(@headers = hash_) do |(key, val), hash|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "thread"
|
4
|
-
|
5
3
|
module Jekyll
|
6
4
|
module Commands
|
7
5
|
class Serve < Command
|
@@ -19,31 +17,36 @@ module Jekyll
|
|
19
17
|
"host" => ["host", "-H", "--host [HOST]", "Host to bind to"],
|
20
18
|
"open_url" => ["-o", "--open-url", "Launch your site in a browser"],
|
21
19
|
"detach" => ["-B", "--detach",
|
22
|
-
|
20
|
+
"Run the server in the background",],
|
23
21
|
"ssl_key" => ["--ssl-key [KEY]", "X.509 (SSL) Private Key."],
|
24
22
|
"port" => ["-P", "--port [PORT]", "Port to listen on"],
|
25
23
|
"show_dir_listing" => ["--show-dir-listing",
|
26
|
-
|
24
|
+
"Show a directory listing instead of loading" \
|
25
|
+
" your index file.",],
|
27
26
|
"skip_initial_build" => ["skip_initial_build", "--skip-initial-build",
|
28
|
-
|
27
|
+
"Skips the initial site build which occurs before" \
|
28
|
+
" the server is started.",],
|
29
29
|
"livereload" => ["-l", "--livereload",
|
30
|
-
|
30
|
+
"Use LiveReload to automatically refresh browsers",],
|
31
31
|
"livereload_ignore" => ["--livereload-ignore ignore GLOB1[,GLOB2[,...]]",
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
Array,
|
33
|
+
"Files for LiveReload to ignore. " \
|
34
|
+
"Remember to quote the values so your shell " \
|
35
|
+
"won't expand them",],
|
35
36
|
"livereload_min_delay" => ["--livereload-min-delay [SECONDS]",
|
36
|
-
|
37
|
+
"Minimum reload delay",],
|
37
38
|
"livereload_max_delay" => ["--livereload-max-delay [SECONDS]",
|
38
|
-
|
39
|
+
"Maximum reload delay",],
|
39
40
|
"livereload_port" => ["--livereload-port [PORT]", Integer,
|
40
|
-
|
41
|
+
"Port for LiveReload to listen on",],
|
41
42
|
}.freeze
|
42
43
|
|
43
44
|
DIRECTORY_INDEX = %w(
|
44
45
|
index.htm
|
45
46
|
index.html
|
46
47
|
index.rhtml
|
48
|
+
index.xht
|
49
|
+
index.xhtml
|
47
50
|
index.cgi
|
48
51
|
index.xml
|
49
52
|
index.json
|
@@ -72,25 +75,17 @@ module Jekyll
|
|
72
75
|
opts["serving"] = true
|
73
76
|
opts["watch"] = true unless opts.key?("watch")
|
74
77
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
78
|
+
# Set the reactor to nil so any old reactor will be GCed.
|
79
|
+
# We can't unregister a hook so while running tests we don't want to
|
80
|
+
# inadvertently keep using a reactor created by a previous test.
|
81
|
+
@reload_reactor = nil
|
79
82
|
|
80
|
-
|
81
|
-
|
82
|
-
def start(opts)
|
83
|
-
# Set the reactor to nil so any old reactor will be GCed.
|
84
|
-
# We can't unregister a hook so in testing when Serve.start is
|
85
|
-
# called multiple times we don't want to inadvertently keep using
|
86
|
-
# a reactor created by a previous test when our test might not
|
87
|
-
@reload_reactor = nil
|
83
|
+
config = configuration_from_options(opts)
|
84
|
+
config["url"] = default_url(config) if Jekyll.env == "development"
|
88
85
|
|
89
|
-
|
90
|
-
|
91
|
-
config["url"] = default_url(config)
|
86
|
+
process_with_graceful_fail(cmd, config, Build, Serve)
|
87
|
+
end
|
92
88
|
end
|
93
|
-
[Build, Serve].each { |klass| klass.process(config) }
|
94
89
|
end
|
95
90
|
|
96
91
|
#
|
@@ -98,7 +93,10 @@ module Jekyll
|
|
98
93
|
def process(opts)
|
99
94
|
opts = configuration_from_options(opts)
|
100
95
|
destination = opts["destination"]
|
101
|
-
|
96
|
+
if opts["livereload"]
|
97
|
+
validate_options(opts)
|
98
|
+
register_reload_hooks(opts)
|
99
|
+
end
|
102
100
|
setup(destination)
|
103
101
|
|
104
102
|
start_up_webrick(opts, destination)
|
@@ -111,11 +109,12 @@ module Jekyll
|
|
111
109
|
# Perform logical validation of CLI options
|
112
110
|
|
113
111
|
private
|
112
|
+
|
114
113
|
def validate_options(opts)
|
115
114
|
if opts["livereload"]
|
116
115
|
if opts["detach"]
|
117
|
-
Jekyll.logger.warn "Warning:",
|
118
|
-
|
116
|
+
Jekyll.logger.warn "Warning:", "--detach and --livereload are mutually exclusive." \
|
117
|
+
" Choosing --livereload"
|
119
118
|
opts["detach"] = false
|
120
119
|
end
|
121
120
|
if opts["ssl_cert"] || opts["ssl_key"]
|
@@ -130,18 +129,15 @@ module Jekyll
|
|
130
129
|
opts["watch"] = true
|
131
130
|
end
|
132
131
|
elsif %w(livereload_min_delay
|
133
|
-
|
134
|
-
|
135
|
-
|
132
|
+
livereload_max_delay
|
133
|
+
livereload_ignore
|
134
|
+
livereload_port).any? { |o| opts[o] }
|
136
135
|
Jekyll.logger.abort_with "--livereload-min-delay, "\
|
137
136
|
"--livereload-max-delay, --livereload-ignore, and "\
|
138
137
|
"--livereload-port require the --livereload option."
|
139
138
|
end
|
140
139
|
end
|
141
140
|
|
142
|
-
#
|
143
|
-
|
144
|
-
private
|
145
141
|
# rubocop:disable Metrics/AbcSize
|
146
142
|
def register_reload_hooks(opts)
|
147
143
|
require_relative "serve/live_reload_reactor"
|
@@ -179,7 +175,6 @@ module Jekyll
|
|
179
175
|
# when we get ready to party, checking for an setting up an error page
|
180
176
|
# and making sure our destination exists.
|
181
177
|
|
182
|
-
private
|
183
178
|
def setup(destination)
|
184
179
|
require_relative "serve/servlet"
|
185
180
|
|
@@ -194,15 +189,11 @@ module Jekyll
|
|
194
189
|
end
|
195
190
|
end
|
196
191
|
|
197
|
-
#
|
198
|
-
|
199
|
-
private
|
200
192
|
def webrick_opts(opts)
|
201
193
|
opts = {
|
202
194
|
:JekyllOptions => opts,
|
203
195
|
:DoNotReverseLookup => true,
|
204
196
|
:MimeTypes => mime_types,
|
205
|
-
:MimeTypesCharset => mime_types_charset,
|
206
197
|
:DocumentRoot => opts["destination"],
|
207
198
|
:StartCallback => start_callback(opts["detach"]),
|
208
199
|
:StopCallback => stop_callback(opts["detach"]),
|
@@ -218,13 +209,8 @@ module Jekyll
|
|
218
209
|
opts
|
219
210
|
end
|
220
211
|
|
221
|
-
#
|
222
|
-
|
223
|
-
private
|
224
212
|
def start_up_webrick(opts, destination)
|
225
|
-
if opts["livereload"]
|
226
|
-
@reload_reactor.start(opts)
|
227
|
-
end
|
213
|
+
@reload_reactor.start(opts) if opts["livereload"]
|
228
214
|
|
229
215
|
@server = WEBrick::HTTPServer.new(webrick_opts(opts)).tap { |o| o.unmount("") }
|
230
216
|
@server.mount(opts["baseurl"].to_s, Servlet, destination, file_handler_opts)
|
@@ -235,20 +221,15 @@ module Jekyll
|
|
235
221
|
end
|
236
222
|
|
237
223
|
# Recreate NondisclosureName under utf-8 circumstance
|
238
|
-
|
239
|
-
private
|
240
224
|
def file_handler_opts
|
241
|
-
WEBrick::Config::FileHandler.merge(
|
225
|
+
WEBrick::Config::FileHandler.merge(
|
242
226
|
:FancyIndexing => true,
|
243
227
|
:NondisclosureName => [
|
244
228
|
".ht*", "~*",
|
245
|
-
]
|
246
|
-
|
229
|
+
]
|
230
|
+
)
|
247
231
|
end
|
248
232
|
|
249
|
-
#
|
250
|
-
|
251
|
-
private
|
252
233
|
def server_address(server, options = {})
|
253
234
|
format_url(
|
254
235
|
server.config[:SSLEnable],
|
@@ -258,19 +239,14 @@ module Jekyll
|
|
258
239
|
)
|
259
240
|
end
|
260
241
|
|
261
|
-
private
|
262
242
|
def format_url(ssl_enabled, address, port, baseurl = nil)
|
263
|
-
format("%<prefix>s://%<address>s:%<port>i%<baseurl>s",
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
})
|
243
|
+
format("%<prefix>s://%<address>s:%<port>i%<baseurl>s",
|
244
|
+
:prefix => ssl_enabled ? "https" : "http",
|
245
|
+
:address => address,
|
246
|
+
:port => port,
|
247
|
+
:baseurl => baseurl ? "#{baseurl}/" : "")
|
269
248
|
end
|
270
249
|
|
271
|
-
#
|
272
|
-
|
273
|
-
private
|
274
250
|
def default_url(opts)
|
275
251
|
config = configuration_from_options(opts)
|
276
252
|
format_url(
|
@@ -280,14 +256,12 @@ module Jekyll
|
|
280
256
|
)
|
281
257
|
end
|
282
258
|
|
283
|
-
#
|
284
|
-
|
285
|
-
private
|
286
259
|
def launch_browser(server, opts)
|
287
260
|
address = server_address(server, opts)
|
288
261
|
return system "start", address if Utils::Platforms.windows?
|
289
262
|
return system "xdg-open", address if Utils::Platforms.linux?
|
290
263
|
return system "open", address if Utils::Platforms.osx?
|
264
|
+
|
291
265
|
Jekyll.logger.error "Refusing to launch browser; " \
|
292
266
|
"Platform launcher unknown."
|
293
267
|
end
|
@@ -295,8 +269,6 @@ module Jekyll
|
|
295
269
|
# Keep in our area with a thread or detach the server as requested
|
296
270
|
# by the user. This method determines what we do based on what you
|
297
271
|
# ask us to do.
|
298
|
-
|
299
|
-
private
|
300
272
|
def boot_or_detach(server, opts)
|
301
273
|
if opts["detach"]
|
302
274
|
pid = Process.fork do
|
@@ -305,7 +277,8 @@ module Jekyll
|
|
305
277
|
|
306
278
|
Process.detach(pid)
|
307
279
|
Jekyll.logger.info "Server detached with pid '#{pid}'.", \
|
308
|
-
|
280
|
+
"Run `pkill -f jekyll' or `kill -9 #{pid}'" \
|
281
|
+
" to stop the server."
|
309
282
|
else
|
310
283
|
t = Thread.new { server.start }
|
311
284
|
trap("INT") { server.shutdown }
|
@@ -314,8 +287,6 @@ module Jekyll
|
|
314
287
|
end
|
315
288
|
|
316
289
|
# Make the stack verbose if the user requests it.
|
317
|
-
|
318
|
-
private
|
319
290
|
def enable_logging(opts)
|
320
291
|
opts[:AccessLog] = []
|
321
292
|
level = WEBrick::Log.const_get(opts[:JekyllOptions]["verbose"] ? :DEBUG : :WARN)
|
@@ -325,8 +296,6 @@ module Jekyll
|
|
325
296
|
# Add SSL to the stack if the user triggers --enable-ssl and they
|
326
297
|
# provide both types of certificates commonly needed. Raise if they
|
327
298
|
# forget to add one of the certificates.
|
328
|
-
|
329
|
-
private
|
330
299
|
def enable_ssl(opts)
|
331
300
|
cert, key, src =
|
332
301
|
opts[:JekyllOptions].values_at("ssl_cert", "ssl_key", "source")
|
@@ -342,13 +311,12 @@ module Jekyll
|
|
342
311
|
opts[:SSLEnable] = true
|
343
312
|
end
|
344
313
|
|
345
|
-
private
|
346
314
|
def start_callback(detached)
|
347
315
|
unless detached
|
348
316
|
proc do
|
349
317
|
mutex.synchronize do
|
350
318
|
# Block until EventMachine reactor starts
|
351
|
-
@reload_reactor
|
319
|
+
@reload_reactor&.started_event&.wait
|
352
320
|
@running = true
|
353
321
|
Jekyll.logger.info("Server running...", "press ctrl-c to stop.")
|
354
322
|
@run_cond.broadcast
|
@@ -357,7 +325,6 @@ module Jekyll
|
|
357
325
|
end
|
358
326
|
end
|
359
327
|
|
360
|
-
private
|
361
328
|
def stop_callback(detached)
|
362
329
|
unless detached
|
363
330
|
proc do
|
@@ -373,18 +340,11 @@ module Jekyll
|
|
373
340
|
end
|
374
341
|
end
|
375
342
|
|
376
|
-
private
|
377
343
|
def mime_types
|
378
344
|
file = File.expand_path("../mime.types", __dir__)
|
379
345
|
WEBrick::HTTPUtils.load_mime_types(file)
|
380
346
|
end
|
381
347
|
|
382
|
-
private
|
383
|
-
|
384
|
-
def mime_types_charset
|
385
|
-
SafeYAML.load_file(File.expand_path("serve/mime_types_charset.json", __dir__))
|
386
|
-
end
|
387
|
-
|
388
348
|
def read_file(source_dir, file_path)
|
389
349
|
File.read(Jekyll.sanitized_path(source_dir, file_path))
|
390
350
|
end
|
data/lib/jekyll/configuration.rb
CHANGED
@@ -9,6 +9,7 @@ module Jekyll
|
|
9
9
|
"source" => Dir.pwd,
|
10
10
|
"destination" => File.join(Dir.pwd, "_site"),
|
11
11
|
"collections_dir" => "",
|
12
|
+
"cache_dir" => ".jekyll-cache",
|
12
13
|
"plugins_dir" => "_plugins",
|
13
14
|
"layouts_dir" => "_layouts",
|
14
15
|
"data_dir" => "_data",
|
@@ -18,10 +19,7 @@ module Jekyll
|
|
18
19
|
# Handling Reading
|
19
20
|
"safe" => false,
|
20
21
|
"include" => [".htaccess"],
|
21
|
-
"exclude" =>
|
22
|
-
Gemfile Gemfile.lock node_modules vendor/bundle/ vendor/cache/ vendor/gems/
|
23
|
-
vendor/ruby/
|
24
|
-
),
|
22
|
+
"exclude" => [],
|
25
23
|
"keep_files" => [".git", ".svn"],
|
26
24
|
"encoding" => "utf-8",
|
27
25
|
"markdown_ext" => "markdown,mkdown,mkdn,mkd,md",
|
@@ -66,14 +64,6 @@ module Jekyll
|
|
66
64
|
"strict_variables" => false,
|
67
65
|
},
|
68
66
|
|
69
|
-
"rdiscount" => {
|
70
|
-
"extensions" => [],
|
71
|
-
},
|
72
|
-
|
73
|
-
"redcarpet" => {
|
74
|
-
"extensions" => [],
|
75
|
-
},
|
76
|
-
|
77
67
|
"kramdown" => {
|
78
68
|
"auto_ids" => true,
|
79
69
|
"toc_levels" => "1..6",
|
@@ -100,7 +90,7 @@ module Jekyll
|
|
100
90
|
# problems and backwards-compatibility.
|
101
91
|
def from(user_config)
|
102
92
|
Utils.deep_merge_hashes(DEFAULTS, Configuration[user_config].stringify_keys)
|
103
|
-
.add_default_collections
|
93
|
+
.add_default_collections.add_default_excludes
|
104
94
|
end
|
105
95
|
end
|
106
96
|
|
@@ -162,7 +152,7 @@ module Jekyll
|
|
162
152
|
# Get configuration from <source>/_config.yml or <source>/<config_file>
|
163
153
|
config_files = override["config"]
|
164
154
|
if config_files.to_s.empty?
|
165
|
-
default = %w(yml yaml).find(-> { "yml" }) do |ext|
|
155
|
+
default = %w(yml yaml toml).find(-> { "yml" }) do |ext|
|
166
156
|
File.exist?(Jekyll.sanitized_path(source(override), "_config.#{ext}"))
|
167
157
|
end
|
168
158
|
config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
|
@@ -177,6 +167,7 @@ module Jekyll
|
|
177
167
|
#
|
178
168
|
# Returns this configuration, overridden by the values in the file
|
179
169
|
def read_config_file(file)
|
170
|
+
file = File.expand_path(file)
|
180
171
|
next_config = safe_load_file(file)
|
181
172
|
check_config_is_hash!(next_config, file)
|
182
173
|
Jekyll.logger.info "Configuration file:", file
|
@@ -204,6 +195,7 @@ module Jekyll
|
|
204
195
|
begin
|
205
196
|
files.each do |config_file|
|
206
197
|
next if config_file.nil? || config_file.empty?
|
198
|
+
|
207
199
|
new_config = read_config_file(config_file)
|
208
200
|
configuration = Utils.deep_merge_hashes(configuration, new_config)
|
209
201
|
end
|
@@ -277,7 +269,22 @@ module Jekyll
|
|
277
269
|
config
|
278
270
|
end
|
279
271
|
|
280
|
-
|
272
|
+
DEFAULT_EXCLUDES = %w(
|
273
|
+
.sass-cache .jekyll-cache
|
274
|
+
gemfiles Gemfile Gemfile.lock
|
275
|
+
node_modules
|
276
|
+
vendor/bundle/ vendor/cache/ vendor/gems/ vendor/ruby/
|
277
|
+
).freeze
|
278
|
+
|
279
|
+
def add_default_excludes
|
280
|
+
config = clone
|
281
|
+
return config if config["exclude"].nil?
|
282
|
+
|
283
|
+
config["exclude"].concat(DEFAULT_EXCLUDES).uniq!
|
284
|
+
config
|
285
|
+
end
|
286
|
+
|
287
|
+
def renamed_key(old, new, config)
|
281
288
|
if config.key?(old)
|
282
289
|
Jekyll::Deprecator.deprecation_message "The '#{old}' configuration" \
|
283
290
|
" option has been renamed to '#{new}'. Please update your config" \
|
@@ -287,6 +294,7 @@ module Jekyll
|
|
287
294
|
end
|
288
295
|
|
289
296
|
private
|
297
|
+
|
290
298
|
def style_to_permalink(permalink_style)
|
291
299
|
case permalink_style.to_sym
|
292
300
|
when :pretty
|
@@ -308,14 +316,12 @@ module Jekyll
|
|
308
316
|
# file - the file from which the config was extracted
|
309
317
|
#
|
310
318
|
# Raises an ArgumentError if given config is not a hash
|
311
|
-
private
|
312
319
|
def check_config_is_hash!(extracted_config, file)
|
313
320
|
unless extracted_config.is_a?(Hash)
|
314
321
|
raise ArgumentError, "Configuration file: (INVALID) #{file}".yellow
|
315
322
|
end
|
316
323
|
end
|
317
324
|
|
318
|
-
private
|
319
325
|
def check_auto(config)
|
320
326
|
if config.key?("auto") || config.key?("watch")
|
321
327
|
Jekyll::Deprecator.deprecation_message "Auto-regeneration can no longer" \
|
@@ -326,7 +332,6 @@ module Jekyll
|
|
326
332
|
end
|
327
333
|
end
|
328
334
|
|
329
|
-
private
|
330
335
|
def check_server(config)
|
331
336
|
if config.key?("server")
|
332
337
|
Jekyll::Deprecator.deprecation_message "The 'server' configuration option" \
|
@@ -336,7 +341,6 @@ module Jekyll
|
|
336
341
|
end
|
337
342
|
end
|
338
343
|
|
339
|
-
private
|
340
344
|
def check_pygments(config)
|
341
345
|
if config.key?("pygments")
|
342
346
|
Jekyll::Deprecator.deprecation_message "The 'pygments' configuration option" \
|
@@ -349,7 +353,6 @@ module Jekyll
|
|
349
353
|
end
|
350
354
|
end
|
351
355
|
|
352
|
-
private
|
353
356
|
def check_include_exclude(config)
|
354
357
|
%w(include exclude).each do |option|
|
355
358
|
if config[option].is_a?(String)
|
@@ -359,11 +362,10 @@ module Jekyll
|
|
359
362
|
" as a list of comma-separated values."
|
360
363
|
config[option] = csv_to_array(config[option])
|
361
364
|
end
|
362
|
-
config[option]
|
365
|
+
config[option]&.map!(&:to_s)
|
363
366
|
end
|
364
367
|
end
|
365
368
|
|
366
|
-
private
|
367
369
|
def check_coderay(config)
|
368
370
|
if (config["kramdown"] || {}).key?("use_coderay")
|
369
371
|
Jekyll::Deprecator.deprecation_message "Please change 'use_coderay'" \
|
@@ -372,7 +374,6 @@ module Jekyll
|
|
372
374
|
end
|
373
375
|
end
|
374
376
|
|
375
|
-
private
|
376
377
|
def check_maruku(config)
|
377
378
|
if config.fetch("markdown", "kramdown").to_s.casecmp("maruku").zero?
|
378
379
|
Jekyll.logger.abort_with "Error:", "You're using the 'maruku' " \
|
@@ -389,7 +390,6 @@ module Jekyll
|
|
389
390
|
#
|
390
391
|
# Raises a Jekyll::Errors::InvalidConfigurationError if the config `plugins`
|
391
392
|
# is a string
|
392
|
-
private
|
393
393
|
def check_plugins(config)
|
394
394
|
if config.key?("plugins") && config["plugins"].is_a?(String)
|
395
395
|
Jekyll.logger.error "Configuration Error:", "You specified the" \
|
@@ -397,8 +397,8 @@ module Jekyll
|
|
397
397
|
" use an array instead. If you wanted to set the directory of your" \
|
398
398
|
" plugins, use the config key `plugins_dir` instead."
|
399
399
|
raise Jekyll::Errors::InvalidConfigurationError,
|
400
|
-
|
401
|
-
|
400
|
+
"'plugins' should not be a string, but was: " \
|
401
|
+
"#{config["plugins"].inspect}. Use 'plugins_dir' instead."
|
402
402
|
end
|
403
403
|
end
|
404
404
|
end
|
@@ -2,19 +2,37 @@
|
|
2
2
|
|
3
3
|
module Jekyll
|
4
4
|
module Converters
|
5
|
+
# Identify converter. Returns same content as given.
|
6
|
+
# For more info on converters see https://jekyllrb.com/docs/plugins/converters/
|
5
7
|
class Identity < Converter
|
6
8
|
safe true
|
7
9
|
|
8
10
|
priority :lowest
|
9
11
|
|
12
|
+
# Public: Does the given extension match this converter's list of acceptable extensions?
|
13
|
+
# Takes one argument: the file's extension (including the dot).
|
14
|
+
#
|
15
|
+
# ext - The String extension to check (not relevant here)
|
16
|
+
#
|
17
|
+
# Returns true since it always matches.
|
10
18
|
def matches(_ext)
|
11
19
|
true
|
12
20
|
end
|
13
21
|
|
22
|
+
# Public: The extension to be given to the output file (including the dot).
|
23
|
+
#
|
24
|
+
# ext - The String extension or original file.
|
25
|
+
#
|
26
|
+
# Returns The String output file extension.
|
14
27
|
def output_ext(ext)
|
15
28
|
ext
|
16
29
|
end
|
17
30
|
|
31
|
+
# Logic to do the content conversion.
|
32
|
+
#
|
33
|
+
# content - String content of file (without front matter).
|
34
|
+
#
|
35
|
+
# Returns a String of the converted content.
|
18
36
|
def convert(content)
|
19
37
|
content
|
20
38
|
end
|
@@ -31,7 +31,6 @@ module Jekyll
|
|
31
31
|
def setup
|
32
32
|
@config["syntax_highlighter"] ||= highlighter
|
33
33
|
@config["syntax_highlighter_opts"] ||= {}
|
34
|
-
@config["syntax_highlighter_opts"]["default_lang"] ||= "plaintext"
|
35
34
|
@config["syntax_highlighter_opts"]["guess_lang"] = @config["guess_lang"]
|
36
35
|
@config["coderay"] ||= {} # XXX: Legacy.
|
37
36
|
modernize_coderay_config
|
@@ -52,10 +51,7 @@ module Jekyll
|
|
52
51
|
private
|
53
52
|
|
54
53
|
def load_dependencies
|
55
|
-
|
56
|
-
if @config["input"] == "GFM"
|
57
|
-
Jekyll::External.require_with_graceful_fail("kramdown-parser-gfm")
|
58
|
-
end
|
54
|
+
require "kramdown-parser-gfm" if @config["input"] == "GFM"
|
59
55
|
|
60
56
|
if highlighter == "coderay"
|
61
57
|
Jekyll::External.require_with_graceful_fail("kramdown-syntax-coderay")
|
@@ -80,8 +76,6 @@ module Jekyll
|
|
80
76
|
# config[highlighter]
|
81
77
|
# Where `enable_coderay` is now deprecated because Kramdown
|
82
78
|
# supports Rouge now too.
|
83
|
-
|
84
|
-
private
|
85
79
|
def highlighter
|
86
80
|
return @highlighter if @highlighter
|
87
81
|
|
@@ -105,7 +99,6 @@ module Jekyll
|
|
105
99
|
end
|
106
100
|
end
|
107
101
|
|
108
|
-
private
|
109
102
|
def strip_coderay_prefix(hash)
|
110
103
|
hash.each_with_object({}) do |(key, val), hsh|
|
111
104
|
cleaned_key = key.to_s.gsub(%r!\Acoderay_!, "")
|
@@ -123,8 +116,6 @@ module Jekyll
|
|
123
116
|
# If our highlighter is CodeRay we go in to merge the CodeRay defaults
|
124
117
|
# with your "coderay" key if it's there, deprecating it in the
|
125
118
|
# process of you using it.
|
126
|
-
|
127
|
-
private
|
128
119
|
def modernize_coderay_config
|
129
120
|
unless @config["coderay"].empty?
|
130
121
|
Jekyll::Deprecator.deprecation_message(
|