jekyll 3.7.0 → 3.7.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jekyll might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/.rubocop.yml +8 -0
- data/lib/jekyll/collection.rb +11 -6
- data/lib/jekyll/commands/help.rb +2 -2
- data/lib/jekyll/commands/new.rb +3 -0
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +3 -1
- data/lib/jekyll/converters/markdown/rdiscount_parser.rb +3 -1
- data/lib/jekyll/converters/markdown/redcarpet_parser.rb +6 -2
- data/lib/jekyll/converters/smartypants.rb +3 -1
- data/lib/jekyll/document.rb +9 -10
- data/lib/jekyll/frontmatter_defaults.rb +13 -7
- data/lib/jekyll/reader.rb +16 -0
- data/lib/jekyll/site.rb +10 -1
- data/lib/jekyll/static_file.rb +6 -1
- data/lib/jekyll/tags/include.rb +13 -3
- data/lib/jekyll/theme.rb +1 -1
- data/lib/jekyll/utils/rouge.rb +1 -1
- data/lib/jekyll/utils/win_tz.rb +1 -1
- data/lib/jekyll/version.rb +1 -1
- data/lib/theme_template/theme.gemspec.erb +5 -5
- data/rubocop/jekyll.rb +5 -0
- data/rubocop/jekyll/no_p_allowed.rb +23 -0
- data/rubocop/jekyll/no_puts_allowed.rb +23 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c29669117e5c63987bdce5016721d179f9d7cc0e
|
4
|
+
data.tar.gz: 4749002283952250c8e2c51e38b34598cd77dfcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6fad55711b6be2ad22def22a70e5b5b050e59aa196730446fdcdcbbe7780069da2ac910af369c28bc3a85ef9281f5337c1eccb9d50270a741531e1a58eb09ad
|
7
|
+
data.tar.gz: de5af54a0c8a33c89daa830b5d91c9c1609c7aa64abcf9e7e67481dfc19a2b0f79ac20b640f4b30c5cb121c5f4f2ceb077fe57519929043c86ae50f7d06db75a
|
data/.rubocop.yml
CHANGED
data/lib/jekyll/collection.rb
CHANGED
@@ -95,14 +95,13 @@ module Jekyll
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
# The directory for this Collection, relative to the site source
|
98
|
+
# The directory for this Collection, relative to the site source or the directory
|
99
|
+
# containing the collection.
|
99
100
|
#
|
100
101
|
# Returns a String containing the directory name where the collection
|
101
102
|
# is stored on the filesystem.
|
102
103
|
def relative_directory
|
103
|
-
@relative_directory ||=
|
104
|
-
Pathname.new(site.source)
|
105
|
-
).to_s
|
104
|
+
@relative_directory ||= "_#{label}"
|
106
105
|
end
|
107
106
|
|
108
107
|
# The full path to the directory containing the collection.
|
@@ -111,7 +110,7 @@ module Jekyll
|
|
111
110
|
# is stored on the filesystem.
|
112
111
|
def directory
|
113
112
|
@directory ||= site.in_source_dir(
|
114
|
-
File.join(
|
113
|
+
File.join(container, relative_directory)
|
115
114
|
)
|
116
115
|
end
|
117
116
|
|
@@ -125,7 +124,7 @@ module Jekyll
|
|
125
124
|
# is stored on the filesystem.
|
126
125
|
def collection_dir(*files)
|
127
126
|
return directory if files.empty?
|
128
|
-
site.in_source_dir(relative_directory, *files)
|
127
|
+
site.in_source_dir(container, relative_directory, *files)
|
129
128
|
end
|
130
129
|
|
131
130
|
# Checks whether the directory "exists" for this collection.
|
@@ -204,6 +203,12 @@ module Jekyll
|
|
204
203
|
|
205
204
|
private
|
206
205
|
|
206
|
+
def container
|
207
|
+
@container ||= site.config["collections_dir"]
|
208
|
+
end
|
209
|
+
|
210
|
+
private
|
211
|
+
|
207
212
|
def read_document(full_path)
|
208
213
|
doc = Jekyll::Document.new(full_path, :site => site, :collection => self)
|
209
214
|
doc.read
|
data/lib/jekyll/commands/help.rb
CHANGED
@@ -12,9 +12,9 @@ module Jekyll
|
|
12
12
|
c.action do |args, _|
|
13
13
|
cmd = (args.first || "").to_sym
|
14
14
|
if args.empty?
|
15
|
-
|
15
|
+
Jekyll.logger.info prog.to_s
|
16
16
|
elsif prog.has_command? cmd
|
17
|
-
|
17
|
+
Jekyll.logger.info prog.commands[cmd].to_s
|
18
18
|
else
|
19
19
|
invalid_command(prog, cmd)
|
20
20
|
abort
|
data/lib/jekyll/commands/new.rb
CHANGED
@@ -89,6 +89,9 @@ end
|
|
89
89
|
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
90
90
|
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
91
91
|
|
92
|
+
# Performance-booster for watching directories on Windows
|
93
|
+
gem "wdm", "~> 0.1.0" if Gem.win_platform?
|
94
|
+
|
92
95
|
RUBY
|
93
96
|
end
|
94
97
|
|
@@ -14,7 +14,9 @@ module Jekyll
|
|
14
14
|
}.freeze
|
15
15
|
|
16
16
|
def initialize(config)
|
17
|
-
|
17
|
+
unless defined?(Kramdown)
|
18
|
+
Jekyll::External.require_with_graceful_fail "kramdown"
|
19
|
+
end
|
18
20
|
@main_fallback_highlighter = config["highlighter"] || "rouge"
|
19
21
|
@config = config["kramdown"] || {}
|
20
22
|
@highlighter = nil
|
@@ -5,7 +5,9 @@ module Jekyll
|
|
5
5
|
class Markdown
|
6
6
|
class RDiscountParser
|
7
7
|
def initialize(config)
|
8
|
-
|
8
|
+
unless defined?(RDiscount)
|
9
|
+
Jekyll::External.require_with_graceful_fail "rdiscount"
|
10
|
+
end
|
9
11
|
@config = config
|
10
12
|
@rdiscount_extensions = @config["rdiscount"]["extensions"].map(&:to_sym)
|
11
13
|
end
|
@@ -16,7 +16,9 @@ class Jekyll::Converters::Markdown::RedcarpetParser
|
|
16
16
|
module WithPygments
|
17
17
|
include CommonMethods
|
18
18
|
def block_code(code, lang)
|
19
|
-
|
19
|
+
unless defined?(Pygments)
|
20
|
+
Jekyll::External.require_with_graceful_fail("pygments")
|
21
|
+
end
|
20
22
|
lang = lang && lang.split.first || "text"
|
21
23
|
add_code_tags(
|
22
24
|
Pygments.highlight(
|
@@ -60,7 +62,9 @@ class Jekyll::Converters::Markdown::RedcarpetParser
|
|
60
62
|
end
|
61
63
|
|
62
64
|
def initialize(config)
|
63
|
-
|
65
|
+
unless defined?(Redcarpet)
|
66
|
+
Jekyll::External.require_with_graceful_fail("redcarpet")
|
67
|
+
end
|
64
68
|
@config = config
|
65
69
|
@redcarpet_extensions = {}
|
66
70
|
@config["redcarpet"]["extensions"].each do |e|
|
@@ -20,7 +20,9 @@ module Jekyll
|
|
20
20
|
priority :low
|
21
21
|
|
22
22
|
def initialize(config)
|
23
|
-
|
23
|
+
unless defined?(Kramdown)
|
24
|
+
Jekyll::External.require_with_graceful_fail "kramdown"
|
25
|
+
end
|
24
26
|
@config = config["kramdown"].dup || {}
|
25
27
|
@config[:input] = :SmartyPants
|
26
28
|
end
|
data/lib/jekyll/document.rb
CHANGED
@@ -78,12 +78,13 @@ module Jekyll
|
|
78
78
|
collection.label == "posts"
|
79
79
|
end
|
80
80
|
|
81
|
-
# The path to the document, relative to the
|
81
|
+
# The path to the document, relative to the collections_dir.
|
82
82
|
#
|
83
|
-
# Returns a String path which represents the relative path
|
84
|
-
#
|
83
|
+
# Returns a String path which represents the relative path from the collections_dir
|
84
|
+
# to this document.
|
85
85
|
def relative_path
|
86
|
-
@relative_path ||=
|
86
|
+
@relative_path ||=
|
87
|
+
Pathutil.new(path).relative_path_from(site.collections_path).to_s
|
87
88
|
end
|
88
89
|
|
89
90
|
# The output extension of the document.
|
@@ -399,11 +400,9 @@ module Jekyll
|
|
399
400
|
def populate_categories
|
400
401
|
merge_data!({
|
401
402
|
"categories" => (
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
"categories"
|
406
|
-
)
|
403
|
+
Array(data["categories"]) + Utils.pluralized_array_from_hash(
|
404
|
+
data, "category", "categories"
|
405
|
+
)
|
407
406
|
).map(&:to_s).flatten.uniq,
|
408
407
|
})
|
409
408
|
end
|
@@ -426,7 +425,7 @@ module Jekyll
|
|
426
425
|
|
427
426
|
private
|
428
427
|
def merge_date!(source)
|
429
|
-
if data.key?("date")
|
428
|
+
if data.key?("date")
|
430
429
|
data["date"] = Utils.parse_date(
|
431
430
|
data["date"].to_s,
|
432
431
|
"Document '#{relative_path}' does not have a valid date in the #{source}."
|
@@ -97,21 +97,27 @@ module Jekyll
|
|
97
97
|
applies_path?(scope, path) && applies_type?(scope, type)
|
98
98
|
end
|
99
99
|
|
100
|
+
# rubocop:disable Metrics/AbcSize
|
100
101
|
def applies_path?(scope, path)
|
101
102
|
return true if !scope.key?("path") || scope["path"].empty?
|
102
103
|
|
103
104
|
sanitized_path = Pathname.new(sanitize_path(path))
|
104
|
-
|
105
|
-
site_path = Pathname.new(@site.source)
|
105
|
+
site_path = Pathname.new(@site.source)
|
106
106
|
rel_scope_path = Pathname.new(scope["path"])
|
107
107
|
abs_scope_path = File.join(@site.source, rel_scope_path)
|
108
|
-
Dir.glob(abs_scope_path).each do |scope_path|
|
109
|
-
scope_path = Pathname.new(scope_path).relative_path_from site_path
|
110
|
-
return true if path_is_subpath?(sanitized_path, scope_path)
|
111
|
-
end
|
112
108
|
|
113
|
-
|
109
|
+
if scope["path"].to_s.include?("*")
|
110
|
+
Dir.glob(abs_scope_path).each do |scope_path|
|
111
|
+
scope_path = Pathname.new(scope_path).relative_path_from site_path
|
112
|
+
Jekyll.logger.debug "Globbed Scope Path:", scope_path
|
113
|
+
return true if path_is_subpath?(sanitized_path, scope_path)
|
114
|
+
end
|
115
|
+
false
|
116
|
+
else
|
117
|
+
path_is_subpath?(sanitized_path, rel_scope_path)
|
118
|
+
end
|
114
119
|
end
|
120
|
+
# rubocop:enable Metrics/AbcSize
|
115
121
|
|
116
122
|
def path_is_subpath?(path, parent_path)
|
117
123
|
path.ascend do |ascended_path|
|
data/lib/jekyll/reader.rb
CHANGED
@@ -62,6 +62,7 @@ module Jekyll
|
|
62
62
|
#
|
63
63
|
# Returns nothing.
|
64
64
|
def retrieve_posts(dir)
|
65
|
+
return if outside_configured_directory?(dir)
|
65
66
|
site.posts.docs.concat(PostReader.new(site).read_posts(dir))
|
66
67
|
site.posts.docs.concat(PostReader.new(site).read_drafts(dir)) if site.show_drafts
|
67
68
|
end
|
@@ -130,5 +131,20 @@ module Jekyll
|
|
130
131
|
entries = Dir.chdir(base) { filter_entries(Dir["**/*"], base) }
|
131
132
|
entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }
|
132
133
|
end
|
134
|
+
|
135
|
+
private
|
136
|
+
|
137
|
+
# Internal
|
138
|
+
#
|
139
|
+
# Determine if the directory is supposed to contain posts and drafts.
|
140
|
+
# If the user has defined a custom collections_dir, then attempt to read
|
141
|
+
# posts and drafts only from within that directory.
|
142
|
+
#
|
143
|
+
# Returns true if a custom collections_dir has been set but current directory lies
|
144
|
+
# outside that directory.
|
145
|
+
def outside_configured_directory?(dir)
|
146
|
+
collections_dir = site.config["collections_dir"]
|
147
|
+
!collections_dir.empty? && !dir.start_with?("/#{collections_dir}")
|
148
|
+
end
|
133
149
|
end
|
134
150
|
end
|
data/lib/jekyll/site.rb
CHANGED
@@ -77,7 +77,7 @@ module Jekyll
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def print_stats
|
80
|
-
|
80
|
+
Jekyll.logger.info @liquid_renderer.stats_table
|
81
81
|
end
|
82
82
|
|
83
83
|
# Reset Site details.
|
@@ -391,6 +391,15 @@ module Jekyll
|
|
391
391
|
end
|
392
392
|
end
|
393
393
|
|
394
|
+
# Public: The full path to the directory that houses all the collections registered
|
395
|
+
# with the current site.
|
396
|
+
#
|
397
|
+
# Returns the source directory or the absolute path to the custom collections_dir
|
398
|
+
def collections_path
|
399
|
+
dir_str = config["collections_dir"]
|
400
|
+
@collections_path ||= dir_str.empty? ? source : in_source_dir(dir_str)
|
401
|
+
end
|
402
|
+
|
394
403
|
# Limits the current posts; removes the posts which exceed the limit_posts
|
395
404
|
#
|
396
405
|
# Returns nothing
|
data/lib/jekyll/static_file.rb
CHANGED
@@ -40,7 +40,12 @@ module Jekyll
|
|
40
40
|
|
41
41
|
# Returns source file path.
|
42
42
|
def path
|
43
|
-
|
43
|
+
# Static file is from a collection inside custom collections directory
|
44
|
+
if !@collection.nil? && !@site.config["collections_dir"].empty?
|
45
|
+
File.join(*[@base, @site.config["collections_dir"], @dir, @name].compact)
|
46
|
+
else
|
47
|
+
File.join(*[@base, @dir, @name].compact)
|
48
|
+
end
|
44
49
|
end
|
45
50
|
|
46
51
|
# Obtain destination path.
|
data/lib/jekyll/tags/include.rb
CHANGED
@@ -115,9 +115,7 @@ MSG
|
|
115
115
|
path = File.join(dir.to_s, file.to_s)
|
116
116
|
return path if valid_include_file?(path, dir.to_s, safe)
|
117
117
|
end
|
118
|
-
raise IOError,
|
119
|
-
"#{includes_dirs}. Ensure it exists in one of those directories and, "\
|
120
|
-
"if it is a symlink, does not point outside your site source."
|
118
|
+
raise IOError, could_not_locate_message(file, includes_dirs, safe)
|
121
119
|
end
|
122
120
|
|
123
121
|
def render(context)
|
@@ -192,6 +190,18 @@ MSG
|
|
192
190
|
def read_file(file, context)
|
193
191
|
File.read(file, file_read_opts(context))
|
194
192
|
end
|
193
|
+
|
194
|
+
private
|
195
|
+
|
196
|
+
def could_not_locate_message(file, includes_dirs, safe)
|
197
|
+
message = "Could not locate the included file '#{file}' in any of "\
|
198
|
+
"#{includes_dirs}. Ensure it exists in one of those directories and"
|
199
|
+
message + if safe
|
200
|
+
" is not a symlink as those are not allowed in safe mode."
|
201
|
+
else
|
202
|
+
", if it is a symlink, does not point outside your site source."
|
203
|
+
end
|
204
|
+
end
|
195
205
|
end
|
196
206
|
|
197
207
|
class IncludeRelativeTag < IncludeTag
|
data/lib/jekyll/theme.rb
CHANGED
data/lib/jekyll/utils/rouge.rb
CHANGED
data/lib/jekyll/utils/win_tz.rb
CHANGED
@@ -12,7 +12,7 @@ module Jekyll
|
|
12
12
|
#
|
13
13
|
# Returns a string that ultimately re-defines ENV["TZ"] in Windows
|
14
14
|
def calculate(timezone)
|
15
|
-
External.require_with_graceful_fail("tzinfo")
|
15
|
+
External.require_with_graceful_fail("tzinfo") unless defined?(TZInfo)
|
16
16
|
tz = TZInfo::Timezone.get(timezone)
|
17
17
|
difference = Time.now.to_i - tz.now.to_i
|
18
18
|
#
|
data/lib/jekyll/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = <%= theme_name.inspect %>
|
@@ -6,14 +6,14 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.authors = [<%= user_name.inspect %>]
|
7
7
|
spec.email = [<%= user_email.inspect %>]
|
8
8
|
|
9
|
-
spec.summary =
|
9
|
+
spec.summary = "TODO: Write a short summary, because Rubygems requires one."
|
10
10
|
spec.homepage = "TODO: Put your gem's website or public repo URL here."
|
11
11
|
spec.license = "MIT"
|
12
12
|
|
13
|
-
spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r
|
13
|
+
spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r!^(<%= theme_directories.join("|") %>|LICENSE|README)!i) }
|
14
14
|
|
15
15
|
spec.add_runtime_dependency "jekyll", "~> <%= jekyll_version_with_minor %>"
|
16
16
|
|
17
|
-
spec.add_development_dependency "bundler", "~> 1.
|
18
|
-
spec.add_development_dependency "rake", "~>
|
17
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
18
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
19
19
|
end
|
data/rubocop/jekyll.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubocop"
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Cop
|
7
|
+
module Jekyll
|
8
|
+
class NoPAllowed < Cop
|
9
|
+
MSG = "Avoid using `p` to print things. Use `Jekyll.logger` instead.".freeze
|
10
|
+
|
11
|
+
def_node_search :p_called?, <<-PATTERN
|
12
|
+
(send _ :p _)
|
13
|
+
PATTERN
|
14
|
+
|
15
|
+
def on_send(node)
|
16
|
+
if p_called?(node)
|
17
|
+
add_offense(node, :location => :selector)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubocop"
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Cop
|
7
|
+
module Jekyll
|
8
|
+
class NoPutsAllowed < Cop
|
9
|
+
MSG = "Avoid using `puts` to print things. Use `Jekyll.logger` instead.".freeze
|
10
|
+
|
11
|
+
def_node_search :puts_called?, <<-PATTERN
|
12
|
+
(send nil? :puts _)
|
13
|
+
PATTERN
|
14
|
+
|
15
|
+
def on_send(node)
|
16
|
+
if puts_called?(node)
|
17
|
+
add_offense(node, :location => :selector)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.7.
|
4
|
+
version: 3.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Preston-Werner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -303,6 +303,9 @@ files:
|
|
303
303
|
- lib/theme_template/example/style.scss
|
304
304
|
- lib/theme_template/gitignore.erb
|
305
305
|
- lib/theme_template/theme.gemspec.erb
|
306
|
+
- rubocop/jekyll.rb
|
307
|
+
- rubocop/jekyll/no_p_allowed.rb
|
308
|
+
- rubocop/jekyll/no_puts_allowed.rb
|
306
309
|
homepage: https://github.com/jekyll/jekyll
|
307
310
|
licenses:
|
308
311
|
- MIT
|
@@ -324,7 +327,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
324
327
|
version: '0'
|
325
328
|
requirements: []
|
326
329
|
rubyforge_project:
|
327
|
-
rubygems_version: 2.
|
330
|
+
rubygems_version: 2.6.13
|
328
331
|
signing_key:
|
329
332
|
specification_version: 2
|
330
333
|
summary: A simple, blog aware, static site generator.
|