jekyll 3.8.0.pre.rc1 → 3.8.0.pre.rc2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d8b3cb33faecac197557dfc43ba3a5e6b24053ecc42c9bb9ea3a733553f7eb4
4
- data.tar.gz: 3af6b03a6c04a694adac3507d1e82048046d791ce6254d1b827fccea97db4367
3
+ metadata.gz: 11fddf298655ecad13b88d1e7a5fdd6ee54a8379c8724ad17a5d07dcb895a304
4
+ data.tar.gz: 2aa7a239d6bb42e3975e495ee074c999b85d7f6e0e652b349bbd3bc213df973b
5
5
  SHA512:
6
- metadata.gz: 6d2dbd4a413268950af60bb1cb3219bb48a6fcdaefdc76e0035e97fb20852759d6d293b0b1a10bb39ab40e8527befaec5f63d028f01056fabf6c88fe9e4e99a4
7
- data.tar.gz: dc435a723327de90ff63432a53db4fca2f11e2240c1f661fc66f6871610f737aa9eb2947a7434dbddd148443afb69e01c17044104bf9a185ddbdff4697b41fec
6
+ metadata.gz: 676bce947226ac467d5d036b181b3f652d4867098a0f3b62ee1405fa737c727c0fc9038dcce3c894ff805a7ca115374a1b1545f662a889cf64c35eda93d3cac2
7
+ data.tar.gz: 3322935bfadd96623322592f1c4aeefcdf56dcb4932f02278c90a822370726364fd80e0262f13d4b5e09e49853eca30d61a777e332a32bd612a2e496ff6ea6c9
@@ -46,8 +46,13 @@ Layout/MultilineMethodCallIndentation:
46
46
  EnforcedStyle: indented
47
47
  Layout/MultilineOperationIndentation:
48
48
  EnforcedStyle: indented
49
+ Lint/NestedPercentLiteral:
50
+ Exclude:
51
+ - test/test_site.rb
49
52
  Layout/SpaceInsideBrackets:
50
53
  Enabled: false
54
+ Layout/EmptyComment:
55
+ Enabled: false
51
56
  Lint/EndAlignment:
52
57
  Severity: error
53
58
  Lint/UnreachableCode:
@@ -94,6 +99,14 @@ Naming/FileName:
94
99
  Enabled: false
95
100
  Naming/HeredocDelimiterNaming:
96
101
  Enabled: false
102
+ Naming/MemoizedInstanceVariableName:
103
+ Exclude:
104
+ - lib/jekyll/page_without_a_file.rb
105
+ - lib/jekyll/drops/unified_payload_drop.rb
106
+ - lib/jekyll/drops/site_drop.rb
107
+ Naming/UncommunicativeMethodParamName:
108
+ AllowedNames:
109
+ - _
97
110
  Security/MarshalLoad:
98
111
  Exclude:
99
112
  - !ruby/regexp /test\/.*.rb$/
@@ -118,6 +131,9 @@ Style/Documentation:
118
131
  - !ruby/regexp /features\/.*.rb$/
119
132
  Style/DoubleNegation:
120
133
  Enabled: false
134
+ Style/FormatStringToken:
135
+ Exclude:
136
+ - lib/jekyll/utils/ansi.rb
121
137
  Style/GuardClause:
122
138
  Enabled: false
123
139
  Style/HashSyntax:
@@ -127,6 +143,9 @@ Style/IfUnlessModifier:
127
143
  Enabled: false
128
144
  Style/InverseMethods:
129
145
  Enabled: false
146
+ Style/MixinUsage:
147
+ Exclude:
148
+ - test/helper.rb
130
149
  Style/ModuleFunction:
131
150
  Enabled: false
132
151
  Style/MultilineTernaryOperator:
@@ -158,5 +177,7 @@ Style/StringLiteralsInInterpolation:
158
177
  EnforcedStyle: double_quotes
159
178
  Style/SymbolArray:
160
179
  Enabled: false
161
- Style/TrailingCommaInLiteral:
180
+ Style/TrailingCommaInArrayLiteral:
181
+ EnforcedStyleForMultiline: consistent_comma
182
+ Style/TrailingCommaInHashLiteral:
162
183
  EnforcedStyleForMultiline: consistent_comma
@@ -18,7 +18,6 @@ end
18
18
  require "rubygems"
19
19
 
20
20
  # stdlib
21
- require "pathutil"
22
21
  require "forwardable"
23
22
  require "fileutils"
24
23
  require "time"
@@ -26,8 +25,12 @@ require "English"
26
25
  require "pathname"
27
26
  require "logger"
28
27
  require "set"
28
+ require "csv"
29
+ require "json"
29
30
 
30
31
  # 3rd party
32
+ require "pathutil"
33
+ require "addressable/uri"
31
34
  require "safe_yaml/load"
32
35
  require "liquid"
33
36
  require "kramdown"
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
-
5
3
  module Jekyll
6
4
  # Handles the cleanup of a site's destination before it is built.
7
5
  class Cleaner
@@ -45,31 +45,31 @@ module Jekyll
45
45
 
46
46
  # Add common options to a command for building configuration
47
47
  #
48
- # c - the Jekyll::Command to add these options to
48
+ # cmd - the Jekyll::Command to add these options to
49
49
  #
50
50
  # Returns nothing
51
51
  # rubocop:disable Metrics/MethodLength
52
- def add_build_options(c)
53
- c.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]",
52
+ def add_build_options(cmd)
53
+ cmd.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]",
54
54
  Array, "Custom configuration file"
55
- c.option "destination", "-d", "--destination DESTINATION",
55
+ cmd.option "destination", "-d", "--destination DESTINATION",
56
56
  "The current folder will be generated into DESTINATION"
57
- c.option "source", "-s", "--source SOURCE", "Custom source directory"
58
- c.option "future", "--future", "Publishes posts with a future date"
59
- c.option "limit_posts", "--limit_posts MAX_POSTS", Integer,
57
+ cmd.option "source", "-s", "--source SOURCE", "Custom source directory"
58
+ cmd.option "future", "--future", "Publishes posts with a future date"
59
+ cmd.option "limit_posts", "--limit_posts MAX_POSTS", Integer,
60
60
  "Limits the number of posts to parse and publish"
61
- c.option "watch", "-w", "--[no-]watch", "Watch for changes and rebuild"
62
- c.option "baseurl", "-b", "--baseurl URL",
61
+ cmd.option "watch", "-w", "--[no-]watch", "Watch for changes and rebuild"
62
+ cmd.option "baseurl", "-b", "--baseurl URL",
63
63
  "Serve the website from the given base URL"
64
- c.option "force_polling", "--force_polling", "Force watch to use polling"
65
- c.option "lsi", "--lsi", "Use LSI for improved related posts"
66
- c.option "show_drafts", "-D", "--drafts", "Render posts in the _drafts folder"
67
- c.option "unpublished", "--unpublished",
64
+ cmd.option "force_polling", "--force_polling", "Force watch to use polling"
65
+ cmd.option "lsi", "--lsi", "Use LSI for improved related posts"
66
+ cmd.option "show_drafts", "-D", "--drafts", "Render posts in the _drafts folder"
67
+ cmd.option "unpublished", "--unpublished",
68
68
  "Render posts that were marked as unpublished"
69
- c.option "quiet", "-q", "--quiet", "Silence output."
70
- c.option "verbose", "-V", "--verbose", "Print verbose output."
71
- c.option "incremental", "-I", "--incremental", "Enable incremental rebuild."
72
- c.option "strict_front_matter", "--strict_front_matter",
69
+ cmd.option "quiet", "-q", "--quiet", "Silence output."
70
+ cmd.option "verbose", "-V", "--verbose", "Print verbose output."
71
+ cmd.option "incremental", "-I", "--incremental", "Enable incremental rebuild."
72
+ cmd.option "strict_front_matter", "--strict_front_matter",
73
73
  "Fail if errors are present in front matter"
74
74
  end
75
75
  # rubocop:enable Metrics/MethodLength
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "addressable/uri"
4
-
5
3
  module Jekyll
6
4
  module Commands
7
5
  class Doctor < Command
@@ -70,7 +70,7 @@ module Jekyll
70
70
  cmd.action do |_, opts|
71
71
  opts["livereload_port"] ||= LIVERELOAD_PORT
72
72
  opts["serving"] = true
73
- opts["watch" ] = true unless opts.key?("watch")
73
+ opts["watch"] = true unless opts.key?("watch")
74
74
 
75
75
  start(opts)
76
76
  end
@@ -173,6 +173,7 @@ module Jekyll
173
173
  @changed_pages = nil
174
174
  end
175
175
  end
176
+ # rubocop:enable Metrics/AbcSize
176
177
 
177
178
  # Do a base pre-setup of WEBRick so that everything is in place
178
179
  # when we get ready to party, checking for an setting up an error page
@@ -336,7 +337,7 @@ module Jekyll
336
337
  require "webrick/https"
337
338
 
338
339
  opts[:SSLCertificate] = OpenSSL::X509::Certificate.new(read_file(src, cert))
339
- opts[:SSLPrivateKey ] = OpenSSL::PKey::RSA.new(read_file(src, key))
340
+ opts[:SSLPrivateKey] = OpenSSL::PKey::RSA.new(read_file(src, key))
340
341
  opts[:SSLEnable] = true
341
342
  end
342
343
 
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "json"
4
3
  require "em-websocket"
5
4
 
6
5
  require_relative "websockets"
@@ -31,11 +30,11 @@ module Jekyll
31
30
  EM.reactor_running?
32
31
  end
33
32
 
34
- def handle_websockets_event(ws)
35
- ws.onopen { |handshake| connect(ws, handshake) }
36
- ws.onclose { disconnect(ws) }
37
- ws.onmessage { |msg| print_message(msg) }
38
- ws.onerror { |error| log_error(error) }
33
+ def handle_websockets_event(websocket)
34
+ websocket.onopen { |handshake| connect(websocket, handshake) }
35
+ websocket.onclose { disconnect(websocket) }
36
+ websocket.onmessage { |msg| print_message(msg) }
37
+ websocket.onerror { |error| log_error(error) }
39
38
  end
40
39
 
41
40
  def start(opts)
@@ -82,14 +81,14 @@ module Jekyll
82
81
  end
83
82
 
84
83
  private
85
- def connect(ws, handshake)
84
+ def connect(websocket, handshake)
86
85
  @connections_count += 1
87
86
  if @connections_count == 1
88
87
  message = "Browser connected"
89
88
  message += " over SSL/TLS" if handshake.secure?
90
89
  Jekyll.logger.info "LiveReload:", message
91
90
  end
92
- ws.send(
91
+ websocket.send(
93
92
  JSON.dump(
94
93
  :command => "hello",
95
94
  :protocols => ["http://livereload.com/protocols/official-7"],
@@ -97,12 +96,12 @@ module Jekyll
97
96
  )
98
97
  )
99
98
 
100
- @websockets << ws
99
+ @websockets << websocket
101
100
  end
102
101
 
103
102
  private
104
- def disconnect(ws)
105
- @websockets.delete(ws)
103
+ def disconnect(websocket)
104
+ @websockets.delete(websocket)
106
105
  end
107
106
 
108
107
  private
@@ -116,10 +115,10 @@ module Jekyll
116
115
  end
117
116
 
118
117
  private
119
- def log_error(e)
118
+ def log_error(error)
120
119
  Jekyll.logger.error "LiveReload experienced an error. " \
121
120
  "Run with --trace for more information."
122
- raise e
121
+ raise error
123
122
  end
124
123
  end
125
124
  end
@@ -88,6 +88,7 @@ module Jekyll
88
88
  end
89
89
  @new_body = @new_body.join
90
90
  end
91
+ # rubocop:enable Metrics/MethodLength
91
92
 
92
93
  def template
93
94
  # Unclear what "snipver" does. Doc at
@@ -175,6 +176,7 @@ module Jekyll
175
176
  res.header.merge!(@headers)
176
177
  rtn
177
178
  end
179
+ # rubocop:enable Naming/MethodName
178
180
 
179
181
  #
180
182
 
@@ -74,6 +74,7 @@ module Jekyll
74
74
  close_connection_after_writing
75
75
  end
76
76
  end
77
+ # rubocop:enable Metrics/MethodLength
77
78
  end
78
79
  end
79
80
  end
@@ -14,9 +14,6 @@ module Jekyll
14
14
  }.freeze
15
15
 
16
16
  def initialize(config)
17
- unless defined?(Kramdown)
18
- Jekyll::External.require_with_graceful_fail "kramdown"
19
- end
20
17
  @main_fallback_highlighter = config["highlighter"] || "rouge"
21
18
  @config = config["kramdown"] || {}
22
19
  @highlighter = nil
@@ -50,14 +47,12 @@ module Jekyll
50
47
  end
51
48
 
52
49
  private
53
- # rubocop:disable Performance/HashEachMethods
54
50
  def make_accessible(hash = @config)
55
51
  hash.keys.each do |key|
56
52
  hash[key.to_sym] = hash[key]
57
53
  make_accessible(hash[key]) if hash[key].is_a?(Hash)
58
54
  end
59
55
  end
60
- # rubocop:enable Performance/HashEachMethods
61
56
 
62
57
  # config[kramdown][syntax_higlighter] >
63
58
  # config[kramdown][enable_coderay] >
@@ -22,9 +22,9 @@ module Jekyll
22
22
  end
23
23
 
24
24
  private
25
- def replace_generated_toc(rd, html, toc_token)
26
- if rd.generate_toc && html.include?(toc_token)
27
- utf8_toc = rd.toc_content
25
+ def replace_generated_toc(rd_instance, html, toc_token)
26
+ if rd_instance.generate_toc && html.include?(toc_token)
27
+ utf8_toc = rd_instance.toc_content
28
28
  utf8_toc.force_encoding("utf-8") if utf8_toc.respond_to?(:force_encoding)
29
29
  html.gsub(toc_token, utf8_toc)
30
30
  else
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
-
5
3
  # Convertible provides methods for converting a pagelike item
6
4
  # from a certain type of markup into actual content
7
5
  #
@@ -109,7 +107,6 @@ module Jekyll
109
107
  def render_liquid(content, payload, info, path)
110
108
  _renderer.render_liquid(content, payload, info, path)
111
109
  end
112
- # rubocop: enable RescueException
113
110
 
114
111
  # Convert this Convertible's data to a Hash suitable for use by Liquid.
115
112
  #
@@ -137,7 +137,6 @@ module Jekyll
137
137
  #
138
138
  # Returns a pretty generation of the hash representation of the Drop.
139
139
  def inspect
140
- require "json"
141
140
  JSON.pretty_generate to_h
142
141
  end
143
142
 
@@ -155,7 +154,6 @@ module Jekyll
155
154
  #
156
155
  # Returns a JSON representation of the Drop in a String.
157
156
  def to_json(state = nil)
158
- require "json"
159
157
  JSON.generate(hash_for_json(state), state)
160
158
  end
161
159
 
@@ -25,7 +25,6 @@ module Jekyll
25
25
  end
26
26
 
27
27
  def to_json(state = nil)
28
- require "json"
29
28
  JSON.generate(to_h, state)
30
29
  end
31
30
  end
@@ -86,8 +86,8 @@ module Jekyll
86
86
  # Check if an entry matches a specific pattern and return true,false.
87
87
  # Returns true if path matches against any glob pattern.
88
88
  # --
89
- def glob_include?(enum, e)
90
- entry = Pathutil.new(site.in_source_dir).join(e)
89
+ def glob_include?(enum, entry)
90
+ entry_path = Pathutil.new(site.in_source_dir).join(entry)
91
91
  enum.any? do |exp|
92
92
  # Users who send a Regexp knows what they want to
93
93
  # exclude, so let them send a Regexp to exclude files,
@@ -95,7 +95,7 @@ module Jekyll
95
95
  # on them at this point.
96
96
 
97
97
  if exp.is_a?(Regexp)
98
- entry =~ exp
98
+ entry_path =~ exp
99
99
 
100
100
  else
101
101
  item = Pathutil.new(site.in_source_dir).join(exp)
@@ -105,14 +105,14 @@ module Jekyll
105
105
  # see if the entry falls within that path and
106
106
  # exclude it if that's the case.
107
107
 
108
- if e.end_with?("/")
109
- entry.in_path?(
108
+ if entry.end_with?("/")
109
+ entry_path.in_path?(
110
110
  item
111
111
  )
112
112
 
113
113
  else
114
- File.fnmatch?(item, entry) ||
115
- entry.to_path.start_with?(
114
+ File.fnmatch?(item, entry_path) ||
115
+ entry_path.to_path.start_with?(
116
116
  item
117
117
  )
118
118
  end
@@ -120,6 +120,10 @@ module Jekyll
120
120
  # Excerpts are rendered same time as content is rendered.
121
121
  #
122
122
  # Returns excerpt String
123
+
124
+ LIQUID_TAG_REGEX = %r!{%\s*(\w+).+\s*%}!m
125
+ MKDWN_LINK_REF_REGEX = %r!^ {0,3}\[[^\]]+\]:.+$!
126
+
123
127
  def extract_excerpt(doc_content)
124
128
  head, _, tail = doc_content.to_s.partition(doc.excerpt_separator)
125
129
 
@@ -127,7 +131,7 @@ module Jekyll
127
131
  # partitioning resulted in leaving the closing tag somewhere in the "tail"
128
132
  # partition.
129
133
  if head.include?("{%")
130
- head =~ %r!{%\s*(\w+).+\s*%}!
134
+ head =~ LIQUID_TAG_REGEX
131
135
  tag_name = Regexp.last_match(1)
132
136
 
133
137
  if liquid_block?(tag_name) && head.match(%r!{%\s*end#{tag_name}\s*%}!).nil?
@@ -139,7 +143,7 @@ module Jekyll
139
143
  if tail.empty?
140
144
  head
141
145
  else
142
- head.to_s.dup << "\n\n" << tail.scan(%r!^ {0,3}\[[^\]]+\]:.+$!).join("\n")
146
+ head.to_s.dup << "\n\n" << tail.scan(MKDWN_LINK_REF_REGEX).join("\n")
143
147
  end
144
148
  end
145
149
 
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "addressable/uri"
4
- require "json"
5
- require "liquid"
6
-
7
3
  require_all "jekyll/filters"
8
4
 
9
5
  module Jekyll
@@ -18,9 +14,9 @@ module Jekyll
18
14
  #
19
15
  # Returns the HTML formatted String.
20
16
  def markdownify(input)
21
- site = @context.registers[:site]
22
- converter = site.find_converter_instance(Jekyll::Converters::Markdown)
23
- converter.convert(input.to_s)
17
+ @context.registers[:site].find_converter_instance(
18
+ Jekyll::Converters::Markdown
19
+ ).convert(input.to_s)
24
20
  end
25
21
 
26
22
  # Convert quotes into smart quotes.
@@ -29,9 +25,9 @@ module Jekyll
29
25
  #
30
26
  # Returns the smart-quotified String.
31
27
  def smartify(input)
32
- site = @context.registers[:site]
33
- converter = site.find_converter_instance(Jekyll::Converters::SmartyPants)
34
- converter.convert(input.to_s)
28
+ @context.registers[:site].find_converter_instance(
29
+ Jekyll::Converters::SmartyPants
30
+ ).convert(input.to_s)
35
31
  end
36
32
 
37
33
  # Convert a Sass string into CSS output.
@@ -40,9 +36,9 @@ module Jekyll
40
36
  #
41
37
  # Returns the CSS formatted String.
42
38
  def sassify(input)
43
- site = @context.registers[:site]
44
- converter = site.find_converter_instance(Jekyll::Converters::Sass)
45
- converter.convert(input)
39
+ @context.registers[:site].find_converter_instance(
40
+ Jekyll::Converters::Sass
41
+ ).convert(input)
46
42
  end
47
43
 
48
44
  # Convert a Scss string into CSS output.
@@ -51,9 +47,9 @@ module Jekyll
51
47
  #
52
48
  # Returns the CSS formatted String.
53
49
  def scssify(input)
54
- site = @context.registers[:site]
55
- converter = site.find_converter_instance(Jekyll::Converters::Scss)
56
- converter.convert(input)
50
+ @context.registers[:site].find_converter_instance(
51
+ Jekyll::Converters::Scss
52
+ ).convert(input)
57
53
  end
58
54
 
59
55
  # Slugify a filename or title.
@@ -171,11 +167,23 @@ module Jekyll
171
167
  #
172
168
  # Returns the filtered array of objects
173
169
  def where(input, property, value)
170
+ return input if property.nil? || value.nil?
174
171
  return input unless input.respond_to?(:select)
175
- input = input.values if input.is_a?(Hash)
176
- input.select do |object|
177
- Array(item_property(object, property)).map!(&:to_s).include?(value.to_s)
178
- end || []
172
+ input = input.values if input.is_a?(Hash)
173
+ input_id = input.hash
174
+
175
+ # implement a hash based on method parameters to cache the end-result
176
+ # for given parameters.
177
+ @where_filter_cache ||= {}
178
+ @where_filter_cache[input_id] ||= {}
179
+ @where_filter_cache[input_id][property] ||= {}
180
+
181
+ # stash or retrive results to return
182
+ @where_filter_cache[input_id][property][value] ||= begin
183
+ input.select do |object|
184
+ Array(item_property(object, property)).map!(&:to_s).include?(value.to_s)
185
+ end || []
186
+ end
179
187
  end
180
188
 
181
189
  # Filters an array of objects against an expression
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "addressable/uri"
4
-
5
3
  module Jekyll
6
4
  module Filters
7
5
  module URLFilters
@@ -207,11 +207,14 @@ module Jekyll
207
207
  end
208
208
 
209
209
  # Sanitizes the given path by removing a leading and adding a trailing slash
210
+
211
+ SANITIZATION_REGEX = %r!\A/|(?<=[^/])\z!
212
+
210
213
  def sanitize_path(path)
211
214
  if path.nil? || path.empty?
212
215
  ""
213
216
  else
214
- path.gsub(%r!\A/|(?<=[^/])\z!, "".freeze)
217
+ path.gsub(SANITIZATION_REGEX, "")
215
218
  end
216
219
  end
217
220
  end
@@ -7,8 +7,8 @@ module Jekyll
7
7
  class LiquidRenderer
8
8
  extend Forwardable
9
9
 
10
- def_delegator :@site, :in_source_dir, :source_dir
11
- def_delegator :@site, :in_theme_dir, :theme_dir
10
+ private def_delegator :@site, :in_source_dir, :source_dir
11
+ private def_delegator :@site, :in_theme_dir, :theme_dir
12
12
 
13
13
  def initialize(site)
14
14
  @site = site
@@ -24,7 +24,7 @@ module Jekyll
24
24
  filename.match(filename_regex)
25
25
  filename =
26
26
  if Regexp.last_match(1) == theme_dir("")
27
- ::File.join(Regexp.last_match(1).split("/")[-1], Regexp.last_match(2))
27
+ ::File.join(::File.basename(Regexp.last_match(1)), Regexp.last_match(2))
28
28
  else
29
29
  Regexp.last_match(2)
30
30
  end
@@ -42,18 +42,18 @@ module Jekyll
42
42
  @stats[filename][:time] += time
43
43
  end
44
44
 
45
- def stats_table(n = 50)
46
- LiquidRenderer::Table.new(@stats).to_s(n)
45
+ def stats_table(num_of_rows = 50)
46
+ LiquidRenderer::Table.new(@stats).to_s(num_of_rows)
47
47
  end
48
48
 
49
- def self.format_error(e, path)
50
- "#{e.message} in #{path}"
49
+ def self.format_error(error, path)
50
+ "#{error.message} in #{path}"
51
51
  end
52
52
 
53
53
  private
54
54
 
55
55
  def filename_regex
56
- %r!\A(#{source_dir}/|#{theme_dir}/|\W*)(.*)!oi
56
+ @filename_regex ||= %r!\A(#{source_dir}/|#{theme_dir}/|\W*)(.*)!i
57
57
  end
58
58
 
59
59
  def new_profile_hash
@@ -6,8 +6,8 @@ module Jekyll
6
6
  @stats = stats
7
7
  end
8
8
 
9
- def to_s(n = 50)
10
- data = data_for_table(n)
9
+ def to_s(num_of_rows = 50)
10
+ data = data_for_table(num_of_rows)
11
11
  widths = table_widths(data)
12
12
  generate_table(data, widths)
13
13
  end
@@ -63,16 +63,16 @@ module Jekyll
63
63
 
64
64
  data.each do |row|
65
65
  row.each_with_index do |cell, index|
66
- widths[index] = [ cell.length, widths[index] ].compact.max
66
+ widths[index] = [cell.length, widths[index]].compact.max
67
67
  end
68
68
  end
69
69
 
70
70
  widths
71
71
  end
72
72
 
73
- def data_for_table(n)
73
+ def data_for_table(num_of_rows)
74
74
  sorted = @stats.sort_by { |_, file_stats| -file_stats[:time] }
75
- sorted = sorted.slice(0, n)
75
+ sorted = sorted.slice(0, num_of_rows)
76
76
 
77
77
  table = [%w(Filename Count Bytes Time)]
78
78
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "csv"
4
-
5
3
  module Jekyll
6
4
  class Reader
7
5
  attr_reader :site
@@ -20,6 +20,7 @@ module Jekyll
20
20
  #
21
21
  # Returns a boolean.
22
22
  def regenerate?(document)
23
+ return true if disabled
23
24
  case document
24
25
  when Page
25
26
  regenerate_page?(document)
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "csv"
4
-
5
3
  module Jekyll
6
4
  class Site
7
5
  attr_reader :source, :dest, :config
@@ -279,10 +277,12 @@ module Jekyll
279
277
  # Get the implementation class for the given Converter.
280
278
  # Returns the Converter instance implementing the given Converter.
281
279
  # klass - The Class of the Converter to fetch.
282
-
283
280
  def find_converter_instance(klass)
284
- converters.find { |klass_| klass_.instance_of?(klass) } || \
285
- raise("No Converters found for #{klass}")
281
+ @find_converter_instance ||= {}
282
+ @find_converter_instance[klass] ||= begin
283
+ converters.find { |converter| converter.instance_of?(klass) } || \
284
+ raise("No Converters found for #{klass}")
285
+ end
286
286
  end
287
287
 
288
288
  # klass - class or module containing the subclasses.
@@ -216,8 +216,15 @@ MSG
216
216
  if context.registers[:page].nil?
217
217
  context.registers[:site].source
218
218
  else
219
- current_doc_dir = File.dirname(context.registers[:page]["path"])
220
- context.registers[:site].in_source_dir current_doc_dir
219
+ site = context.registers[:site]
220
+ page_payload = context.registers[:page]
221
+ resource_path = \
222
+ if page_payload["collection"].nil?
223
+ page_payload["path"]
224
+ else
225
+ File.join(site.config["collections_dir"], page_payload["path"])
226
+ end
227
+ site.in_source_dir File.dirname(resource_path)
221
228
  end
222
229
  end
223
230
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "addressable/uri"
4
-
5
3
  # Public: Methods that generate a URL for a resource such as a Post or a Page.
6
4
  #
7
5
  # Examples
@@ -69,7 +69,7 @@ module Jekyll
69
69
 
70
70
  private
71
71
  def proc_version
72
- @cached_proc_version ||= begin
72
+ @proc_version ||= begin
73
73
  Pathutil.new(
74
74
  "/proc/version"
75
75
  ).read
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ Jekyll::External.require_with_graceful_fail("rouge")
4
+
3
5
  module Jekyll
4
6
  module Utils
5
7
  module Rouge
6
8
 
7
9
  def self.html_formatter(*args)
8
- Jekyll::External.require_with_graceful_fail("rouge") unless defined?(::Rouge)
9
10
  if old_api?
10
11
  ::Rouge::Formatters::HTML.new(*args)
11
12
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jekyll
4
- VERSION = "3.8.0.pre.rc1".freeze
4
+ VERSION = "3.8.0.pre.rc2".freeze
5
5
  end
@@ -1,6 +1,6 @@
1
1
  ---
2
- # You don't need to edit this file, it's empty on purpose.
3
- # Edit theme's home layout instead if you wanna make some changes
4
- # See: https://jekyllrb.com/docs/themes/#overriding-theme-defaults
2
+ # Feel free to add content and custom Front Matter to this file.
3
+ # To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults
4
+
5
5
  layout: home
6
6
  ---
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.0.pre.rc1
4
+ version: 3.8.0.pre.rc2
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-04-03 00:00:00.000000000 Z
11
+ date: 2018-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable