jekyll 4.0.1 → 4.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +350 -163
- data/LICENSE +21 -21
- data/README.markdown +86 -90
- data/exe/jekyll +57 -57
- data/lib/blank_template/_config.yml +3 -3
- data/lib/blank_template/_layouts/default.html +12 -12
- data/lib/blank_template/_sass/main.scss +9 -9
- data/lib/blank_template/assets/css/main.scss +4 -4
- data/lib/blank_template/index.md +8 -8
- data/lib/jekyll/cache.rb +190 -190
- data/lib/jekyll/cleaner.rb +111 -111
- data/lib/jekyll/collection.rb +309 -309
- data/lib/jekyll/command.rb +105 -103
- data/lib/jekyll/commands/build.rb +93 -93
- data/lib/jekyll/commands/clean.rb +45 -45
- data/lib/jekyll/commands/doctor.rb +177 -173
- data/lib/jekyll/commands/help.rb +34 -34
- data/lib/jekyll/commands/new.rb +169 -169
- data/lib/jekyll/commands/new_theme.rb +40 -42
- data/lib/jekyll/commands/serve/live_reload_reactor.rb +122 -122
- data/lib/jekyll/commands/serve/livereload_assets/livereload.js +1183 -1183
- data/lib/jekyll/commands/serve/servlet.rb +202 -202
- data/lib/jekyll/commands/serve/websockets.rb +81 -81
- data/lib/jekyll/commands/serve.rb +362 -354
- data/lib/jekyll/configuration.rb +313 -316
- data/lib/jekyll/converter.rb +54 -54
- data/lib/jekyll/converters/identity.rb +41 -41
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +199 -130
- data/lib/jekyll/converters/markdown.rb +113 -113
- data/lib/jekyll/converters/smartypants.rb +70 -70
- data/lib/jekyll/convertible.rb +257 -254
- data/lib/jekyll/deprecator.rb +50 -50
- data/lib/jekyll/document.rb +544 -522
- data/lib/jekyll/drops/collection_drop.rb +20 -20
- data/lib/jekyll/drops/document_drop.rb +70 -69
- data/lib/jekyll/drops/drop.rb +293 -215
- data/lib/jekyll/drops/excerpt_drop.rb +19 -19
- data/lib/jekyll/drops/jekyll_drop.rb +32 -32
- data/lib/jekyll/drops/site_drop.rb +66 -66
- data/lib/jekyll/drops/static_file_drop.rb +14 -14
- data/lib/jekyll/drops/unified_payload_drop.rb +26 -26
- data/lib/jekyll/drops/url_drop.rb +140 -132
- data/lib/jekyll/entry_filter.rb +121 -110
- data/lib/jekyll/errors.rb +20 -20
- data/lib/jekyll/excerpt.rb +201 -201
- data/lib/jekyll/external.rb +79 -79
- data/lib/jekyll/filters/date_filters.rb +110 -110
- data/lib/jekyll/filters/grouping_filters.rb +64 -64
- data/lib/jekyll/filters/url_filters.rb +98 -68
- data/lib/jekyll/filters.rb +535 -454
- data/lib/jekyll/frontmatter_defaults.rb +240 -245
- data/lib/jekyll/generator.rb +5 -5
- data/lib/jekyll/hooks.rb +107 -106
- data/lib/jekyll/inclusion.rb +32 -0
- data/lib/jekyll/layout.rb +67 -62
- data/lib/jekyll/liquid_extensions.rb +22 -22
- data/lib/jekyll/liquid_renderer/file.rb +77 -77
- data/lib/jekyll/liquid_renderer/table.rb +55 -75
- data/lib/jekyll/liquid_renderer.rb +80 -77
- data/lib/jekyll/log_adapter.rb +151 -151
- data/lib/jekyll/mime.types +866 -866
- data/lib/jekyll/page.rb +217 -186
- data/lib/jekyll/page_excerpt.rb +25 -0
- data/lib/jekyll/page_without_a_file.rb +14 -14
- data/lib/jekyll/path_manager.rb +74 -31
- data/lib/jekyll/plugin.rb +92 -92
- data/lib/jekyll/plugin_manager.rb +115 -115
- data/lib/jekyll/profiler.rb +58 -0
- data/lib/jekyll/publisher.rb +23 -23
- data/lib/jekyll/reader.rb +192 -187
- data/lib/jekyll/readers/collection_reader.rb +23 -22
- data/lib/jekyll/readers/data_reader.rb +79 -75
- data/lib/jekyll/readers/layout_reader.rb +62 -61
- data/lib/jekyll/readers/page_reader.rb +25 -24
- data/lib/jekyll/readers/post_reader.rb +85 -84
- data/lib/jekyll/readers/static_file_reader.rb +25 -24
- data/lib/jekyll/readers/theme_assets_reader.rb +52 -51
- data/lib/jekyll/regenerator.rb +195 -195
- data/lib/jekyll/related_posts.rb +52 -52
- data/lib/jekyll/renderer.rb +265 -267
- data/lib/jekyll/site.rb +551 -527
- data/lib/jekyll/static_file.rb +208 -203
- data/lib/jekyll/stevenson.rb +60 -60
- data/lib/jekyll/tags/highlight.rb +110 -110
- data/lib/jekyll/tags/include.rb +275 -221
- data/lib/jekyll/tags/link.rb +42 -41
- data/lib/jekyll/tags/post_url.rb +106 -107
- data/lib/jekyll/theme.rb +86 -80
- data/lib/jekyll/theme_builder.rb +121 -121
- data/lib/jekyll/url.rb +167 -164
- data/lib/jekyll/utils/ansi.rb +57 -57
- data/lib/jekyll/utils/exec.rb +26 -26
- data/lib/jekyll/utils/internet.rb +37 -37
- data/lib/jekyll/utils/platforms.rb +67 -82
- data/lib/jekyll/utils/thread_event.rb +31 -31
- data/lib/jekyll/utils/win_tz.rb +75 -75
- data/lib/jekyll/utils.rb +367 -367
- data/lib/jekyll/version.rb +5 -5
- data/lib/jekyll.rb +195 -206
- data/lib/site_template/.gitignore +5 -5
- data/lib/site_template/404.html +25 -25
- data/lib/site_template/_config.yml +55 -55
- data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +29 -29
- data/lib/site_template/about.markdown +18 -18
- data/lib/site_template/index.markdown +6 -6
- data/lib/theme_template/CODE_OF_CONDUCT.md.erb +74 -74
- data/lib/theme_template/Gemfile +4 -4
- data/lib/theme_template/LICENSE.txt.erb +21 -21
- data/lib/theme_template/README.md.erb +52 -52
- data/lib/theme_template/_layouts/default.html +1 -1
- data/lib/theme_template/_layouts/page.html +5 -5
- data/lib/theme_template/_layouts/post.html +5 -5
- data/lib/theme_template/example/_config.yml.erb +1 -1
- data/lib/theme_template/example/_post.md +12 -12
- data/lib/theme_template/example/index.html +14 -14
- data/lib/theme_template/example/style.scss +7 -7
- data/lib/theme_template/gitignore.erb +6 -6
- data/lib/theme_template/theme.gemspec.erb +16 -19
- data/rubocop/jekyll/assert_equal_literal_actual.rb +149 -149
- data/rubocop/jekyll/no_p_allowed.rb +23 -23
- data/rubocop/jekyll/no_puts_allowed.rb +23 -23
- data/rubocop/jekyll.rb +5 -5
- metadata +20 -38
@@ -1,173 +1,177 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
module Commands
|
5
|
-
class Doctor < Command
|
6
|
-
class << self
|
7
|
-
def init_with_program(prog)
|
8
|
-
prog.command(:doctor) do |c|
|
9
|
-
c.syntax "doctor"
|
10
|
-
c.description "Search site and print specific deprecation warnings"
|
11
|
-
c.alias(:hyde)
|
12
|
-
|
13
|
-
c.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array,
|
14
|
-
"Custom configuration file"
|
15
|
-
|
16
|
-
c.action do |_, options|
|
17
|
-
Jekyll::Commands::Doctor.process(options)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def process(options)
|
23
|
-
site = Jekyll::Site.new(configuration_from_options(options))
|
24
|
-
site.reset
|
25
|
-
site.read
|
26
|
-
site.generate
|
27
|
-
|
28
|
-
if healthy?(site)
|
29
|
-
Jekyll.logger.info "Your test results", "are in. Everything looks fine."
|
30
|
-
else
|
31
|
-
abort
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def healthy?(site)
|
36
|
-
[
|
37
|
-
fsnotify_buggy?(site),
|
38
|
-
!deprecated_relative_permalinks(site),
|
39
|
-
!conflicting_urls(site),
|
40
|
-
!urls_only_differ_by_case(site),
|
41
|
-
proper_site_url?(site),
|
42
|
-
properly_gathered_posts?(site),
|
43
|
-
].all?
|
44
|
-
end
|
45
|
-
|
46
|
-
def properly_gathered_posts?(site)
|
47
|
-
return true if site.config["collections_dir"].empty?
|
48
|
-
|
49
|
-
posts_at_root = site.in_source_dir("_posts")
|
50
|
-
return true unless File.directory?(posts_at_root)
|
51
|
-
|
52
|
-
Jekyll.logger.warn "Warning:",
|
53
|
-
"Detected '_posts' directory outside custom `collections_dir`!"
|
54
|
-
Jekyll.logger.warn "",
|
55
|
-
"Please move '#{posts_at_root}' into the custom directory at " \
|
56
|
-
"'#{site.in_source_dir(site.config["collections_dir"])}'"
|
57
|
-
false
|
58
|
-
end
|
59
|
-
|
60
|
-
def deprecated_relative_permalinks(site)
|
61
|
-
if site.config["relative_permalinks"]
|
62
|
-
Jekyll::Deprecator.deprecation_message "Your site still uses relative permalinks," \
|
63
|
-
" which was removed in Jekyll v3.0.0."
|
64
|
-
true
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def conflicting_urls(site)
|
69
|
-
conflicting_urls = false
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
Jekyll.logger.warn "
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
urls.
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
"
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
[
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
end
|
136
|
-
|
137
|
-
def
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Commands
|
5
|
+
class Doctor < Command
|
6
|
+
class << self
|
7
|
+
def init_with_program(prog)
|
8
|
+
prog.command(:doctor) do |c|
|
9
|
+
c.syntax "doctor"
|
10
|
+
c.description "Search site and print specific deprecation warnings"
|
11
|
+
c.alias(:hyde)
|
12
|
+
|
13
|
+
c.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array,
|
14
|
+
"Custom configuration file"
|
15
|
+
|
16
|
+
c.action do |_, options|
|
17
|
+
Jekyll::Commands::Doctor.process(options)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def process(options)
|
23
|
+
site = Jekyll::Site.new(configuration_from_options(options))
|
24
|
+
site.reset
|
25
|
+
site.read
|
26
|
+
site.generate
|
27
|
+
|
28
|
+
if healthy?(site)
|
29
|
+
Jekyll.logger.info "Your test results", "are in. Everything looks fine."
|
30
|
+
else
|
31
|
+
abort
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def healthy?(site)
|
36
|
+
[
|
37
|
+
fsnotify_buggy?(site),
|
38
|
+
!deprecated_relative_permalinks(site),
|
39
|
+
!conflicting_urls(site),
|
40
|
+
!urls_only_differ_by_case(site),
|
41
|
+
proper_site_url?(site),
|
42
|
+
properly_gathered_posts?(site),
|
43
|
+
].all?
|
44
|
+
end
|
45
|
+
|
46
|
+
def properly_gathered_posts?(site)
|
47
|
+
return true if site.config["collections_dir"].empty?
|
48
|
+
|
49
|
+
posts_at_root = site.in_source_dir("_posts")
|
50
|
+
return true unless File.directory?(posts_at_root)
|
51
|
+
|
52
|
+
Jekyll.logger.warn "Warning:",
|
53
|
+
"Detected '_posts' directory outside custom `collections_dir`!"
|
54
|
+
Jekyll.logger.warn "",
|
55
|
+
"Please move '#{posts_at_root}' into the custom directory at " \
|
56
|
+
"'#{site.in_source_dir(site.config["collections_dir"])}'"
|
57
|
+
false
|
58
|
+
end
|
59
|
+
|
60
|
+
def deprecated_relative_permalinks(site)
|
61
|
+
if site.config["relative_permalinks"]
|
62
|
+
Jekyll::Deprecator.deprecation_message "Your site still uses relative permalinks," \
|
63
|
+
" which was removed in Jekyll v3.0.0."
|
64
|
+
true
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def conflicting_urls(site)
|
69
|
+
conflicting_urls = false
|
70
|
+
destination_map(site).each do |dest, paths|
|
71
|
+
next unless paths.size > 1
|
72
|
+
|
73
|
+
conflicting_urls = true
|
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 ""
|
80
|
+
end
|
81
|
+
conflicting_urls
|
82
|
+
end
|
83
|
+
|
84
|
+
def fsnotify_buggy?(_site)
|
85
|
+
return true unless Utils::Platforms.osx?
|
86
|
+
|
87
|
+
if Dir.pwd != `pwd`.strip
|
88
|
+
Jekyll.logger.error <<~STR
|
89
|
+
We have detected that there might be trouble using fsevent on your
|
90
|
+
operating system, you can read https://github.com/thibaudgg/rb-fsevent/wiki/no-fsevents-fired-(OSX-bug)
|
91
|
+
for possible work arounds or you can work around it immediately
|
92
|
+
with `--force-polling`.
|
93
|
+
STR
|
94
|
+
|
95
|
+
false
|
96
|
+
end
|
97
|
+
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
101
|
+
def urls_only_differ_by_case(site)
|
102
|
+
urls_only_differ_by_case = false
|
103
|
+
urls = case_insensitive_urls(site.pages + site.docs_to_write, site.dest)
|
104
|
+
urls.each_value do |real_urls|
|
105
|
+
next unless real_urls.uniq.size > 1
|
106
|
+
|
107
|
+
urls_only_differ_by_case = true
|
108
|
+
Jekyll.logger.warn "Warning:", "The following URLs only differ" \
|
109
|
+
" by case. On a case-insensitive file system one of the URLs" \
|
110
|
+
" will be overwritten by the other: #{real_urls.join(", ")}"
|
111
|
+
end
|
112
|
+
urls_only_differ_by_case
|
113
|
+
end
|
114
|
+
|
115
|
+
def proper_site_url?(site)
|
116
|
+
url = site.config["url"]
|
117
|
+
[
|
118
|
+
url_exists?(url),
|
119
|
+
url_valid?(url),
|
120
|
+
url_absolute(url),
|
121
|
+
].all?
|
122
|
+
end
|
123
|
+
|
124
|
+
private
|
125
|
+
|
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
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def allow_used_permalink?(item)
|
138
|
+
defined?(JekyllRedirectFrom) && item.is_a?(JekyllRedirectFrom::RedirectPage)
|
139
|
+
end
|
140
|
+
|
141
|
+
def case_insensitive_urls(things, destination)
|
142
|
+
things.each_with_object({}) do |thing, memo|
|
143
|
+
dest = thing.destination(destination)
|
144
|
+
(memo[dest.downcase] ||= []) << dest
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def url_exists?(url)
|
149
|
+
return true unless url.nil? || url.empty?
|
150
|
+
|
151
|
+
Jekyll.logger.warn "Warning:", "You didn't set an URL in the config file, "\
|
152
|
+
"you may encounter problems with some plugins."
|
153
|
+
false
|
154
|
+
end
|
155
|
+
|
156
|
+
def url_valid?(url)
|
157
|
+
Addressable::URI.parse(url)
|
158
|
+
true
|
159
|
+
# Addressable::URI#parse only raises a TypeError
|
160
|
+
# https://git.io/vFfbx
|
161
|
+
rescue TypeError
|
162
|
+
Jekyll.logger.warn "Warning:", "The site URL does not seem to be valid, "\
|
163
|
+
"check the value of `url` in your config file."
|
164
|
+
false
|
165
|
+
end
|
166
|
+
|
167
|
+
def url_absolute(url)
|
168
|
+
return true if url.is_a?(String) && Addressable::URI.parse(url).absolute?
|
169
|
+
|
170
|
+
Jekyll.logger.warn "Warning:", "Your site URL does not seem to be absolute, "\
|
171
|
+
"check the value of `url` in your config file."
|
172
|
+
false
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
data/lib/jekyll/commands/help.rb
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
module Commands
|
5
|
-
class Help < Command
|
6
|
-
class << self
|
7
|
-
def init_with_program(prog)
|
8
|
-
prog.command(:help) do |c|
|
9
|
-
c.syntax "help [subcommand]"
|
10
|
-
c.description "Show the help message, optionally for a given subcommand."
|
11
|
-
|
12
|
-
c.action do |args, _|
|
13
|
-
cmd = (args.first || "").to_sym
|
14
|
-
if args.empty?
|
15
|
-
Jekyll.logger.info prog.to_s
|
16
|
-
elsif prog.has_command? cmd
|
17
|
-
Jekyll.logger.info prog.commands[cmd].to_s
|
18
|
-
else
|
19
|
-
invalid_command(prog, cmd)
|
20
|
-
abort
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def invalid_command(prog, cmd)
|
27
|
-
Jekyll.logger.error "Error:",
|
28
|
-
"Hmm... we don't know what the '#{cmd}' command is."
|
29
|
-
Jekyll.logger.info "Valid commands:", prog.commands.keys.join(", ")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Commands
|
5
|
+
class Help < Command
|
6
|
+
class << self
|
7
|
+
def init_with_program(prog)
|
8
|
+
prog.command(:help) do |c|
|
9
|
+
c.syntax "help [subcommand]"
|
10
|
+
c.description "Show the help message, optionally for a given subcommand."
|
11
|
+
|
12
|
+
c.action do |args, _|
|
13
|
+
cmd = (args.first || "").to_sym
|
14
|
+
if args.empty?
|
15
|
+
Jekyll.logger.info prog.to_s
|
16
|
+
elsif prog.has_command? cmd
|
17
|
+
Jekyll.logger.info prog.commands[cmd].to_s
|
18
|
+
else
|
19
|
+
invalid_command(prog, cmd)
|
20
|
+
abort
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def invalid_command(prog, cmd)
|
27
|
+
Jekyll.logger.error "Error:",
|
28
|
+
"Hmm... we don't know what the '#{cmd}' command is."
|
29
|
+
Jekyll.logger.info "Valid commands:", prog.commands.keys.join(", ")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|