jekyll 3.8.3 → 3.9.2
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 +5 -5
- data/.rubocop.yml +2 -0
- data/lib/jekyll/commands/new.rb +13 -2
- data/lib/jekyll/commands/serve/mime_types_charset.json +71 -0
- data/lib/jekyll/commands/serve/servlet.rb +13 -11
- data/lib/jekyll/commands/serve.rb +6 -0
- data/lib/jekyll/configuration.rb +1 -0
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +21 -0
- data/lib/jekyll/convertible.rb +1 -1
- data/lib/jekyll/document.rb +3 -3
- data/lib/jekyll/drops/site_drop.rb +11 -2
- data/lib/jekyll/entry_filter.rb +6 -3
- data/lib/jekyll/excerpt.rb +33 -21
- data/lib/jekyll/liquid_renderer.rb +3 -1
- data/lib/jekyll/mime.types +195 -80
- data/lib/jekyll/readers/data_reader.rb +4 -6
- data/lib/jekyll/site.rb +3 -3
- data/lib/jekyll/tags/include.rb +14 -8
- data/lib/jekyll/theme.rb +19 -3
- data/lib/jekyll/utils/platforms.rb +2 -2
- data/lib/jekyll/version.rb +1 -1
- metadata +27 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d1f18811c89301d6ac1f83c43a4d2c1780bbe1e69e15c660ddef08048826bed5
|
4
|
+
data.tar.gz: ad03fafa2fc29fbdcd80f517ccef5f07eb109e79c83334c1aa7142a5b2561f64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8b270aaeff77e73442f5f6094c063254716873107b5aacaef68b992a9c15bedca1c5b4921965de784cdb823abdbe37f9af504c82d566bded0a831c80b674161
|
7
|
+
data.tar.gz: 7cfb965920cf1ddf96d515c94ce25b0595a9d23ff434607f70aba4ea668dfc1e7e2e46f19d0ebe03c1f733360eb0d7c9c9616210396623f884111be656942d61
|
data/.rubocop.yml
CHANGED
data/lib/jekyll/commands/new.rb
CHANGED
@@ -88,11 +88,22 @@ group :jekyll_plugins do
|
|
88
88
|
end
|
89
89
|
|
90
90
|
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
91
|
-
|
91
|
+
# and associated library.
|
92
|
+
install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
|
93
|
+
gem "tzinfo", "~> 1.2"
|
94
|
+
gem "tzinfo-data"
|
95
|
+
end
|
92
96
|
|
93
97
|
# Performance-booster for watching directories on Windows
|
94
|
-
gem "wdm", "~> 0.1.0"
|
98
|
+
gem "wdm", "~> 0.1.0", :install_if => Gem.win_platform?
|
99
|
+
|
100
|
+
# kramdown v2 ships without the gfm parser by default. If you're using
|
101
|
+
# kramdown v1, comment out this line.
|
102
|
+
gem "kramdown-parser-gfm"
|
95
103
|
|
104
|
+
# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
|
105
|
+
# do not have a Java counterpart.
|
106
|
+
gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]
|
96
107
|
RUBY
|
97
108
|
end
|
98
109
|
|
@@ -0,0 +1,71 @@
|
|
1
|
+
{
|
2
|
+
"application/javascript": "UTF-8",
|
3
|
+
"application/json": "UTF-8",
|
4
|
+
"application/manifest+json": "UTF-8",
|
5
|
+
"application/vnd.syncml+xml": "UTF-8",
|
6
|
+
"application/vnd.syncml.dm+wbxml": "UTF-8",
|
7
|
+
"application/vnd.syncml.dm+xml": "UTF-8",
|
8
|
+
"application/vnd.syncml.dmddf+xml": "UTF-8",
|
9
|
+
"application/vnd.wap.wbxml": "UTF-8",
|
10
|
+
"text/cache-manifest": "UTF-8",
|
11
|
+
"text/calendar": "UTF-8",
|
12
|
+
"text/coffeescript": "UTF-8",
|
13
|
+
"text/css": "UTF-8",
|
14
|
+
"text/csv": "UTF-8",
|
15
|
+
"text/html": "UTF-8",
|
16
|
+
"text/jade": "UTF-8",
|
17
|
+
"text/jsx": "UTF-8",
|
18
|
+
"text/less": "UTF-8",
|
19
|
+
"text/markdown": "UTF-8",
|
20
|
+
"text/mathml": "UTF-8",
|
21
|
+
"text/mdx": "UTF-8",
|
22
|
+
"text/n3": "UTF-8",
|
23
|
+
"text/plain": "UTF-8",
|
24
|
+
"text/prs.lines.tag": "UTF-8",
|
25
|
+
"text/richtext": "UTF-8",
|
26
|
+
"text/sgml": "UTF-8",
|
27
|
+
"text/shex": "UTF-8",
|
28
|
+
"text/slim": "UTF-8",
|
29
|
+
"text/spdx": "UTF-8",
|
30
|
+
"text/stylus": "UTF-8",
|
31
|
+
"text/tab-separated-values": "UTF-8",
|
32
|
+
"text/troff": "UTF-8",
|
33
|
+
"text/turtle": "UTF-8",
|
34
|
+
"text/uri-list": "UTF-8",
|
35
|
+
"text/vcard": "UTF-8",
|
36
|
+
"text/vnd.curl": "UTF-8",
|
37
|
+
"text/vnd.curl.dcurl": "UTF-8",
|
38
|
+
"text/vnd.curl.mcurl": "UTF-8",
|
39
|
+
"text/vnd.curl.scurl": "UTF-8",
|
40
|
+
"text/vnd.familysearch.gedcom": "UTF-8",
|
41
|
+
"text/vnd.fly": "UTF-8",
|
42
|
+
"text/vnd.fmi.flexstor": "UTF-8",
|
43
|
+
"text/vnd.graphviz": "UTF-8",
|
44
|
+
"text/vnd.in3d.3dml": "UTF-8",
|
45
|
+
"text/vnd.in3d.spot": "UTF-8",
|
46
|
+
"text/vnd.sun.j2me.app-descriptor": "UTF-8",
|
47
|
+
"text/vnd.wap.wml": "UTF-8",
|
48
|
+
"text/vnd.wap.wmlscript": "UTF-8",
|
49
|
+
"text/vtt": "UTF-8",
|
50
|
+
"text/x-asm": "UTF-8",
|
51
|
+
"text/x-c": "UTF-8",
|
52
|
+
"text/x-component": "UTF-8",
|
53
|
+
"text/x-fortran": "UTF-8",
|
54
|
+
"text/x-handlebars-template": "UTF-8",
|
55
|
+
"text/x-java-source": "UTF-8",
|
56
|
+
"text/x-lua": "UTF-8",
|
57
|
+
"text/x-markdown": "UTF-8",
|
58
|
+
"text/x-nfo": "UTF-8",
|
59
|
+
"text/x-opml": "UTF-8",
|
60
|
+
"text/x-pascal": "UTF-8",
|
61
|
+
"text/x-processing": "UTF-8",
|
62
|
+
"text/x-sass": "UTF-8",
|
63
|
+
"text/x-scss": "UTF-8",
|
64
|
+
"text/x-setext": "UTF-8",
|
65
|
+
"text/x-sfv": "UTF-8",
|
66
|
+
"text/x-suse-ymp": "UTF-8",
|
67
|
+
"text/x-uuencode": "UTF-8",
|
68
|
+
"text/x-vcalendar": "UTF-8",
|
69
|
+
"text/x-vcard": "UTF-8",
|
70
|
+
"text/yaml": "UTF-8"
|
71
|
+
}
|
@@ -137,6 +137,7 @@ module Jekyll
|
|
137
137
|
def initialize(server, root, callbacks)
|
138
138
|
# So we can access them easily.
|
139
139
|
@jekyll_opts = server.config[:JekyllOptions]
|
140
|
+
@mime_types_charset = server.config[:MimeTypesCharset]
|
140
141
|
set_defaults
|
141
142
|
super
|
142
143
|
end
|
@@ -172,27 +173,28 @@ module Jekyll
|
|
172
173
|
end
|
173
174
|
end
|
174
175
|
|
175
|
-
|
176
|
+
conditionally_inject_charset(res)
|
176
177
|
res.header.merge!(@headers)
|
177
178
|
rtn
|
178
179
|
end
|
179
180
|
# rubocop:enable Naming/MethodName
|
180
181
|
|
181
|
-
#
|
182
|
-
|
183
182
|
private
|
184
|
-
def validate_and_ensure_charset(_req, res)
|
185
|
-
key = res.header.keys.grep(%r!content-type!i).first
|
186
|
-
typ = res.header[key]
|
187
183
|
|
188
|
-
|
189
|
-
|
190
|
-
|
184
|
+
#
|
185
|
+
# Inject charset based on Jekyll config only if our mime-types database contains
|
186
|
+
# the charset metadata.
|
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)
|
193
|
+
|
194
|
+
res.header["content-type"] = "#{typ}; charset=#{@jekyll_opts["encoding"]}"
|
191
195
|
end
|
192
196
|
|
193
197
|
#
|
194
|
-
|
195
|
-
private
|
196
198
|
def set_defaults
|
197
199
|
hash_ = @jekyll_opts.fetch("webrick", {}).fetch("headers", {})
|
198
200
|
DEFAULTS.each_with_object(@headers = hash_) do |(key, val), hash|
|
@@ -202,6 +202,7 @@ module Jekyll
|
|
202
202
|
:JekyllOptions => opts,
|
203
203
|
:DoNotReverseLookup => true,
|
204
204
|
:MimeTypes => mime_types,
|
205
|
+
:MimeTypesCharset => mime_types_charset,
|
205
206
|
:DocumentRoot => opts["destination"],
|
206
207
|
:StartCallback => start_callback(opts["detach"]),
|
207
208
|
:StopCallback => stop_callback(opts["detach"]),
|
@@ -379,6 +380,11 @@ module Jekyll
|
|
379
380
|
end
|
380
381
|
|
381
382
|
private
|
383
|
+
|
384
|
+
def mime_types_charset
|
385
|
+
SafeYAML.load_file(File.expand_path("serve/mime_types_charset.json", __dir__))
|
386
|
+
end
|
387
|
+
|
382
388
|
def read_file(source_dir, file_path)
|
383
389
|
File.read(Jekyll.sanitized_path(source_dir, file_path))
|
384
390
|
end
|
data/lib/jekyll/configuration.rb
CHANGED
@@ -18,6 +18,7 @@ module Jekyll
|
|
18
18
|
@config = config["kramdown"] || {}
|
19
19
|
@highlighter = nil
|
20
20
|
setup
|
21
|
+
load_dependencies
|
21
22
|
end
|
22
23
|
|
23
24
|
# Setup and normalize the configuration:
|
@@ -30,6 +31,8 @@ module Jekyll
|
|
30
31
|
def setup
|
31
32
|
@config["syntax_highlighter"] ||= highlighter
|
32
33
|
@config["syntax_highlighter_opts"] ||= {}
|
34
|
+
@config["syntax_highlighter_opts"]["default_lang"] ||= "plaintext"
|
35
|
+
@config["syntax_highlighter_opts"]["guess_lang"] = @config["guess_lang"]
|
33
36
|
@config["coderay"] ||= {} # XXX: Legacy.
|
34
37
|
modernize_coderay_config
|
35
38
|
make_accessible
|
@@ -47,6 +50,24 @@ module Jekyll
|
|
47
50
|
end
|
48
51
|
|
49
52
|
private
|
53
|
+
|
54
|
+
def load_dependencies
|
55
|
+
return if Kramdown::VERSION.to_i < 2
|
56
|
+
if @config["input"] == "GFM"
|
57
|
+
Jekyll::External.require_with_graceful_fail("kramdown-parser-gfm")
|
58
|
+
end
|
59
|
+
|
60
|
+
if highlighter == "coderay"
|
61
|
+
Jekyll::External.require_with_graceful_fail("kramdown-syntax-coderay")
|
62
|
+
end
|
63
|
+
|
64
|
+
# `mathjax` emgine is bundled within kramdown-2.x and will be handled by
|
65
|
+
# kramdown itself.
|
66
|
+
if (math_engine = @config["math_engine"]) && math_engine != "mathjax"
|
67
|
+
Jekyll::External.require_with_graceful_fail("kramdown-math-#{math_engine}")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
50
71
|
def make_accessible(hash = @config)
|
51
72
|
hash.keys.each do |key|
|
52
73
|
hash[key.to_sym] = hash[key]
|
data/lib/jekyll/convertible.rb
CHANGED
@@ -39,7 +39,7 @@ module Jekyll
|
|
39
39
|
|
40
40
|
begin
|
41
41
|
self.content = File.read(@path || site.in_source_dir(base, name),
|
42
|
-
Utils.merged_file_read_opts(site, opts))
|
42
|
+
**Utils.merged_file_read_opts(site, opts))
|
43
43
|
if content =~ Document::YAML_FRONT_MATTER_REGEXP
|
44
44
|
self.content = $POSTMATCH
|
45
45
|
self.data = SafeYAML.load(Regexp.last_match(1))
|
data/lib/jekyll/document.rb
CHANGED
@@ -266,7 +266,7 @@ module Jekyll
|
|
266
266
|
else
|
267
267
|
begin
|
268
268
|
merge_defaults
|
269
|
-
read_content(opts)
|
269
|
+
read_content(**opts)
|
270
270
|
read_post_data
|
271
271
|
rescue StandardError => e
|
272
272
|
handle_read_error(e)
|
@@ -445,8 +445,8 @@ module Jekyll
|
|
445
445
|
end
|
446
446
|
|
447
447
|
private
|
448
|
-
def read_content(opts)
|
449
|
-
self.content = File.read(path, Utils.merged_file_read_opts(site, opts))
|
448
|
+
def read_content(**opts)
|
449
|
+
self.content = File.read(path, **Utils.merged_file_read_opts(site, opts))
|
450
450
|
if content =~ YAML_FRONT_MATTER_REGEXP
|
451
451
|
self.content = $POSTMATCH
|
452
452
|
data_file = SafeYAML.load(Regexp.last_match(1))
|
@@ -8,8 +8,7 @@ module Jekyll
|
|
8
8
|
mutable false
|
9
9
|
|
10
10
|
def_delegator :@obj, :site_data, :data
|
11
|
-
def_delegators :@obj, :time, :pages, :static_files, :
|
12
|
-
:tags, :categories
|
11
|
+
def_delegators :@obj, :time, :pages, :static_files, :tags, :categories
|
13
12
|
|
14
13
|
private def_delegator :@obj, :config, :fallback_data
|
15
14
|
|
@@ -39,6 +38,16 @@ module Jekyll
|
|
39
38
|
@site_collections ||= @obj.collections.values.sort_by(&:label).map(&:to_liquid)
|
40
39
|
end
|
41
40
|
|
41
|
+
# `Site#documents` cannot be memoized so that `Site#docs_to_write` can access the
|
42
|
+
# latest state of the attribute.
|
43
|
+
#
|
44
|
+
# Since this method will be called after `Site#pre_render` hook,
|
45
|
+
# the `Site#documents` array shouldn't thereafter change and can therefore be
|
46
|
+
# safely memoized to prevent additional computation of `Site#documents`.
|
47
|
+
def documents
|
48
|
+
@documents ||= @obj.documents
|
49
|
+
end
|
50
|
+
|
42
51
|
# `{{ site.related_posts }}` is how posts can get posts related to
|
43
52
|
# them, either through LSI if it's enabled, or through the most
|
44
53
|
# recent posts.
|
data/lib/jekyll/entry_filter.rb
CHANGED
@@ -31,9 +31,12 @@ module Jekyll
|
|
31
31
|
|
32
32
|
def filter(entries)
|
33
33
|
entries.reject do |e|
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
# Reject this entry if it is a symlink.
|
35
|
+
next true if symlink?(e)
|
36
|
+
# Do not reject this entry if it is included.
|
37
|
+
next false if included?(e)
|
38
|
+
# Reject this entry if it is special, a backup file, or excluded.
|
39
|
+
special?(e) || backup?(e) || excluded?(e)
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
data/lib/jekyll/excerpt.rb
CHANGED
@@ -128,36 +128,47 @@ module Jekyll
|
|
128
128
|
#
|
129
129
|
# Returns excerpt String
|
130
130
|
|
131
|
-
LIQUID_TAG_REGEX = %r!{%-?\s*(\w+)
|
131
|
+
LIQUID_TAG_REGEX = %r!{%-?\s*(\w+)\s*.*?-?%}!m
|
132
132
|
MKDWN_LINK_REF_REGEX = %r!^ {0,3}\[[^\]]+\]:.+$!
|
133
133
|
|
134
134
|
def extract_excerpt(doc_content)
|
135
135
|
head, _, tail = doc_content.to_s.partition(doc.excerpt_separator)
|
136
136
|
|
137
|
-
# append appropriate closing tag (
|
138
|
-
# partitioning resulted in leaving the closing tag somewhere
|
139
|
-
# partition.
|
140
|
-
if head.include?("{%")
|
141
|
-
head =~ LIQUID_TAG_REGEX
|
142
|
-
tag_name = Regexp.last_match(1)
|
137
|
+
# append appropriate closing tag(s) (for each Liquid block), to the `head`
|
138
|
+
# if the partitioning resulted in leaving the closing tag somewhere
|
139
|
+
# in the `tail` partition.
|
143
140
|
|
144
|
-
|
145
|
-
|
141
|
+
if head.include?("{%")
|
142
|
+
modified = false
|
143
|
+
tag_names = head.scan(LIQUID_TAG_REGEX)
|
144
|
+
tag_names.flatten!
|
145
|
+
tag_names.reverse_each do |tag_name|
|
146
|
+
next unless liquid_block?(tag_name)
|
147
|
+
next if head =~ endtag_regex_stash(tag_name)
|
148
|
+
|
149
|
+
modified = true
|
146
150
|
head << "\n{% end#{tag_name} %}"
|
147
151
|
end
|
152
|
+
print_build_warning if modified
|
148
153
|
end
|
149
154
|
|
150
|
-
if tail.empty?
|
151
|
-
|
152
|
-
|
153
|
-
head.to_s.dup << "\n\n" << tail.scan(MKDWN_LINK_REF_REGEX).join("\n")
|
154
|
-
end
|
155
|
+
return head if tail.empty?
|
156
|
+
|
157
|
+
head << "\n\n" << tail.scan(MKDWN_LINK_REF_REGEX).join("\n")
|
155
158
|
end
|
156
159
|
|
157
160
|
private
|
158
161
|
|
162
|
+
def endtag_regex_stash(tag_name)
|
163
|
+
@endtag_regex_stash ||= {}
|
164
|
+
@endtag_regex_stash[tag_name] ||= %r!{%-?\s*end#{tag_name}.*?\s*-?%}!m
|
165
|
+
end
|
166
|
+
|
159
167
|
def liquid_block?(tag_name)
|
160
|
-
|
168
|
+
return false unless tag_name.is_a?(String)
|
169
|
+
return false unless Liquid::Template.tags[tag_name]
|
170
|
+
|
171
|
+
Liquid::Template.tags[tag_name].ancestors.include?(Liquid::Block)
|
161
172
|
rescue NoMethodError
|
162
173
|
Jekyll.logger.error "Error:",
|
163
174
|
"A Liquid tag in the excerpt of #{doc.relative_path} couldn't be " \
|
@@ -167,12 +178,13 @@ module Jekyll
|
|
167
178
|
|
168
179
|
def print_build_warning
|
169
180
|
Jekyll.logger.warn "Warning:", "Excerpt modified in #{doc.relative_path}!"
|
170
|
-
Jekyll.logger.warn "",
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
181
|
+
Jekyll.logger.warn "", "Found a Liquid block containing the excerpt separator" \
|
182
|
+
" #{doc.excerpt_separator.inspect}. "
|
183
|
+
Jekyll.logger.warn "", "The block has been modified with the appropriate" \
|
184
|
+
" closing tag."
|
185
|
+
Jekyll.logger.warn "", "Feel free to define a custom excerpt or" \
|
186
|
+
" excerpt_separator in the document's front matter" \
|
187
|
+
" if the generated excerpt is unsatisfactory."
|
176
188
|
end
|
177
189
|
end
|
178
190
|
end
|
@@ -53,7 +53,9 @@ module Jekyll
|
|
53
53
|
private
|
54
54
|
|
55
55
|
def filename_regex
|
56
|
-
@filename_regex ||=
|
56
|
+
@filename_regex ||= begin
|
57
|
+
%r!\A(#{Regexp.escape(source_dir)}/|#{Regexp.escape(theme_dir.to_s)}/|/*)(.*)!i
|
58
|
+
end
|
57
59
|
end
|
58
60
|
|
59
61
|
def new_profile_hash
|