jekyll 3.1.0.pre.rc2 → 3.1.0.pre.rc3

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: 0c49c2ade7b29eeb1b1928c794846db916363241
4
- data.tar.gz: 5713d975ac97f85c1d5cda5a4377ef8d71765268
3
+ metadata.gz: 2865d808960f9a984948e2dd85a597a69f5c4a44
4
+ data.tar.gz: c2d0d0269e460efde60e26ae58950640740d4f7b
5
5
  SHA512:
6
- metadata.gz: e4a476d032971178d64c3ab1087bedcaa16cfaf96c6b232d9a8461f8ed9f4db087e8af6b5691bdb2ece34e42facfdc083240fde62286c7d3fba06d0e08e8a8bd
7
- data.tar.gz: d3b03199417ca5da4d536f30fd5d9fbd8f782acca115c613cacfdda6f74f9bb725fb7fe79658050c4c267ba2f72405f7e7d4ce24780495618c8ec8df1984a97c
6
+ metadata.gz: 52b008307fc6b72f72ab63690691ec39d521abd6505a6ef7e2d96745fc4876b4389daa9947850e04b1be4457d4701378240f13642aa6f80f24a67ef9a4482ba4
7
+ data.tar.gz: 537a7719b68d684c382e3a2b521518269bcfd14384bff5eb5da724e4b75278adce25cd0c620c922e8044bfd8bfc7be614813e5cea660cc6ad1a8dca3a47063d9
@@ -1,11 +1,18 @@
1
1
  # [Jekyll](http://jekyllrb.com/)
2
2
 
3
- [![Gem Version](https://img.shields.io/gem/v/jekyll.svg)](https://rubygems.org/gems/jekyll)
4
- [![Build Status](https://img.shields.io/travis/jekyll/jekyll/master.svg)](https://travis-ci.org/jekyll/jekyll)
5
- [![Code Climate](https://img.shields.io/codeclimate/github/jekyll/jekyll.svg)](https://codeclimate.com/github/jekyll/jekyll)
6
- [![Test Coverage](https://codeclimate.com/github/jekyll/jekyll/badges/coverage.svg)](https://codeclimate.com/github/jekyll/jekyll/coverage)
7
- [![Dependency Status](https://gemnasium.com/jekyll/jekyll.svg)](https://gemnasium.com/jekyll/jekyll)
8
- [![Security](https://hakiri.io/github/jekyll/jekyll/master.svg)](https://hakiri.io/github/jekyll/jekyll/master)
3
+ [![Gem Version](https://img.shields.io/gem/v/jekyll.svg)][ruby-gems]
4
+ [![Build Status](https://travis-ci.org/jekyll/jekyll.svg?branch=master)][travis]
5
+ [![Test Coverage](https://codeclimate.com/github/jekyll/jekyll/badges/coverage.svg)][coverage]
6
+ [![Code Climate](https://codeclimate.com/github/jekyll/jekyll/badges/gpa.svg)][codeclimate]
7
+ [![Dependency Status](https://gemnasium.com/jekyll/jekyll.svg)][gemnasium]
8
+ [![Security](https://hakiri.io/github/jekyll/jekyll/master.svg)][hakiri]
9
+
10
+ [ruby-gems]: https://rubygems.org/gems/jekyll
11
+ [gemnasium]: https://gemnasium.com/jekyll/jekyll
12
+ [codeclimate]: https://codeclimate.com/github/jekyll/jekyll
13
+ [coverage]: https://codeclimate.com/github/jekyll/jekyll/coverage
14
+ [hakiri]: https://hakiri.io/github/jekyll/jekyll/master
15
+ [travis]: https://travis-ci.org/jekyll/jekyll
9
16
 
10
17
  By Tom Preston-Werner, Nick Quaranto, Parker Moore, and many [awesome contributors](https://github.com/jekyll/jekyll/graphs/contributors)!
11
18
 
@@ -33,7 +33,9 @@ module Jekyll
33
33
  build(site, options)
34
34
  end
35
35
 
36
- if options.fetch('watch', false)
36
+ if options.fetch('detach', false)
37
+ Jekyll.logger.info "Auto-regeneration:", "disabled when running server detached."
38
+ elsif options.fetch('watch', false)
37
39
  watch(site, options)
38
40
  else
39
41
  Jekyll.logger.info "Auto-regeneration:", "disabled. Use --watch to enable."
@@ -8,7 +8,7 @@ module Jekyll
8
8
  attr_accessor :content, :output
9
9
 
10
10
  YAML_FRONT_MATTER_REGEXP = /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
11
- DATELESS_FILENAME_MATCHER = /^(.*)(\.[^.]+)$/
11
+ DATELESS_FILENAME_MATCHER = /^(.+\/)*(.*)(\.[^.]+)$/
12
12
  DATE_FILENAME_MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)(\.[^.]+)$/
13
13
 
14
14
  # Create a new Document.
@@ -50,7 +50,7 @@ module Jekyll
50
50
  # Merge some data in with this document's data.
51
51
  #
52
52
  # Returns the merged data.
53
- def merge_data!(other)
53
+ def merge_data!(other, source: "YAML front matter")
54
54
  if other.key?('categories') && !other['categories'].nil?
55
55
  if other['categories'].is_a?(String)
56
56
  other['categories'] = other['categories'].split(" ").map(&:strip)
@@ -61,7 +61,7 @@ module Jekyll
61
61
  if data.key?('date') && !data['date'].is_a?(Time)
62
62
  data['date'] = Utils.parse_date(
63
63
  data['date'].to_s,
64
- "Document '#{relative_path}' does not have a valid date in the YAML front matter."
64
+ "Document '#{relative_path}' does not have a valid date in the #{source}."
65
65
  )
66
66
  end
67
67
  data
@@ -267,40 +267,46 @@ module Jekyll
267
267
  else
268
268
  begin
269
269
  defaults = @site.frontmatter_defaults.all(url, collection.label.to_sym)
270
- merge_data!(defaults) unless defaults.empty?
270
+ merge_data!(defaults, source: "front matter defaults") unless defaults.empty?
271
271
 
272
272
  self.content = File.read(path, merged_file_read_opts(opts))
273
273
  if content =~ YAML_FRONT_MATTER_REGEXP
274
274
  self.content = $POSTMATCH
275
275
  data_file = SafeYAML.load(Regexp.last_match(1))
276
- merge_data!(data_file) if data_file
276
+ merge_data!(data_file, source: "YAML front matter") if data_file
277
277
  end
278
278
 
279
279
  post_read
280
280
  rescue SyntaxError => e
281
- puts "YAML Exception reading #{path}: #{e.message}"
281
+ Jekyll.logger.error "Error:", "YAML Exception reading #{path}: #{e.message}"
282
282
  rescue Exception => e
283
- puts "Error reading file #{path}: #{e.message}"
283
+ if e.is_a? Jekyll::Errors::FatalException
284
+ raise e
285
+ end
286
+ Jekyll.logger.error "Error:", "could not read file #{path}: #{e.message}"
284
287
  end
285
288
  end
286
289
  end
287
290
 
288
291
  def post_read
289
- if DATE_FILENAME_MATCHER =~ relative_path
290
- _, _, date, slug, ext = *relative_path.match(DATE_FILENAME_MATCHER)
291
- merge_data!({
292
- "slug" => slug,
293
- "ext" => ext
294
- })
295
- merge_data!({ "date" => date }) if data['date'].nil? || data['date'].to_i == site.time.to_i
296
- data['title'] ||= slug.split('-').select(&:capitalize).join(' ')
292
+ if relative_path =~ DATE_FILENAME_MATCHER
293
+ date, slug, ext = $2, $3, $4
294
+ if !data['date'] || data['date'].to_i == site.time.to_i
295
+ merge_data!({"date" => date}, source: "filename")
296
+ end
297
+ elsif relative_path =~ DATELESS_FILENAME_MATCHER
298
+ slug, ext = $2, $3
297
299
  end
300
+
301
+ # Try to ensure the user gets a title.
302
+ data["title"] ||= Utils.titleize_slug(slug)
303
+ # Only overwrite slug & ext if they aren't specified.
304
+ data['slug'] ||= slug
305
+ data['ext'] ||= ext
306
+
298
307
  populate_categories
299
308
  populate_tags
300
-
301
- if generate_excerpt?
302
- data['excerpt'] ||= Jekyll::Excerpt.new(self)
303
- end
309
+ generate_excerpt
304
310
  end
305
311
 
306
312
  # Add superdirectories of the special_dir to categories.
@@ -312,7 +318,7 @@ module Jekyll
312
318
  superdirs = relative_path.sub(/#{special_dir}(.*)/, '').split(File::SEPARATOR).reject do |c|
313
319
  c.empty? || c.eql?(special_dir) || c.eql?(basename)
314
320
  end
315
- merge_data!({ 'categories' => superdirs })
321
+ merge_data!({ 'categories' => superdirs }, source: "file path")
316
322
  end
317
323
 
318
324
  def populate_categories
@@ -437,5 +443,12 @@ module Jekyll
437
443
  super
438
444
  end
439
445
  end
446
+
447
+ private # :nodoc:
448
+ def generate_excerpt
449
+ if generate_excerpt?
450
+ data["excerpt"] ||= Jekyll::Excerpt.new(self)
451
+ end
452
+ end
440
453
  end
441
454
  end
@@ -46,7 +46,7 @@ module Jekyll
46
46
  def [](key)
47
47
  if self.class.mutable? && @mutations.key?(key)
48
48
  @mutations[key]
49
- elsif respond_to? key
49
+ elsif self.class.invokable? key
50
50
  public_send key
51
51
  else
52
52
  fallback_data[key]
@@ -63,8 +63,7 @@ module Jekyll
63
63
  #
64
64
  # Returns the String permalink or nil if none has been set.
65
65
  def permalink
66
- return nil if data.nil? || data['permalink'].nil?
67
- data['permalink']
66
+ data.nil? ? nil : data['permalink']
68
67
  end
69
68
 
70
69
  # The template of the permalink.
@@ -225,7 +225,7 @@ module Jekyll
225
225
  # Build a hash map based on the specified post attribute ( post attr =>
226
226
  # array of posts ) then sort each array in reverse order.
227
227
  hash = Hash.new { |h, key| h[key] = [] }
228
- posts.docs.each { |p| p.data[post_attr].each { |t| hash[t] << p } }
228
+ posts.docs.each { |p| p.data[post_attr].each { |t| hash[t] << p } if p.data[post_attr] }
229
229
  hash.values.each { |posts| posts.sort!.reverse! }
230
230
  hash
231
231
  end
@@ -10,10 +10,20 @@ module Jekyll
10
10
  SLUGIFY_DEFAULT_REGEXP = Regexp.new('[^[:alnum:]]+').freeze
11
11
  SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze
12
12
 
13
+ # Takes an indented string and removes the preceding spaces on each line
14
+
13
15
  def strip_heredoc(str)
14
16
  str.gsub(/^[ \t]{#{(str.scan(/^[ \t]*(?=\S)/).min || "").size}}/, "")
15
17
  end
16
18
 
19
+ # Takes a slug and turns it into a simple title.
20
+
21
+ def titleize_slug(slug)
22
+ slug.split("-").map! do |val|
23
+ val.capitalize!
24
+ end.join(" ")
25
+ end
26
+
17
27
  # Non-destructive version of deep_merge_hashes! See that method.
18
28
  #
19
29
  # Returns the merged hashes.
@@ -1,3 +1,3 @@
1
1
  module Jekyll
2
- VERSION = '3.1.0.pre.rc2'
2
+ VERSION = '3.1.0.pre.rc3'
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.0.pre.rc2
4
+ version: 3.1.0.pre.rc3
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-01-18 00:00:00.000000000 Z
11
+ date: 2016-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  version: 1.3.1
245
245
  requirements: []
246
246
  rubyforge_project:
247
- rubygems_version: 2.2.5
247
+ rubygems_version: 2.5.1
248
248
  signing_key:
249
249
  specification_version: 2
250
250
  summary: A simple, blog aware, static site generator.