jekyll 3.1.3 → 3.1.4

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
  SHA1:
3
- metadata.gz: 29daae6d76fc38cafbe21fabe31445e88fe0464a
4
- data.tar.gz: b985ebf8f0ed03fa16bd46a031c7294d2581ea87
3
+ metadata.gz: ae75d5ad382aa7a321b45009c2d38f2b2a39f105
4
+ data.tar.gz: 3695125fde0f734ea527906b200f670699910fed
5
5
  SHA512:
6
- metadata.gz: 976d81d83465c53dead23b40de153e81c3cdf4281f977ec8942a73352effd2d9750c9d329ae5dd04332afbfb8f597eda5afa5b88857a4d82a5b4ec6804632236
7
- data.tar.gz: 316a5bb0096f088753b928940b2c846fce08f921c8cb720ccd22b48465a9fffa1250b53c935241fb3ebb63b645386a00e209cf38b6e3286643ace43243ff09ad
6
+ metadata.gz: e6cd200a9084f7783d4674070006f488db49c182745dbf452c1717309b5b7012e3e381873cb523e8c429f89d565bab69549367c56d2d85f231cef8e779f093db
7
+ data.tar.gz: 4c135aeeafb3269a8433c7a9a26783ec690c663e5d9f750faa06a4d8c283868416ceb5a38639974ee4a64b67a0e4a762a3b1e08b47e23e90c53d2d7bcb1761f3
@@ -95,18 +95,16 @@ module Jekyll
95
95
  # list of option names and their defaults.
96
96
  #
97
97
  # Returns the final configuration Hash.
98
- def configuration(override = {})
99
- config = Configuration[Configuration::DEFAULTS]
100
- override = Configuration[override].stringify_keys
98
+ def configuration(override = Hash.new)
99
+ config = Configuration.new
101
100
  unless override.delete('skip_config_files')
102
101
  config = config.read_config_files(config.config_files(override))
103
102
  end
104
103
 
105
104
  # Merge DEFAULTS < _config.yml < override
106
- config = Utils.deep_merge_hashes(config, override).stringify_keys
107
- set_timezone(config['timezone']) if config['timezone']
108
-
109
- config
105
+ Configuration.from(Utils.deep_merge_hashes(config, override)).tap do |config|
106
+ set_timezone(config['timezone']) if config['timezone']
107
+ end
110
108
  end
111
109
 
112
110
  # Public: Set the TZ environment variable to use the timezone specified
@@ -71,7 +71,24 @@ module Jekyll
71
71
  'hard_wrap' => false,
72
72
  'footnote_nr' => 1
73
73
  }
74
- }]
74
+ }.map { |k, v| [k, v.freeze] }].freeze
75
+
76
+ class << self
77
+ # Static: Produce a Configuration ready for use in a Site.
78
+ # It takes the input, fills in the defaults where values do not
79
+ # exist, and patches common issues including migrating options for
80
+ # backwards compatiblity. Except where a key or value is being fixed,
81
+ # the user configuration will override the defaults.
82
+ #
83
+ # user_config - a Hash or Configuration of overrides.
84
+ #
85
+ # Returns a Configuration filled with defaults and fixed for common
86
+ # problems and backwards-compatibility.
87
+ def from(user_config)
88
+ Utils.deep_merge_hashes(DEFAULTS, Configuration[user_config].stringify_keys).
89
+ fix_common_issues.add_default_collections
90
+ end
91
+ end
75
92
 
76
93
  # Public: Turn all keys into string
77
94
  #
@@ -168,6 +185,7 @@ module Jekyll
168
185
 
169
186
  begin
170
187
  files.each do |config_file|
188
+ next if config_file.nil? or config_file.empty?
171
189
  new_config = read_config_file(config_file)
172
190
  configuration = Utils.deep_merge_hashes(configuration, new_config)
173
191
  end
@@ -227,7 +245,6 @@ module Jekyll
227
245
  end
228
246
 
229
247
  %w(include exclude).each do |option|
230
- config[option] ||= []
231
248
  if config[option].is_a?(String)
232
249
  Jekyll::Deprecator.deprecation_message "The '#{option}' configuration option" \
233
250
  " must now be specified as an array, but you specified" \
@@ -235,7 +252,7 @@ module Jekyll
235
252
  " as a list of comma-separated values."
236
253
  config[option] = csv_to_array(config[option])
237
254
  end
238
- config[option].map!(&:to_s)
255
+ config[option].map!(&:to_s) if config[option]
239
256
  end
240
257
 
241
258
  if (config['kramdown'] || {}).key?('use_coderay')
@@ -270,14 +287,22 @@ module Jekyll
270
287
  def add_default_collections
271
288
  config = clone
272
289
 
290
+ # It defaults to `{}`, so this is only if someone sets it to null manually.
273
291
  return config if config['collections'].nil?
274
292
 
293
+ # Ensure we have a hash.
275
294
  if config['collections'].is_a?(Array)
276
295
  config['collections'] = Hash[config['collections'].map { |c| [c, {}] }]
277
296
  end
278
- config['collections']['posts'] ||= {}
279
- config['collections']['posts']['output'] = true
280
- config['collections']['posts']['permalink'] = style_to_permalink(config['permalink'])
297
+
298
+ config['collections'] = Utils.deep_merge_hashes(
299
+ { 'posts' => {} }, config['collections']
300
+ ).tap do |collections|
301
+ collections['posts']['output'] = true
302
+ if config['permalink']
303
+ collections['posts']['permalink'] ||= style_to_permalink(config['permalink'])
304
+ end
305
+ end
281
306
 
282
307
  config
283
308
  end
@@ -209,10 +209,13 @@ module Jekyll
209
209
 
210
210
  used = Set.new([layout])
211
211
 
212
+ # Reset the payload layout data to ensure it starts fresh for each page.
213
+ payload["layout"] = nil
214
+
212
215
  while layout
213
216
  Jekyll.logger.debug "Rendering Layout:", path
214
217
  payload["content"] = output
215
- payload["layout"] = Utils.deep_merge_hashes(payload["layout"] || {}, layout.data)
218
+ payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
216
219
 
217
220
  self.output = render_liquid(layout.content,
218
221
  payload,
@@ -3,7 +3,7 @@
3
3
  module Jekyll
4
4
  module Drops
5
5
  class Drop < Liquid::Drop
6
- NON_CONTENT_METHODS = [:[], :[]=, :inspect, :to_h, :fallback_data].freeze
6
+ NON_CONTENT_METHODS = [:fallback_data].freeze
7
7
 
8
8
  # Get or set whether the drop class is mutable.
9
9
  # Mutability determines whether or not pre-defined fields may be
@@ -86,7 +86,7 @@ module Jekyll
86
86
  # Returns an Array of strings which represent method-specific keys.
87
87
  def content_methods
88
88
  @content_methods ||= (
89
- self.class.instance_methods(false) - NON_CONTENT_METHODS
89
+ self.class.instance_methods - Jekyll::Drops::Drop.instance_methods - NON_CONTENT_METHODS
90
90
  ).map(&:to_s).reject do |method|
91
91
  method.end_with?("=")
92
92
  end
@@ -147,6 +147,12 @@ module Jekyll
147
147
  keys.each(&block)
148
148
  end
149
149
 
150
+ def each(&block)
151
+ each_key.each do |key|
152
+ yield key, self[key]
153
+ end
154
+ end
155
+
150
156
  def merge(other, &block)
151
157
  self.dup.tap do |me|
152
158
  if block.nil?
@@ -0,0 +1,15 @@
1
+ # encoding: UTF-8
2
+
3
+ module Jekyll
4
+ module Drops
5
+ class ExcerptDrop < DocumentDrop
6
+ def layout
7
+ @obj.doc.data['layout']
8
+ end
9
+
10
+ def excerpt
11
+ nil
12
+ end
13
+ end
14
+ end
15
+ end
@@ -28,7 +28,7 @@ module Jekyll
28
28
  end
29
29
 
30
30
  def collections
31
- @site_collections ||= @obj.collections.values.map(&:to_liquid)
31
+ @site_collections ||= @obj.collections.values.sort_by(&:label).map(&:to_liquid)
32
32
  end
33
33
 
34
34
  private
@@ -7,7 +7,7 @@ module Jekyll
7
7
  attr_writer :output
8
8
 
9
9
  def_delegators :@doc, :site, :name, :ext, :relative_path, :extname,
10
- :render_with_liquid?, :collection, :related_posts
10
+ :render_with_liquid?, :collection, :related_posts, :url
11
11
 
12
12
  # Initialize this Excerpt instance.
13
13
  #
@@ -59,10 +59,7 @@ module Jekyll
59
59
  end
60
60
 
61
61
  def to_liquid
62
- doc.data['excerpt'] = nil
63
- @to_liquid ||= doc.to_liquid
64
- doc.data['excerpt'] = self
65
- @to_liquid
62
+ Jekyll::Drops::ExcerptDrop.new(self)
66
63
  end
67
64
 
68
65
  # Returns the shorthand String identifier of this doc.
@@ -76,7 +76,7 @@ module Jekyll
76
76
  #
77
77
  # Returns an Array of plugin search paths
78
78
  def plugins_path
79
- if site.config['plugins_dir'] == Jekyll::Configuration::DEFAULTS['plugins_dir']
79
+ if site.config['plugins_dir'].eql? Jekyll::Configuration::DEFAULTS['plugins_dir']
80
80
  [site.in_source_dir(site.config['plugins_dir'])]
81
81
  else
82
82
  Array(site.config['plugins_dir']).map { |d| File.expand_path(d) }
@@ -135,10 +135,13 @@ module Jekyll
135
135
 
136
136
  used = Set.new([layout])
137
137
 
138
+ # Reset the payload layout data to ensure it starts fresh for each page.
139
+ payload["layout"] = nil
140
+
138
141
  while layout
139
142
  payload['content'] = output
140
143
  payload['page'] = document.to_liquid
141
- payload['layout'] = Utils.deep_merge_hashes(payload['layout'] || {}, layout.data)
144
+ payload['layout'] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
142
145
 
143
146
  output = render_liquid(
144
147
  layout.content,
@@ -53,6 +53,10 @@ module Jekyll
53
53
  target.default_proc = overwrite.default_proc
54
54
  end
55
55
 
56
+ target.each do |key, val|
57
+ target[key] = val.dup if val.frozen? && duplicable?(val)
58
+ end
59
+
56
60
  target
57
61
  end
58
62
 
@@ -60,6 +64,15 @@ module Jekyll
60
64
  value.is_a?(Hash) || value.is_a?(Drops::Drop)
61
65
  end
62
66
 
67
+ def duplicable?(obj)
68
+ case obj
69
+ when nil, false, true, Symbol, Numeric
70
+ false
71
+ else
72
+ true
73
+ end
74
+ end
75
+
63
76
  # Read array from the supplied hash favouring the singular key
64
77
  # and then the plural key, and handling any nil entries.
65
78
  #
@@ -1,3 +1,3 @@
1
1
  module Jekyll
2
- VERSION = '3.1.3'
2
+ VERSION = '3.1.4'
3
3
  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.1.3
4
+ version: 3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-18 00:00:00.000000000 Z
11
+ date: 2016-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -160,6 +160,7 @@ files:
160
160
  - lib/jekyll/drops/collection_drop.rb
161
161
  - lib/jekyll/drops/document_drop.rb
162
162
  - lib/jekyll/drops/drop.rb
163
+ - lib/jekyll/drops/excerpt_drop.rb
163
164
  - lib/jekyll/drops/jekyll_drop.rb
164
165
  - lib/jekyll/drops/site_drop.rb
165
166
  - lib/jekyll/drops/unified_payload_drop.rb