jekyll 4.2.1 → 4.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +474 -350
- data/LICENSE +21 -21
- data/README.markdown +83 -86
- 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 → base.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 +186 -190
- data/lib/jekyll/cleaner.rb +111 -111
- data/lib/jekyll/collection.rb +310 -309
- data/lib/jekyll/command.rb +105 -105
- data/lib/jekyll/commands/build.rb +82 -93
- data/lib/jekyll/commands/clean.rb +44 -45
- data/lib/jekyll/commands/doctor.rb +177 -177
- data/lib/jekyll/commands/help.rb +34 -34
- data/lib/jekyll/commands/new.rb +168 -169
- data/lib/jekyll/commands/new_theme.rb +39 -40
- data/lib/jekyll/commands/serve/live_reload_reactor.rb +119 -122
- data/lib/jekyll/commands/serve/livereload_assets/livereload.js +1183 -1183
- data/lib/jekyll/commands/serve/mime_types_charset.json +71 -0
- data/lib/jekyll/commands/serve/servlet.rb +206 -202
- data/lib/jekyll/commands/serve/websockets.rb +81 -81
- data/lib/jekyll/commands/serve.rb +367 -362
- data/lib/jekyll/configuration.rb +313 -313
- data/lib/jekyll/converter.rb +54 -54
- data/lib/jekyll/converters/identity.rb +41 -41
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +197 -199
- data/lib/jekyll/converters/markdown.rb +113 -113
- data/lib/jekyll/converters/smartypants.rb +70 -70
- data/lib/jekyll/convertible.rb +257 -257
- data/lib/jekyll/deprecator.rb +50 -50
- data/lib/jekyll/document.rb +543 -544
- data/lib/jekyll/drops/collection_drop.rb +20 -20
- data/lib/jekyll/drops/document_drop.rb +74 -70
- data/lib/jekyll/drops/drop.rb +293 -293
- data/lib/jekyll/drops/excerpt_drop.rb +23 -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/theme_drop.rb +36 -0
- data/lib/jekyll/drops/unified_payload_drop.rb +30 -26
- data/lib/jekyll/drops/url_drop.rb +140 -140
- data/lib/jekyll/entry_filter.rb +117 -121
- data/lib/jekyll/errors.rb +20 -20
- data/lib/jekyll/excerpt.rb +200 -201
- data/lib/jekyll/external.rb +75 -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 -98
- data/lib/jekyll/filters.rb +532 -535
- data/lib/jekyll/frontmatter_defaults.rb +238 -240
- data/lib/jekyll/generator.rb +5 -5
- data/lib/jekyll/hooks.rb +107 -107
- data/lib/jekyll/inclusion.rb +32 -32
- data/lib/jekyll/layout.rb +55 -67
- data/lib/jekyll/liquid_extensions.rb +22 -22
- data/lib/jekyll/liquid_renderer/file.rb +77 -77
- data/lib/jekyll/liquid_renderer/table.rb +45 -55
- data/lib/jekyll/liquid_renderer.rb +80 -80
- data/lib/jekyll/log_adapter.rb +151 -151
- data/lib/jekyll/mime.types +939 -866
- data/lib/jekyll/page.rb +215 -217
- data/lib/jekyll/page_excerpt.rb +25 -25
- data/lib/jekyll/page_without_a_file.rb +14 -14
- data/lib/jekyll/path_manager.rb +74 -74
- data/lib/jekyll/plugin.rb +92 -92
- data/lib/jekyll/plugin_manager.rb +123 -115
- data/lib/jekyll/profiler.rb +51 -58
- data/lib/jekyll/publisher.rb +23 -23
- data/lib/jekyll/reader.rb +209 -192
- data/lib/jekyll/readers/collection_reader.rb +23 -23
- data/lib/jekyll/readers/data_reader.rb +113 -79
- data/lib/jekyll/readers/layout_reader.rb +62 -62
- data/lib/jekyll/readers/page_reader.rb +25 -25
- data/lib/jekyll/readers/post_reader.rb +85 -85
- data/lib/jekyll/readers/static_file_reader.rb +25 -25
- data/lib/jekyll/readers/theme_assets_reader.rb +52 -52
- data/lib/jekyll/regenerator.rb +195 -195
- data/lib/jekyll/related_posts.rb +52 -52
- data/lib/jekyll/renderer.rb +263 -265
- data/lib/jekyll/site.rb +576 -551
- data/lib/jekyll/static_file.rb +205 -208
- data/lib/jekyll/stevenson.rb +60 -60
- data/lib/jekyll/tags/highlight.rb +114 -110
- data/lib/jekyll/tags/include.rb +275 -275
- data/lib/jekyll/tags/link.rb +42 -42
- data/lib/jekyll/tags/post_url.rb +106 -106
- data/lib/jekyll/theme.rb +90 -86
- data/lib/jekyll/theme_builder.rb +121 -121
- data/lib/jekyll/url.rb +167 -167
- 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 -67
- data/lib/jekyll/utils/thread_event.rb +31 -31
- data/lib/jekyll/utils/win_tz.rb +46 -75
- data/lib/jekyll/utils.rb +371 -367
- data/lib/jekyll/version.rb +5 -5
- data/lib/jekyll.rb +195 -195
- 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 +50 -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 -16
- 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 +64 -18
data/lib/jekyll/entry_filter.rb
CHANGED
@@ -1,121 +1,117 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
class EntryFilter
|
5
|
-
attr_reader :site
|
6
|
-
|
7
|
-
SPECIAL_LEADING_CHAR_REGEX = %r!\A#{Regexp.union([".", "_", "#", "~"])}!o.freeze
|
8
|
-
|
9
|
-
def initialize(site, base_directory = nil)
|
10
|
-
@site = site
|
11
|
-
@base_directory = derive_base_directory(
|
12
|
-
@site, base_directory.to_s.dup
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
def base_directory
|
17
|
-
@base_directory.to_s
|
18
|
-
end
|
19
|
-
|
20
|
-
def derive_base_directory(site, base_dir)
|
21
|
-
base_dir[site.source] = "" if base_dir.start_with?(site.source)
|
22
|
-
base_dir
|
23
|
-
end
|
24
|
-
|
25
|
-
def relative_to_source(entry)
|
26
|
-
File.join(
|
27
|
-
base_directory, entry
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
|
-
def filter(entries)
|
32
|
-
entries.reject do |e|
|
33
|
-
# Reject this entry if it is just a "dot" representation.
|
34
|
-
# e.g.: '.', '..', '_movies/.', 'music/..', etc
|
35
|
-
next true if e.end_with?(".")
|
36
|
-
|
37
|
-
# Check if the current entry is explicitly included and cache the result
|
38
|
-
included = included?(e)
|
39
|
-
|
40
|
-
# Reject current entry if it is excluded but not explicitly included as well.
|
41
|
-
next true if excluded?(e) && !included
|
42
|
-
|
43
|
-
# Reject current entry if it is a symlink.
|
44
|
-
next true if symlink?(e)
|
45
|
-
|
46
|
-
# Do not reject current entry if it is explicitly included.
|
47
|
-
next false if included
|
48
|
-
|
49
|
-
# Reject current entry if it is special or a backup file.
|
50
|
-
special?(e) || backup?(e)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def included?(entry)
|
55
|
-
glob_include?(site.include, entry) ||
|
56
|
-
glob_include?(site.include, File.basename(entry))
|
57
|
-
end
|
58
|
-
|
59
|
-
def special?(entry)
|
60
|
-
SPECIAL_LEADING_CHAR_REGEX.match?(entry) ||
|
61
|
-
SPECIAL_LEADING_CHAR_REGEX.match?(File.basename(entry))
|
62
|
-
end
|
63
|
-
|
64
|
-
def backup?(entry)
|
65
|
-
entry.end_with?("~")
|
66
|
-
end
|
67
|
-
|
68
|
-
def excluded?(entry)
|
69
|
-
glob_include?(site.exclude - site.include, relative_to_source(entry)).tap do |excluded|
|
70
|
-
if excluded
|
71
|
-
Jekyll.logger.debug(
|
72
|
-
"EntryFilter:",
|
73
|
-
"excluded #{relative_to_source(entry)}"
|
74
|
-
)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
# --
|
80
|
-
# Check if a file is a symlink.
|
81
|
-
# NOTE: This can be converted to allowing even in safe,
|
82
|
-
# since we use Pathutil#in_path? now.
|
83
|
-
# --
|
84
|
-
def symlink?(entry)
|
85
|
-
site.safe && File.symlink?(entry) && symlink_outside_site_source?(entry)
|
86
|
-
end
|
87
|
-
|
88
|
-
# --
|
89
|
-
#
|
90
|
-
#
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
class EntryFilter
|
5
|
+
attr_reader :site
|
6
|
+
|
7
|
+
SPECIAL_LEADING_CHAR_REGEX = %r!\A#{Regexp.union([".", "_", "#", "~"])}!o.freeze
|
8
|
+
|
9
|
+
def initialize(site, base_directory = nil)
|
10
|
+
@site = site
|
11
|
+
@base_directory = derive_base_directory(
|
12
|
+
@site, base_directory.to_s.dup
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
def base_directory
|
17
|
+
@base_directory.to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
def derive_base_directory(site, base_dir)
|
21
|
+
base_dir[site.source] = "" if base_dir.start_with?(site.source)
|
22
|
+
base_dir
|
23
|
+
end
|
24
|
+
|
25
|
+
def relative_to_source(entry)
|
26
|
+
File.join(
|
27
|
+
base_directory, entry
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
def filter(entries)
|
32
|
+
entries.reject do |e|
|
33
|
+
# Reject this entry if it is just a "dot" representation.
|
34
|
+
# e.g.: '.', '..', '_movies/.', 'music/..', etc
|
35
|
+
next true if e.end_with?(".")
|
36
|
+
|
37
|
+
# Check if the current entry is explicitly included and cache the result
|
38
|
+
included = included?(e)
|
39
|
+
|
40
|
+
# Reject current entry if it is excluded but not explicitly included as well.
|
41
|
+
next true if excluded?(e) && !included
|
42
|
+
|
43
|
+
# Reject current entry if it is a symlink.
|
44
|
+
next true if symlink?(e)
|
45
|
+
|
46
|
+
# Do not reject current entry if it is explicitly included.
|
47
|
+
next false if included
|
48
|
+
|
49
|
+
# Reject current entry if it is special or a backup file.
|
50
|
+
special?(e) || backup?(e)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def included?(entry)
|
55
|
+
glob_include?(site.include, entry) ||
|
56
|
+
glob_include?(site.include, File.basename(entry))
|
57
|
+
end
|
58
|
+
|
59
|
+
def special?(entry)
|
60
|
+
SPECIAL_LEADING_CHAR_REGEX.match?(entry) ||
|
61
|
+
SPECIAL_LEADING_CHAR_REGEX.match?(File.basename(entry))
|
62
|
+
end
|
63
|
+
|
64
|
+
def backup?(entry)
|
65
|
+
entry.end_with?("~")
|
66
|
+
end
|
67
|
+
|
68
|
+
def excluded?(entry)
|
69
|
+
glob_include?(site.exclude - site.include, relative_to_source(entry)).tap do |excluded|
|
70
|
+
if excluded
|
71
|
+
Jekyll.logger.debug(
|
72
|
+
"EntryFilter:",
|
73
|
+
"excluded #{relative_to_source(entry)}"
|
74
|
+
)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# --
|
80
|
+
# Check if a file is a symlink.
|
81
|
+
# NOTE: This can be converted to allowing even in safe,
|
82
|
+
# since we use Pathutil#in_path? now.
|
83
|
+
# --
|
84
|
+
def symlink?(entry)
|
85
|
+
site.safe && File.symlink?(entry) && symlink_outside_site_source?(entry)
|
86
|
+
end
|
87
|
+
|
88
|
+
# --
|
89
|
+
# Check if given path is outside of current site's configured source directory.
|
90
|
+
# --
|
91
|
+
def symlink_outside_site_source?(entry)
|
92
|
+
!File.realpath(entry).start_with?(site.in_source_dir)
|
93
|
+
end
|
94
|
+
|
95
|
+
# Check if an entry matches a specific pattern.
|
96
|
+
# Returns true if path matches against any glob pattern, else false.
|
97
|
+
def glob_include?(enumerator, entry)
|
98
|
+
entry_with_source = PathManager.join(site.source, entry)
|
99
|
+
entry_is_directory = File.directory?(entry_with_source)
|
100
|
+
|
101
|
+
enumerator.any? do |pattern|
|
102
|
+
case pattern
|
103
|
+
when String
|
104
|
+
pattern_with_source = PathManager.join(site.source, pattern)
|
105
|
+
|
106
|
+
File.fnmatch?(pattern_with_source, entry_with_source) ||
|
107
|
+
entry_with_source.start_with?(pattern_with_source) ||
|
108
|
+
(pattern_with_source == "#{entry_with_source}/" if entry_is_directory)
|
109
|
+
when Regexp
|
110
|
+
pattern.match?(entry_with_source)
|
111
|
+
else
|
112
|
+
false
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
data/lib/jekyll/errors.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
module Errors
|
5
|
-
FatalException = Class.new(::RuntimeError)
|
6
|
-
|
7
|
-
InvalidThemeName = Class.new(FatalException)
|
8
|
-
|
9
|
-
DropMutationException = Class.new(FatalException)
|
10
|
-
InvalidPermalinkError = Class.new(FatalException)
|
11
|
-
InvalidYAMLFrontMatterError = Class.new(FatalException)
|
12
|
-
MissingDependencyException = Class.new(FatalException)
|
13
|
-
|
14
|
-
InvalidDateError = Class.new(FatalException)
|
15
|
-
InvalidPostNameError = Class.new(FatalException)
|
16
|
-
PostURLError = Class.new(FatalException)
|
17
|
-
InvalidURLError = Class.new(FatalException)
|
18
|
-
InvalidConfigurationError = Class.new(FatalException)
|
19
|
-
end
|
20
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Errors
|
5
|
+
FatalException = Class.new(::RuntimeError)
|
6
|
+
|
7
|
+
InvalidThemeName = Class.new(FatalException)
|
8
|
+
|
9
|
+
DropMutationException = Class.new(FatalException)
|
10
|
+
InvalidPermalinkError = Class.new(FatalException)
|
11
|
+
InvalidYAMLFrontMatterError = Class.new(FatalException)
|
12
|
+
MissingDependencyException = Class.new(FatalException)
|
13
|
+
|
14
|
+
InvalidDateError = Class.new(FatalException)
|
15
|
+
InvalidPostNameError = Class.new(FatalException)
|
16
|
+
PostURLError = Class.new(FatalException)
|
17
|
+
InvalidURLError = Class.new(FatalException)
|
18
|
+
InvalidConfigurationError = Class.new(FatalException)
|
19
|
+
end
|
20
|
+
end
|