jekyll 3.8.3 → 3.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c71d2ab96becf45cf452ef5d75a3bda56f748cf1
4
- data.tar.gz: e85756fdfebef019f13b142f3651aee2b726168f
2
+ SHA256:
3
+ metadata.gz: 7f4e46968c9e837f386ed0270702c2cb5213f98c9a640d8e05c02c7334cddf8c
4
+ data.tar.gz: e17ea3832fb902e2a9381552faefc058008f6b4d5a1c9c7ac5db106a998f2c41
5
5
  SHA512:
6
- metadata.gz: 3c508885c5de7efc01f089b4b522e2b69e9e8c2d12d557c4d73308fcb92a15d66c49267bb6b2d4af97b44ccd7e77dfbb8295c5925fbad5d70e22090db2f220da
7
- data.tar.gz: 7f2b541eef16a03084917a0a311c5fe703c089f41c8b9ec4b432d04e45c612dd5d45ad7ab411bee0f5d2845519f591d838f7a4063a2c8691f9515bd8e1b77650
6
+ metadata.gz: 73ce537acd31edb94a7a80d496d60578d9e4e5887de5b4200c17c8470819066216db8934bae7e2f83648f557da45d78763d34bc59a3be859d96b16a14983a509
7
+ data.tar.gz: 6163c4524ac843e8eb5bc4bcd0725ff3fcf43495888a9ea91afc16d5686d309b524081c4b28b74c7ff5319ba06c8f1c70a4dd94b48ab978b08a0923cac773dd9
@@ -53,6 +53,8 @@ Layout/EmptyComment:
53
53
  Enabled: false
54
54
  Layout/EndAlignment:
55
55
  Severity: error
56
+ Lint/SplatKeywordArguments:
57
+ Enabled: false
56
58
  Lint/UnreachableCode:
57
59
  Severity: error
58
60
  Lint/UselessAccessModifier:
@@ -88,10 +88,18 @@ group :jekyll_plugins do
88
88
  end
89
89
 
90
90
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
91
- gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
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" if Gem.win_platform?
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
 
96
104
  RUBY
97
105
  end
@@ -81,6 +81,7 @@ module Jekyll
81
81
  "smart_quotes" => "lsquo,rsquo,ldquo,rdquo",
82
82
  "input" => "GFM",
83
83
  "hard_wrap" => false,
84
+ "guess_lang" => true,
84
85
  "footnote_nr" => 1,
85
86
  "show_warnings" => false,
86
87
  },
@@ -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]
@@ -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))
@@ -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, :documents,
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.
@@ -31,9 +31,12 @@ module Jekyll
31
31
 
32
32
  def filter(entries)
33
33
  entries.reject do |e|
34
- unless included?(e)
35
- special?(e) || backup?(e) || excluded?(e) || symlink?(e)
36
- end
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
 
@@ -128,36 +128,47 @@ module Jekyll
128
128
  #
129
129
  # Returns excerpt String
130
130
 
131
- LIQUID_TAG_REGEX = %r!{%-?\s*(\w+).+\s*-?%}!m
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 (to a Liquid block), to the "head" if the
138
- # partitioning resulted in leaving the closing tag somewhere in the "tail"
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
- if liquid_block?(tag_name) && head.match(%r!{%-?\s*end#{tag_name}\s*-?%}!).nil?
145
- print_build_warning
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
- head
152
- else
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
- Liquid::Template.tags[tag_name].superclass == Liquid::Block
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
- "Found a Liquid block containing separator '#{doc.excerpt_separator}' and has " \
172
- "been modified with the appropriate closing tag."
173
- Jekyll.logger.warn "",
174
- "Feel free to define a custom excerpt or excerpt_separator in the document's " \
175
- "Front Matter if the generated excerpt is unsatisfactory."
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 ||= %r!\A(#{source_dir}/|#{theme_dir}/|\W*)(.*)!i
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
@@ -314,15 +314,15 @@ module Jekyll
314
314
  #
315
315
  # Returns an Array of Documents which should be written
316
316
  def docs_to_write
317
- @docs_to_write ||= documents.select(&:write?)
317
+ documents.select(&:write?)
318
318
  end
319
319
 
320
320
  # Get all the documents
321
321
  #
322
322
  # Returns an Array of all Documents
323
323
  def documents
324
- collections.reduce(Set.new) do |docs, (_, collection)|
325
- docs + collection.docs + collection.files
324
+ collections.each_with_object(Set.new) do |(_, collection), set|
325
+ set.merge(collection.docs).merge(collection.files)
326
326
  end.to_a
327
327
  end
328
328
 
@@ -191,7 +191,7 @@ MSG
191
191
 
192
192
  # This method allows to modify the file content by inheriting from the class.
193
193
  def read_file(file, context)
194
- File.read(file, file_read_opts(context))
194
+ File.read(file, **file_read_opts(context))
195
195
  end
196
196
 
197
197
  private
@@ -224,6 +224,7 @@ MSG
224
224
  else
225
225
  File.join(site.config["collections_dir"], page_payload["path"])
226
226
  end
227
+ resource_path.sub!(%r!/#excerpt\z!, "")
227
228
  site.in_source_dir File.dirname(resource_path)
228
229
  end
229
230
  end
@@ -56,12 +56,28 @@ module Jekyll
56
56
  end
57
57
 
58
58
  def realpath_for(folder)
59
- File.realpath(Jekyll.sanitized_path(root, folder.to_s))
60
- rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP
61
- Jekyll.logger.warn "Invalid theme folder:", folder
59
+ # This resolves all symlinks for the theme subfolder and then ensures
60
+ # that the directory remains inside the theme root. This prevents the
61
+ # use of symlinks for theme subfolders to escape the theme root.
62
+ # However, symlinks are allowed to point to other directories within the theme.
63
+ Jekyll.sanitized_path(root, File.realpath(Jekyll.sanitized_path(root, folder.to_s)))
64
+ rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP => e
65
+ log_realpath_exception(e, folder)
62
66
  nil
63
67
  end
64
68
 
69
+ def log_realpath_exception(err, folder)
70
+ return if err.is_a?(Errno::ENOENT)
71
+
72
+ case err
73
+ when Errno::EACCES
74
+ Jekyll.logger.error "Theme error:", "Directory '#{folder}' is not accessible."
75
+ when Errno::ELOOP
76
+ Jekyll.logger.error "Theme error:",
77
+ "Directory '#{folder}' includes a symbolic link loop."
78
+ end
79
+ end
80
+
65
81
  def gemspec
66
82
  @gemspec ||= Gem::Specification.find_by_name(name)
67
83
  rescue Gem::LoadError
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jekyll
4
- VERSION = "3.8.3".freeze
4
+ VERSION = "3.9.0".freeze
5
5
  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.8.3
4
+ version: 3.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-05 00:00:00.000000000 Z
11
+ date: 2020-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '2.0'
97
- - !ruby/object:Gem::Dependency
98
- name: kramdown
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '1.14'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '1.14'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: liquid
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -184,6 +170,26 @@ dependencies:
184
170
  - - "~>"
185
171
  - !ruby/object:Gem::Version
186
172
  version: '1.0'
173
+ - !ruby/object:Gem::Dependency
174
+ name: kramdown
175
+ requirement: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '1.17'
180
+ - - "<"
181
+ - !ruby/object:Gem::Version
182
+ version: '3'
183
+ type: :runtime
184
+ prerelease: false
185
+ version_requirements: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '1.17'
190
+ - - "<"
191
+ - !ruby/object:Gem::Version
192
+ version: '3'
187
193
  description: Jekyll is a simple, blog aware, static site generator.
188
194
  email: tom@mojombo.com
189
195
  executables:
@@ -311,7 +317,7 @@ homepage: https://github.com/jekyll/jekyll
311
317
  licenses:
312
318
  - MIT
313
319
  metadata: {}
314
- post_install_message:
320
+ post_install_message:
315
321
  rdoc_options:
316
322
  - "--charset=UTF-8"
317
323
  require_paths:
@@ -327,9 +333,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
327
333
  - !ruby/object:Gem::Version
328
334
  version: '0'
329
335
  requirements: []
330
- rubyforge_project:
331
- rubygems_version: 2.6.14
332
- signing_key:
336
+ rubygems_version: 3.0.3
337
+ signing_key:
333
338
  specification_version: 2
334
339
  summary: A simple, blog aware, static site generator.
335
340
  test_files: []