jekyll 3.9.1 → 4.0.0.pre.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- 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.rb +5 -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 -39
- data/lib/jekyll/commands/new_theme.rb +30 -28
- data/lib/jekyll/commands/serve.rb +46 -80
- data/lib/jekyll/commands/serve/live_reload_reactor.rb +6 -10
- data/lib/jekyll/commands/serve/servlet.rb +9 -11
- data/lib/jekyll/configuration.rb +26 -26
- data/lib/jekyll/converters/identity.rb +18 -0
- data/lib/jekyll/converters/markdown.rb +49 -40
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +1 -10
- 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.rb +72 -31
- 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/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.rb +13 -1
- data/lib/jekyll/liquid_renderer/file.rb +14 -3
- data/lib/jekyll/liquid_renderer/table.rb +67 -65
- data/lib/jekyll/log_adapter.rb +5 -1
- data/lib/jekyll/page.rb +10 -11
- 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 +7 -9
- 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 +2 -3
- data/lib/jekyll/tags/highlight.rb +22 -52
- data/lib/jekyll/tags/include.rb +22 -38
- 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.rb +5 -4
- 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 +1 -1
- data/lib/jekyll/version.rb +1 -1
- 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/site_template/{about.md → about.markdown} +0 -0
- data/lib/site_template/{index.md → index.markdown} +0 -0
- data/lib/theme_template/gitignore.erb +1 -0
- data/rubocop/jekyll/assert_equal_literal_actual.rb +149 -0
- metadata +85 -51
- 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/jekyll/theme_builder.rb
CHANGED
@@ -1,119 +1,121 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
module Jekyll
|
4
|
+
class ThemeBuilder
|
5
|
+
SCAFFOLD_DIRECTORIES = %w(
|
6
|
+
assets _layouts _includes _sass
|
7
|
+
).freeze
|
8
|
+
|
9
|
+
attr_reader :name, :path, :code_of_conduct
|
10
|
+
|
11
|
+
def initialize(theme_name, opts)
|
12
|
+
@name = theme_name.to_s.tr(" ", "_").squeeze("_")
|
13
|
+
@path = Pathname.new(File.expand_path(name, Dir.pwd))
|
14
|
+
@code_of_conduct = !!opts["code_of_conduct"]
|
15
|
+
end
|
9
16
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
def create!
|
18
|
+
create_directories
|
19
|
+
create_starter_files
|
20
|
+
create_gemspec
|
21
|
+
create_accessories
|
22
|
+
initialize_git_repo
|
23
|
+
end
|
15
24
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
create_gemspec
|
20
|
-
create_accessories
|
21
|
-
initialize_git_repo
|
22
|
-
end
|
25
|
+
def user_name
|
26
|
+
@user_name ||= `git config user.name`.chomp
|
27
|
+
end
|
23
28
|
|
24
|
-
|
25
|
-
|
26
|
-
|
29
|
+
def user_email
|
30
|
+
@user_email ||= `git config user.email`.chomp
|
31
|
+
end
|
27
32
|
|
28
|
-
|
29
|
-
@user_email ||= `git config user.email`.chomp
|
30
|
-
end
|
33
|
+
private
|
31
34
|
|
32
|
-
|
35
|
+
def root
|
36
|
+
@root ||= Pathname.new(File.expand_path("../", __dir__))
|
37
|
+
end
|
33
38
|
|
34
|
-
|
35
|
-
|
36
|
-
|
39
|
+
def template_file(filename)
|
40
|
+
[
|
41
|
+
root.join("theme_template", "#{filename}.erb"),
|
42
|
+
root.join("theme_template", filename.to_s),
|
43
|
+
].find(&:exist?)
|
44
|
+
end
|
37
45
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
root.join("theme_template", filename.to_s),
|
42
|
-
].find(&:exist?)
|
43
|
-
end
|
46
|
+
def template(filename)
|
47
|
+
erb.render(template_file(filename).read)
|
48
|
+
end
|
44
49
|
|
45
|
-
|
46
|
-
|
47
|
-
|
50
|
+
def erb
|
51
|
+
@erb ||= ERBRenderer.new(self)
|
52
|
+
end
|
48
53
|
|
49
|
-
|
50
|
-
|
51
|
-
|
54
|
+
def mkdir_p(directories)
|
55
|
+
Array(directories).each do |directory|
|
56
|
+
full_path = path.join(directory)
|
57
|
+
Jekyll.logger.info "create", full_path.to_s
|
58
|
+
FileUtils.mkdir_p(full_path)
|
59
|
+
end
|
60
|
+
end
|
52
61
|
|
53
|
-
|
54
|
-
|
55
|
-
full_path = path.join(directory)
|
62
|
+
def write_file(filename, contents)
|
63
|
+
full_path = path.join(filename)
|
56
64
|
Jekyll.logger.info "create", full_path.to_s
|
57
|
-
|
65
|
+
File.write(full_path, contents)
|
58
66
|
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def write_file(filename, contents)
|
62
|
-
full_path = path.join(filename)
|
63
|
-
Jekyll.logger.info "create", full_path.to_s
|
64
|
-
File.write(full_path, contents)
|
65
|
-
end
|
66
67
|
|
67
|
-
|
68
|
-
|
69
|
-
|
68
|
+
def create_directories
|
69
|
+
mkdir_p(SCAFFOLD_DIRECTORIES)
|
70
|
+
end
|
70
71
|
|
71
|
-
|
72
|
-
|
73
|
-
|
72
|
+
def create_starter_files
|
73
|
+
%w(page post default).each do |layout|
|
74
|
+
write_file("_layouts/#{layout}.html", template("_layouts/#{layout}.html"))
|
75
|
+
end
|
74
76
|
end
|
75
|
-
end
|
76
77
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
def create_gemspec
|
79
|
+
write_file("Gemfile", template("Gemfile"))
|
80
|
+
write_file("#{name}.gemspec", template("theme.gemspec"))
|
81
|
+
end
|
81
82
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
83
|
+
def create_accessories
|
84
|
+
accessories = %w(README.md LICENSE.txt)
|
85
|
+
accessories << "CODE_OF_CONDUCT.md" if code_of_conduct
|
86
|
+
accessories.each do |filename|
|
87
|
+
write_file(filename, template(filename))
|
88
|
+
end
|
87
89
|
end
|
88
|
-
end
|
89
90
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
def initialize_git_repo
|
92
|
+
Jekyll.logger.info "initialize", path.join(".git").to_s
|
93
|
+
Dir.chdir(path.to_s) { `git init` }
|
94
|
+
write_file(".gitignore", template("gitignore"))
|
95
|
+
end
|
95
96
|
|
96
|
-
|
97
|
-
|
97
|
+
class ERBRenderer
|
98
|
+
extend Forwardable
|
98
99
|
|
99
|
-
|
100
|
-
|
101
|
-
|
100
|
+
def_delegator :@theme_builder, :name, :theme_name
|
101
|
+
def_delegator :@theme_builder, :user_name, :user_name
|
102
|
+
def_delegator :@theme_builder, :user_email, :user_email
|
102
103
|
|
103
|
-
|
104
|
-
|
105
|
-
|
104
|
+
def initialize(theme_builder)
|
105
|
+
@theme_builder = theme_builder
|
106
|
+
end
|
106
107
|
|
107
|
-
|
108
|
-
|
109
|
-
|
108
|
+
def jekyll_version_with_minor
|
109
|
+
Jekyll::VERSION.split(".").take(2).join(".")
|
110
|
+
end
|
110
111
|
|
111
|
-
|
112
|
-
|
113
|
-
|
112
|
+
def theme_directories
|
113
|
+
SCAFFOLD_DIRECTORIES
|
114
|
+
end
|
114
115
|
|
115
|
-
|
116
|
-
|
116
|
+
def render(contents)
|
117
|
+
ERB.new(contents).result binding
|
118
|
+
end
|
117
119
|
end
|
118
120
|
end
|
119
121
|
end
|
data/lib/jekyll/url.rb
CHANGED
@@ -68,6 +68,7 @@ module Jekyll
|
|
68
68
|
def generate_url_from_hash(template)
|
69
69
|
@placeholders.inject(template) do |result, token|
|
70
70
|
break result if result.index(":").nil?
|
71
|
+
|
71
72
|
if token.last.nil?
|
72
73
|
# Remove leading "/" to avoid generating urls with `//`
|
73
74
|
result.gsub("/:#{token.first}", "")
|
@@ -98,8 +99,8 @@ module Jekyll
|
|
98
99
|
winner = pool.find { |key| @placeholders.key?(key) }
|
99
100
|
if winner.nil?
|
100
101
|
raise NoMethodError,
|
101
|
-
|
102
|
-
|
102
|
+
"The URL template doesn't have #{pool.join(" or ")} keys. "\
|
103
|
+
"Check your permalink template!"
|
103
104
|
end
|
104
105
|
|
105
106
|
value = @placeholders[winner]
|
data/lib/jekyll/utils.rb
CHANGED
@@ -7,7 +7,6 @@ module Jekyll
|
|
7
7
|
autoload :Exec, "jekyll/utils/exec"
|
8
8
|
autoload :Internet, "jekyll/utils/internet"
|
9
9
|
autoload :Platforms, "jekyll/utils/platforms"
|
10
|
-
autoload :Rouge, "jekyll/utils/rouge"
|
11
10
|
autoload :ThreadEvent, "jekyll/utils/thread_event"
|
12
11
|
autoload :WinTZ, "jekyll/utils/win_tz"
|
13
12
|
|
@@ -153,6 +152,7 @@ module Jekyll
|
|
153
152
|
# Returns true is the string contains sequences of `{%` or `{{`
|
154
153
|
def has_liquid_construct?(content)
|
155
154
|
return false if content.nil? || content.empty?
|
155
|
+
|
156
156
|
content.include?("{%") || content.include?("{{")
|
157
157
|
end
|
158
158
|
# rubocop: enable PredicateName
|
@@ -222,6 +222,7 @@ module Jekyll
|
|
222
222
|
slug.gsub!(%r!^\-|\-$!i, "")
|
223
223
|
|
224
224
|
slug.downcase! unless cased
|
225
|
+
Jekyll.logger.warn("Warning:", "Empty `slug` generated for '#{string}'.") if slug.empty?
|
225
226
|
slug
|
226
227
|
end
|
227
228
|
|
@@ -293,8 +294,10 @@ module Jekyll
|
|
293
294
|
# Returns matched pathes
|
294
295
|
def safe_glob(dir, patterns, flags = 0)
|
295
296
|
return [] unless Dir.exist?(dir)
|
297
|
+
|
296
298
|
pattern = File.join(Array(patterns))
|
297
299
|
return [dir] if pattern.empty?
|
300
|
+
|
298
301
|
Dir.chdir(dir) do
|
299
302
|
Dir.glob(pattern, flags).map { |f| File.join(dir, f) }
|
300
303
|
end
|
@@ -314,6 +317,7 @@ module Jekyll
|
|
314
317
|
end
|
315
318
|
|
316
319
|
private
|
320
|
+
|
317
321
|
def merge_values(target, overwrite)
|
318
322
|
target.merge!(overwrite) do |_key, old_val, new_val|
|
319
323
|
if new_val.nil?
|
@@ -326,14 +330,12 @@ module Jekyll
|
|
326
330
|
end
|
327
331
|
end
|
328
332
|
|
329
|
-
private
|
330
333
|
def merge_default_proc(target, overwrite)
|
331
334
|
if target.is_a?(Hash) && overwrite.is_a?(Hash) && target.default_proc.nil?
|
332
335
|
target.default_proc = overwrite.default_proc
|
333
336
|
end
|
334
337
|
end
|
335
338
|
|
336
|
-
private
|
337
339
|
def duplicate_frozen_values(target)
|
338
340
|
target.each do |key, val|
|
339
341
|
target[key] = val.dup if val.frozen? && duplicable?(val)
|
@@ -344,7 +346,6 @@ module Jekyll
|
|
344
346
|
#
|
345
347
|
# See Utils#slugify for a description of the character sequence specified
|
346
348
|
# by each mode.
|
347
|
-
private
|
348
349
|
def replace_character_sequence_with_hyphen(string, mode: "default")
|
349
350
|
replaceable_char =
|
350
351
|
case mode
|
data/lib/jekyll/utils/ansi.rb
CHANGED
data/lib/jekyll/utils/exec.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
module Jekyll
|
4
4
|
module Utils
|
5
5
|
module Internet
|
6
|
-
|
7
6
|
# Public: Determine whether the present device has a connection to
|
8
7
|
# the Internet. This allows plugin writers which require the outside
|
9
8
|
# world to have a neat fallback mechanism for offline building.
|
@@ -18,13 +17,13 @@ module Jekyll
|
|
18
17
|
# end
|
19
18
|
#
|
20
19
|
# Returns true if a DNS call can successfully be made, or false if not.
|
20
|
+
|
21
21
|
module_function
|
22
|
+
|
22
23
|
def connected?
|
23
24
|
!dns("example.com").nil?
|
24
25
|
end
|
25
26
|
|
26
|
-
private
|
27
|
-
module_function
|
28
27
|
def dns(domain)
|
29
28
|
require "resolv"
|
30
29
|
Resolv::DNS.open do |resolver|
|
@@ -33,7 +32,6 @@ module Jekyll
|
|
33
32
|
rescue Resolv::ResolvError, Resolv::ResolvTimeout
|
34
33
|
nil
|
35
34
|
end
|
36
|
-
|
37
35
|
end
|
38
36
|
end
|
39
37
|
end
|
@@ -31,7 +31,7 @@ module Jekyll
|
|
31
31
|
# --
|
32
32
|
|
33
33
|
alias_method :really_windows?, \
|
34
|
-
|
34
|
+
:vanilla_windows?
|
35
35
|
|
36
36
|
#
|
37
37
|
|
@@ -68,14 +68,14 @@ module Jekyll
|
|
68
68
|
#
|
69
69
|
|
70
70
|
private
|
71
|
+
|
71
72
|
def proc_version
|
72
|
-
@proc_version ||=
|
73
|
-
|
74
|
-
"/proc/version"
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
end
|
73
|
+
@proc_version ||=
|
74
|
+
begin
|
75
|
+
Pathutil.new("/proc/version").read
|
76
|
+
rescue Errno::ENOENT, Errno::EACCES
|
77
|
+
nil
|
78
|
+
end
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "thread"
|
4
|
-
|
5
3
|
module Jekyll
|
6
4
|
module Utils
|
7
5
|
# Based on the pattern and code from
|
@@ -25,9 +23,7 @@ module Jekyll
|
|
25
23
|
|
26
24
|
def wait
|
27
25
|
@lock.synchronize do
|
28
|
-
unless @flag
|
29
|
-
@cond.wait(@lock)
|
30
|
-
end
|
26
|
+
@cond.wait(@lock) unless @flag
|
31
27
|
end
|
32
28
|
end
|
33
29
|
end
|
data/lib/jekyll/utils/win_tz.rb
CHANGED
@@ -21,7 +21,7 @@ module Jekyll
|
|
21
21
|
# is denoted as:
|
22
22
|
# EST+5 (or) EST+05:00
|
23
23
|
# Reference: http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
|
24
|
-
sign = difference
|
24
|
+
sign = difference.negative? ? "-" : "+"
|
25
25
|
offset = sign == "-" ? "+" : "-" unless difference.zero?
|
26
26
|
#
|
27
27
|
# convert the difference (in seconds) to hours, as a rational number, and perform
|
data/lib/jekyll/version.rb
CHANGED
data/lib/site_template/404.html
CHANGED
@@ -7,12 +7,17 @@
|
|
7
7
|
#
|
8
8
|
# For technical reasons, this file is *NOT* reloaded automatically when you use
|
9
9
|
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.
|
10
|
-
|
10
|
+
#
|
11
|
+
# If you need help with YAML syntax, here are some quick references for you:
|
12
|
+
# https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
|
13
|
+
# https://learnxinyminutes.com/docs/yaml/
|
14
|
+
#
|
11
15
|
# Site settings
|
12
16
|
# These are used to personalize your new site. If you look in the HTML files,
|
13
17
|
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
|
14
18
|
# You can create any custom variable you would like, and they will be accessible
|
15
19
|
# in the templates via {{ site.myvariable }}.
|
20
|
+
|
16
21
|
title: Your awesome title
|
17
22
|
email: your-email@example.com
|
18
23
|
description: >- # this means to ignore newlines until "baseurl:"
|
@@ -25,18 +30,25 @@ twitter_username: jekyllrb
|
|
25
30
|
github_username: jekyll
|
26
31
|
|
27
32
|
# Build settings
|
28
|
-
markdown: kramdown
|
29
33
|
theme: minima
|
30
34
|
plugins:
|
31
35
|
- jekyll-feed
|
32
36
|
|
33
37
|
# Exclude from processing.
|
34
|
-
# The following items will not be processed, by default.
|
35
|
-
#
|
38
|
+
# The following items will not be processed, by default.
|
39
|
+
# Any item listed under the `exclude:` key here will be automatically added to
|
40
|
+
# the internal "default list".
|
41
|
+
#
|
42
|
+
# Excluded items can be processed by explicitly listing the directories or
|
43
|
+
# their entries' file path in the `include:` list.
|
44
|
+
#
|
36
45
|
# exclude:
|
46
|
+
# - .sass-cache/
|
47
|
+
# - .jekyll-cache/
|
48
|
+
# - gemfiles/
|
37
49
|
# - Gemfile
|
38
50
|
# - Gemfile.lock
|
39
|
-
# - node_modules
|
51
|
+
# - node_modules/
|
40
52
|
# - vendor/bundle/
|
41
53
|
# - vendor/cache/
|
42
54
|
# - vendor/gems/
|