jekyll 3.0.0.pre.beta1 → 3.0.0.pre.beta2

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: 6ddbc7646be7d369024bb6af467093d2e6a98b41
4
- data.tar.gz: 5ce3273554fe2ac4dd696beacab329c50caa805f
3
+ metadata.gz: 7dddf1b38fdc18a72e5eb9b4815ce16cc8064ea4
4
+ data.tar.gz: 6d2f3e779033c12dc2b2b0a9565179b5c76a416d
5
5
  SHA512:
6
- metadata.gz: 6ef504cdb53dcf07e82ba0dcff637af5d93619d35c25658acc71dbc87f5da687b5dd943491e02c6ce32abb8f70dd9efe9b742bfa317da82d6b09089703893f0e
7
- data.tar.gz: e315c62e70753d82a1631c46d864322ac239ef0e944fe73d16539ad050185cd3b591bed5ccb39b0fe6415898e1dc61f995fef5806954d378a80c20dc67b4dd20
6
+ metadata.gz: 0fe940402be050a4b58839cb7475fbf28fd66750074ca4d56317e9e18c6b1078ef360381a004c3f78f06310ad12ced9e20fc8e4e4b5e124004495fe8f740d904
7
+ data.tar.gz: 8e2667ddda7b81528eba778dd3388b19ab6976a2521a57e23d075b6ea93b0bef00fe85f68e55db92e6b6e4d194147502a099ce8a0c36ed124506a438407a4748
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2008-2014 Tom Preston-Werner
3
+ Copyright (c) 2008-2015 Tom Preston-Werner
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -169,11 +169,4 @@ require_all 'jekyll/converters/markdown'
169
169
  require_all 'jekyll/generators'
170
170
  require_all 'jekyll/tags'
171
171
 
172
- # Eventually remove these for 3.0 as non-core
173
- Jekyll::External.require_with_graceful_fail(%w[
174
- toml
175
- jekyll-paginate
176
- jekyll-gist
177
- jekyll-coffeescript
178
- jekyll-sass-converter
179
- ])
172
+ require 'jekyll-sass-converter'
@@ -1,103 +1,101 @@
1
1
  require 'set'
2
2
 
3
3
  module Jekyll
4
- class Site
5
- # Handles the cleanup of a site's destination before it is built.
6
- class Cleaner
7
- attr_reader :site
4
+ # Handles the cleanup of a site's destination before it is built.
5
+ class Cleaner
6
+ attr_reader :site
8
7
 
9
- def initialize(site)
10
- @site = site
11
- end
8
+ def initialize(site)
9
+ @site = site
10
+ end
12
11
 
13
- # Cleans up the site's destination directory
14
- def cleanup!
15
- FileUtils.rm_rf(obsolete_files)
16
- FileUtils.rm_rf(metadata_file) if @site.full_rebuild?
17
- end
12
+ # Cleans up the site's destination directory
13
+ def cleanup!
14
+ FileUtils.rm_rf(obsolete_files)
15
+ FileUtils.rm_rf(metadata_file) if @site.full_rebuild?
16
+ end
18
17
 
19
- private
18
+ private
20
19
 
21
- # Private: The list of files and directories to be deleted during cleanup process
22
- #
23
- # Returns an Array of the file and directory paths
24
- def obsolete_files
25
- (existing_files - new_files - new_dirs + replaced_files).to_a
26
- end
20
+ # Private: The list of files and directories to be deleted during cleanup process
21
+ #
22
+ # Returns an Array of the file and directory paths
23
+ def obsolete_files
24
+ (existing_files - new_files - new_dirs + replaced_files).to_a
25
+ end
27
26
 
28
- # Private: The metadata file storing dependency tree and build history
29
- #
30
- # Returns an Array with the metdata file as the only item
31
- def metadata_file
32
- [site.regenerator.metadata_file]
33
- end
27
+ # Private: The metadata file storing dependency tree and build history
28
+ #
29
+ # Returns an Array with the metdata file as the only item
30
+ def metadata_file
31
+ [site.regenerator.metadata_file]
32
+ end
34
33
 
35
- # Private: The list of existing files, apart from those included in keep_files and hidden files.
36
- #
37
- # Returns a Set with the file paths
38
- def existing_files
39
- files = Set.new
40
- Dir.glob(site.in_dest_dir("**", "*"), File::FNM_DOTMATCH) do |file|
41
- files << file unless file =~ /\/\.{1,2}$/ || file =~ keep_file_regex || keep_dirs.include?(file)
42
- end
43
- files
34
+ # Private: The list of existing files, apart from those included in keep_files and hidden files.
35
+ #
36
+ # Returns a Set with the file paths
37
+ def existing_files
38
+ files = Set.new
39
+ Dir.glob(site.in_dest_dir("**", "*"), File::FNM_DOTMATCH) do |file|
40
+ files << file unless file =~ /\/\.{1,2}$/ || file =~ keep_file_regex || keep_dirs.include?(file)
44
41
  end
42
+ files
43
+ end
45
44
 
46
- # Private: The list of files to be created when site is built.
47
- #
48
- # Returns a Set with the file paths
49
- def new_files
50
- files = Set.new
51
- site.each_site_file { |item| files << item.destination(site.dest) }
52
- files
53
- end
45
+ # Private: The list of files to be created when site is built.
46
+ #
47
+ # Returns a Set with the file paths
48
+ def new_files
49
+ files = Set.new
50
+ site.each_site_file { |item| files << item.destination(site.dest) }
51
+ files
52
+ end
54
53
 
55
- # Private: The list of directories to be created when site is built.
56
- # These are the parent directories of the files in #new_files.
57
- #
58
- # Returns a Set with the directory paths
59
- def new_dirs
60
- new_files.map { |file| parent_dirs(file) }.flatten.to_set
61
- end
54
+ # Private: The list of directories to be created when site is built.
55
+ # These are the parent directories of the files in #new_files.
56
+ #
57
+ # Returns a Set with the directory paths
58
+ def new_dirs
59
+ new_files.map { |file| parent_dirs(file) }.flatten.to_set
60
+ end
62
61
 
63
- # Private: The list of parent directories of a given file
64
- #
65
- # Returns an Array with the directory paths
66
- def parent_dirs(file)
67
- parent_dir = File.dirname(file)
68
- if parent_dir == site.dest
69
- []
70
- else
71
- [parent_dir] + parent_dirs(parent_dir)
72
- end
62
+ # Private: The list of parent directories of a given file
63
+ #
64
+ # Returns an Array with the directory paths
65
+ def parent_dirs(file)
66
+ parent_dir = File.dirname(file)
67
+ if parent_dir == site.dest
68
+ []
69
+ else
70
+ [parent_dir] + parent_dirs(parent_dir)
73
71
  end
72
+ end
74
73
 
75
- # Private: The list of existing files that will be replaced by a directory during build
76
- #
77
- # Returns a Set with the file paths
78
- def replaced_files
79
- new_dirs.select { |dir| File.file?(dir) }.to_set
80
- end
74
+ # Private: The list of existing files that will be replaced by a directory during build
75
+ #
76
+ # Returns a Set with the file paths
77
+ def replaced_files
78
+ new_dirs.select { |dir| File.file?(dir) }.to_set
79
+ end
81
80
 
82
- # Private: The list of directories that need to be kept because they are parent directories
83
- # of files specified in keep_files
84
- #
85
- # Returns a Set with the directory paths
86
- def keep_dirs
87
- site.keep_files.map { |file| parent_dirs(site.in_dest_dir(file)) }.flatten.to_set
88
- end
81
+ # Private: The list of directories that need to be kept because they are parent directories
82
+ # of files specified in keep_files
83
+ #
84
+ # Returns a Set with the directory paths
85
+ def keep_dirs
86
+ site.keep_files.map { |file| parent_dirs(site.in_dest_dir(file)) }.flatten.to_set
87
+ end
89
88
 
90
- # Private: Creates a regular expression from the config's keep_files array
91
- #
92
- # Examples
93
- # ['.git','.svn'] creates the following regex: /\/(\.git|\/.svn)/
94
- #
95
- # Returns the regular expression
96
- def keep_file_regex
97
- or_list = site.keep_files.join("|")
98
- pattern = "\/(#{or_list.gsub(".", "\.")})"
99
- Regexp.new pattern
100
- end
89
+ # Private: Creates a regular expression from the config's keep_files array
90
+ #
91
+ # Examples
92
+ # ['.git','.svn'] creates the following regex: /\/(\.git|\/.svn)/
93
+ #
94
+ # Returns the regular expression
95
+ def keep_file_regex
96
+ or_list = site.keep_files.join("|")
97
+ pattern = "\/(#{or_list.gsub(".", "\.")})"
98
+ Regexp.new pattern
101
99
  end
102
100
  end
103
101
  end
@@ -170,7 +170,9 @@ module Jekyll
170
170
  #
171
171
  # Returns the URL template to render collection's documents at.
172
172
  def url_template
173
- metadata.fetch('permalink', "/:collection/:path:output_ext")
173
+ metadata.fetch('permalink') do
174
+ Utils.add_permalink_suffix("/:collection/:path", site.permalink_style)
175
+ end
174
176
  end
175
177
 
176
178
  # Extract options for this collection from the site configuration.
@@ -49,6 +49,8 @@ module Jekyll
49
49
  # Returns nothing
50
50
  def add_build_options(c)
51
51
  c.option 'config', '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
52
+ c.option 'destination', '-d', '--destination DESTINATION', 'The current folder will be generated into DESTINATION'
53
+ c.option 'source', '-s', '--source SOURCE', 'Custom source directory'
52
54
  c.option 'future', '--future', 'Publishes posts with a future date'
53
55
  c.option 'limit_posts', '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
54
56
  c.option 'watch', '-w', '--[no-]watch', 'Watch for changes and rebuild'
@@ -48,6 +48,7 @@ module Jekyll
48
48
  #
49
49
  # Returns nothing.
50
50
  def build(site, options)
51
+ t = Time.now
51
52
  source = options['source']
52
53
  destination = options['destination']
53
54
  full_build = options['full_rebuild']
@@ -56,7 +57,7 @@ module Jekyll
56
57
  Jekyll.logger.info "Incremental build:", (full_build ? "disabled" : "enabled")
57
58
  Jekyll.logger.info "Generating..."
58
59
  process_site(site)
59
- Jekyll.logger.info "", "done."
60
+ Jekyll.logger.info "", "done in #{(Time.now - t).round(3)} seconds."
60
61
  end
61
62
 
62
63
  # Private: Watch for file changes and rebuild the site.
@@ -39,7 +39,7 @@ module Jekyll
39
39
  contains_deprecated_pages = false
40
40
  site.pages.each do |page|
41
41
  if page.uses_relative_permalinks
42
- Jekyll.logger.warn "Deprecation:", "'#{page.path}' uses relative" +
42
+ Jekyll::Deprecator.deprecation_message "'#{page.path}' uses relative" +
43
43
  " permalinks which will be deprecated in" +
44
44
  " Jekyll v2.0.0 and beyond."
45
45
  contains_deprecated_pages = true
@@ -3,7 +3,7 @@ require 'erb'
3
3
  module Jekyll
4
4
  module Commands
5
5
  class New < Command
6
- class << self
6
+ class << self
7
7
  def init_with_program(prog)
8
8
  prog.command(:new) do |c|
9
9
  c.syntax 'new PATH'
@@ -11,7 +11,7 @@ module Jekyll
11
11
 
12
12
  c.option 'force', '--force', 'Force creation even if PATH already exists'
13
13
  c.option 'blank', '--blank', 'Creates scaffolding but with empty files'
14
-
14
+
15
15
  c.action do |args, options|
16
16
  Jekyll::Commands::New.process(args, options)
17
17
  end
@@ -76,7 +76,7 @@ module Jekyll
76
76
  def scaffold_path
77
77
  "_posts/0000-00-00-welcome-to-jekyll.markdown.erb"
78
78
  end
79
- end
79
+ end
80
80
  end
81
81
  end
82
82
  end
@@ -40,7 +40,7 @@ module Jekyll
40
40
 
41
41
  s.mount(
42
42
  options['baseurl'],
43
- WEBrick::HTTPServlet::FileHandler,
43
+ custom_file_handler,
44
44
  destination,
45
45
  file_handler_options
46
46
  )
@@ -50,7 +50,7 @@ module Jekyll
50
50
  if options['detach'] # detach the server
51
51
  pid = Process.fork { s.start }
52
52
  Process.detach(pid)
53
- Jekyll.logger.info "Server detached with pid '#{pid}'.", "Run `kill -9 #{pid}' to stop the server."
53
+ Jekyll.logger.info "Server detached with pid '#{pid}'.", "Run `pkill -f jekyll' or `kill -9 #{pid}' to stop the server."
54
54
  else # create a new server thread, then join it with current terminal
55
55
  t = Thread.new { s.start }
56
56
  trap("INT") { s.shutdown }
@@ -99,6 +99,21 @@ module Jekyll
99
99
  opts
100
100
  end
101
101
 
102
+ # Custom WEBrick FileHandler servlet for serving "/file.html" at "/file"
103
+ # when no exact match is found. This mirrors the behavior of GitHub
104
+ # Pages and many static web server configs.
105
+ def custom_file_handler
106
+ Class.new WEBrick::HTTPServlet::FileHandler do
107
+ def search_file(req, res, basename)
108
+ if file = super
109
+ file
110
+ else
111
+ super(req, res, "#{basename}.html")
112
+ end
113
+ end
114
+ end
115
+ end
116
+
102
117
  def start_callback(detached)
103
118
  unless detached
104
119
  Proc.new { Jekyll.logger.info "Server running...", "press ctrl-c to stop." }
@@ -35,7 +35,7 @@ module Jekyll
35
35
 
36
36
  # Conversion
37
37
  'markdown' => 'kramdown',
38
- 'highlighter' => 'pygments',
38
+ 'highlighter' => 'rouge',
39
39
  'lsi' => false,
40
40
  'excerpt_separator' => "\n\n",
41
41
 
@@ -115,6 +115,7 @@ module Jekyll
115
115
  def safe_load_file(filename)
116
116
  case File.extname(filename)
117
117
  when /\.toml/i
118
+ Jekyll::External.require_with_graceful_fail('toml') unless defined?(TOML)
118
119
  TOML.load_file(filename)
119
120
  when /\.ya?ml/i
120
121
  SafeYAML.load_file(filename)
@@ -136,7 +137,7 @@ module Jekyll
136
137
  config_files = override.delete('config')
137
138
  if config_files.to_s.empty?
138
139
  default = %w[yml yaml].find(Proc.new { 'yml' }) do |ext|
139
- File.exists? Jekyll.sanitized_path(source(override), "_config.#{ext}")
140
+ File.exist?(Jekyll.sanitized_path(source(override), "_config.#{ext}"))
140
141
  end
141
142
  config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
142
143
  @default_config_file = true
@@ -205,7 +206,7 @@ module Jekyll
205
206
  config = clone
206
207
  # Provide backwards-compatibility
207
208
  if config.key?('auto') || config.key?('watch')
208
- Jekyll.logger.warn "Deprecation:", "Auto-regeneration can no longer" +
209
+ Jekyll::Deprecator.deprecation_message "Auto-regeneration can no longer" +
209
210
  " be set from your configuration file(s). Use the"+
210
211
  " --[no-]watch/-w command-line option instead."
211
212
  config.delete('auto')
@@ -213,14 +214,14 @@ module Jekyll
213
214
  end
214
215
 
215
216
  if config.key? 'server'
216
- Jekyll.logger.warn "Deprecation:", "The 'server' configuration option" +
217
+ Jekyll::Deprecator.deprecation_message "The 'server' configuration option" +
217
218
  " is no longer accepted. Use the 'jekyll serve'" +
218
219
  " subcommand to serve your site with WEBrick."
219
220
  config.delete('server')
220
221
  end
221
222
 
222
223
  if config.key? 'server_port'
223
- Jekyll.logger.warn "Deprecation:", "The 'server_port' configuration option" +
224
+ Jekyll::Deprecator.deprecation_message "The 'server_port' configuration option" +
224
225
  " has been renamed to 'port'. Please update your config" +
225
226
  " file accordingly."
226
227
  # copy but don't overwrite:
@@ -229,7 +230,7 @@ module Jekyll
229
230
  end
230
231
 
231
232
  if config.key? 'pygments'
232
- Jekyll.logger.warn "Deprecation:", "The 'pygments' configuration option" +
233
+ Jekyll::Deprecator.deprecation_message "The 'pygments' configuration option" +
233
234
  " has been renamed to 'highlighter'. Please update your" +
234
235
  " config file accordingly. The allowed values are 'rouge', " +
235
236
  "'pygments' or null."
@@ -240,7 +241,7 @@ module Jekyll
240
241
 
241
242
  %w[include exclude].each do |option|
242
243
  if config.fetch(option, []).is_a?(String)
243
- Jekyll.logger.warn "Deprecation:", "The '#{option}' configuration option" +
244
+ Jekyll::Deprecator.deprecation_message "The '#{option}' configuration option" +
244
245
  " must now be specified as an array, but you specified" +
245
246
  " a string. For now, we've treated the string you provided" +
246
247
  " as a list of comma-separated values."
@@ -260,6 +261,7 @@ module Jekyll
260
261
  "Markdown processor. Maruku support has been deprecated and will " +
261
262
  "be removed in 3.0.0. We recommend you switch to Kramdown."
262
263
  end
264
+
263
265
  config
264
266
  end
265
267
 
@@ -21,7 +21,7 @@ module Jekyll
21
21
  def no_subcommand(args)
22
22
  if args.size > 0 && args.first =~ /^--/ && !%w[--help --version].include?(args.first)
23
23
  deprecation_message "Jekyll now uses subcommands instead of just \
24
- switches. Run `jekyll --help' to find out more."
24
+ switches. Run `jekyll --help` to find out more."
25
25
  end
26
26
  end
27
27
 
@@ -4,7 +4,7 @@ module Jekyll
4
4
  class Document
5
5
  include Comparable
6
6
 
7
- attr_reader :path, :site, :extname
7
+ attr_reader :path, :site, :extname, :output_ext
8
8
  attr_accessor :content, :collection, :output
9
9
 
10
10
  YAML_FRONT_MATTER_REGEXP = /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
@@ -19,6 +19,7 @@ module Jekyll
19
19
  @site = relations[:site]
20
20
  @path = path
21
21
  @extname = File.extname(path)
22
+ @output_ext = Jekyll::Renderer.new(site, self).output_ext
22
23
  @collection = relations[:collection]
23
24
  @has_yaml_header = nil
24
25
  end
@@ -130,9 +131,9 @@ module Jekyll
130
131
  {
131
132
  collection: collection.label,
132
133
  path: cleaned_relative_path,
133
- output_ext: Jekyll::Renderer.new(site, self).output_ext,
134
+ output_ext: output_ext,
134
135
  name: Utils.slugify(basename_without_ext),
135
- title: Utils.slugify(data['title']) || Utils.slugify(basename_without_ext)
136
+ title: Utils.slugify(data['slug']) || Utils.slugify(basename_without_ext)
136
137
  }
137
138
  end
138
139
 
@@ -163,7 +164,8 @@ module Jekyll
163
164
  def destination(base_directory)
164
165
  dest = site.in_dest_dir(base_directory)
165
166
  path = site.in_dest_dir(dest, URL.unescape_path(url))
166
- path = File.join(path, "index.html") if url =~ /\/$/
167
+ path = File.join(path, "index.html") if url.end_with?("/")
168
+ path << output_ext unless path.end_with?(output_ext)
167
169
  path
168
170
  end
169
171
 
@@ -222,6 +222,9 @@ module Jekyll
222
222
  #
223
223
  # Returns the filtered array of objects
224
224
  def sort(input, property = nil, nils = "first")
225
+ if input.nil?
226
+ raise ArgumentError.new("Cannot sort a null object.")
227
+ end
225
228
  if property.nil?
226
229
  input.sort
227
230
  else
@@ -63,16 +63,12 @@ module Jekyll
63
63
  #
64
64
  # Returns the template String.
65
65
  def template
66
- if site.permalink_style == :pretty
67
- if index? && html?
68
- "/:path/"
69
- elsif html?
70
- "/:path/:basename/"
71
- else
72
- "/:path/:basename:output_ext"
73
- end
74
- else
66
+ if !html?
75
67
  "/:path/:basename:output_ext"
68
+ elsif index?
69
+ "/:path/"
70
+ else
71
+ Utils.add_permalink_suffix("/:path/:basename", site.permalink_style)
76
72
  end
77
73
  end
78
74
 
@@ -141,7 +137,8 @@ module Jekyll
141
137
  # Returns the destination file path String.
142
138
  def destination(dest)
143
139
  path = site.in_dest_dir(dest, URL.unescape_path(url))
144
- path = File.join(path, "index.html") if url =~ /\/$/
140
+ path = File.join(path, "index.html") if url.end_with?("/")
141
+ path << output_ext unless path.end_with?(output_ext)
145
142
  path
146
143
  end
147
144
 
@@ -17,6 +17,7 @@ module Jekyll
17
17
  def conscientious_require
18
18
  require_plugin_files
19
19
  require_gems
20
+ deprecation_checks
20
21
  end
21
22
 
22
23
  # Require each of the gem plugins specified.
@@ -88,5 +89,14 @@ module Jekyll
88
89
  end
89
90
  end
90
91
 
92
+ def deprecation_checks
93
+ pagination_included = (site.config['gems'] || []).include?('jekyll-paginate') || defined?(Jekyll::Paginate)
94
+ if site.config['paginate'] && !pagination_included
95
+ Jekyll::Deprecator.deprecation_message "You appear to have pagination " +
96
+ "turned on, but you haven't included the `jekyll-paginate` gem. " +
97
+ "Ensure you have `gems: [jekyll-paginate]` in your configuration file."
98
+ end
99
+ end
100
+
91
101
  end
92
102
  end
@@ -24,6 +24,7 @@ module Jekyll
24
24
  content
25
25
  excerpt
26
26
  excerpt_separator
27
+ draft?
27
28
  ]
28
29
 
29
30
  # Post name validator. Post filenames must be like:
@@ -278,7 +279,8 @@ module Jekyll
278
279
  def destination(dest)
279
280
  # The url needs to be unescaped in order to preserve the correct filename
280
281
  path = site.in_dest_dir(dest, URL.unescape_path(url))
281
- path = File.join(path, "index.html") if self.url =~ /\/$/
282
+ path = File.join(path, "index.html") if self.url.end_with?("/")
283
+ path << output_ext unless path.end_with?(output_ext)
282
284
  path
283
285
  end
284
286
 
@@ -305,6 +307,11 @@ module Jekyll
305
307
  end
306
308
  end
307
309
 
310
+ # Returns if this Post is a Draft
311
+ def draft?
312
+ is_a?(Jekyll::Draft)
313
+ end
314
+
308
315
  protected
309
316
 
310
317
  def extract_excerpt
@@ -10,7 +10,7 @@ module Jekyll
10
10
  def initialize(post)
11
11
  @post = post
12
12
  @site = post.site
13
- require 'classifier-reborn' if site.lsi
13
+ Jekyll::External.require_with_graceful_fail('classifier-reborn') if site.lsi
14
14
  end
15
15
 
16
16
  def build
@@ -258,16 +258,26 @@ module Jekyll
258
258
  if File.directory?(path)
259
259
  read_data_to(path, data[key] = {})
260
260
  else
261
- case File.extname(path).downcase
262
- when '.csv'
263
- data[key] = CSV.read(path, :headers => true).map(&:to_hash)
264
- else
265
- data[key] = SafeYAML.load_file(path)
266
- end
261
+ data[key] = read_data_file(path)
267
262
  end
268
263
  end
269
264
  end
270
265
 
266
+ # Determines how to read a data file.
267
+ #
268
+ # Returns the contents of the data file.
269
+ def read_data_file(path)
270
+ case File.extname(path).downcase
271
+ when '.csv'
272
+ CSV.read(path, {
273
+ :headers => true,
274
+ :encoding => config['encoding']
275
+ }).map(&:to_hash)
276
+ else
277
+ SafeYAML.load_file(path)
278
+ end
279
+ end
280
+
271
281
  # Read in all collections specified in the configuration
272
282
  #
273
283
  # Returns nothing.
@@ -325,7 +335,7 @@ module Jekyll
325
335
  each_site_file { |item|
326
336
  item.write(dest) if regenerator.regenerate?(item)
327
337
  }
328
- regenerator.write_metadata unless full_rebuild?
338
+ regenerator.write_metadata
329
339
  end
330
340
 
331
341
  # Construct a Hash of Posts indexed by the specified Post attribute.
@@ -461,7 +471,7 @@ module Jekyll
461
471
 
462
472
  def relative_permalinks_deprecation_method
463
473
  if config['relative_permalinks'] && has_relative_page?
464
- Jekyll.logger.warn "Deprecation:", "Since v2.0, permalinks for pages" +
474
+ Jekyll::Deprecator.deprecation_message "Since v2.0, permalinks for pages" +
465
475
  " in subfolders must be relative to the" +
466
476
  " site source directory, not the parent" +
467
477
  " directory. Check http://jekyllrb.com/docs/upgrading/"+
@@ -518,7 +528,7 @@ module Jekyll
518
528
  end
519
529
 
520
530
  def sanitize_filename(name)
521
- name.gsub!(/[^\w\s_-]+/, '')
531
+ name.gsub!(/[^\w\s-]+/, '')
522
532
  name.gsub!(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2')
523
533
  name.gsub(/\s+/, '_')
524
534
  end
@@ -42,7 +42,7 @@ eos
42
42
  def render(context)
43
43
  prefix = context["highlighter_prefix"] || ""
44
44
  suffix = context["highlighter_suffix"] || ""
45
- code = super.to_s.gsub(/^(\n|\r)+|(\n|\r)+$/, '')
45
+ code = super.to_s.gsub(/\A(\n|\r)+|(\n|\r)+\z/, '')
46
46
 
47
47
  is_safe = !!context.registers[:site].safe
48
48
 
@@ -75,9 +75,7 @@ eos
75
75
  end
76
76
 
77
77
  def render_pygments(code, is_safe)
78
- require 'pygments'
79
-
80
- @options[:encoding] = 'utf-8'
78
+ Jekyll::External.require_with_graceful_fail('pygments')
81
79
 
82
80
  highlighted_code = Pygments.highlight(
83
81
  code,
@@ -96,26 +94,26 @@ eos
96
94
  raise ArgumentError.new("Pygments.rb returned an unacceptable value when attempting to highlight some code.")
97
95
  end
98
96
 
99
- highlighted_code
97
+ highlighted_code.sub('<div class="highlight"><pre>', '').sub('</pre></div>', '')
100
98
  end
101
99
 
102
100
  def render_rouge(code)
103
- require 'rouge'
101
+ Jekyll::External.require_with_graceful_fail('rouge')
104
102
  formatter = Rouge::Formatters::HTML.new(line_numbers: @options[:linenos], wrap: false)
105
103
  lexer = Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText
106
- code = formatter.format(lexer.lex(code))
107
- "<div class=\"highlight\"><pre>#{code}</pre></div>"
104
+ formatter.format(lexer.lex(code))
108
105
  end
109
106
 
110
107
  def render_codehighlighter(code)
111
- "<div class=\"highlight\"><pre>#{h(code).strip}</pre></div>"
108
+ h(code).strip
112
109
  end
113
110
 
114
111
  def add_code_tag(code)
115
- # Add nested <code> tags to code blocks
116
- code = code.sub(/<pre>\n*/,'<pre><code class="language-' + @lang.to_s.gsub("+", "-") + '" data-lang="' + @lang.to_s + '">')
117
- code = code.sub(/\n*<\/pre>/,"</code></pre>")
118
- code.strip
112
+ code_attributes = [
113
+ "class=\"language-#{@lang.to_s.gsub('+', '-')}\"",
114
+ "data-lang=\"#{@lang.to_s}\""
115
+ ].join(" ")
116
+ "<div class=\"highlight\"><pre><code #{code_attributes}>#{code.chomp}</code></pre></div>"
119
117
  end
120
118
 
121
119
  end
@@ -101,7 +101,7 @@ eos
101
101
  end
102
102
 
103
103
  def tag_includes_dir
104
- '_includes'
104
+ '_includes'.freeze
105
105
  end
106
106
 
107
107
  def render(context)
@@ -123,7 +123,7 @@ eos
123
123
  end
124
124
 
125
125
  begin
126
- partial = Liquid::Template.parse(source(path, context))
126
+ partial = Liquid::Template.parse(read_file(path, context))
127
127
 
128
128
  context.stack do
129
129
  context['include'] = parse_params(context) if @params
@@ -135,7 +135,7 @@ eos
135
135
  end
136
136
 
137
137
  def resolved_includes_dir(context)
138
- File.join(File.realpath(context.registers[:site].source), @includes_dir)
138
+ context.registers[:site].in_source_dir(@includes_dir)
139
139
  end
140
140
 
141
141
  def validate_path(path, dir, safe)
@@ -155,14 +155,14 @@ eos
155
155
  end
156
156
 
157
157
  # This method allows to modify the file content by inheriting from the class.
158
- def source(file, context)
158
+ def read_file(file, context)
159
159
  File.read(file, file_read_opts(context))
160
160
  end
161
161
  end
162
162
 
163
163
  class IncludeRelativeTag < IncludeTag
164
164
  def tag_includes_dir
165
- '.'
165
+ '.'.freeze
166
166
  end
167
167
 
168
168
  def page_path(context)
@@ -44,12 +44,12 @@ module Jekyll
44
44
  #
45
45
  # Returns the _unsanitized String URL
46
46
  def generated_permalink
47
- (@generated_permlink ||= generate_url(@permalink)) if @permalink
47
+ (@generated_permalink ||= generate_url(@permalink)) if @permalink
48
48
  end
49
49
 
50
50
  # Generates a URL from the template
51
51
  #
52
- # Returns the _unsanitized String URL
52
+ # Returns the unsanitized String URL
53
53
  def generated_url
54
54
  @generated_url ||= generate_url(@template)
55
55
  end
@@ -57,11 +57,16 @@ module Jekyll
57
57
  # Internal: Generate the URL by replacing all placeholders with their
58
58
  # respective values in the given template
59
59
  #
60
- # Returns the _unsanitizied_ String URL
60
+ # Returns the unsanitized String URL
61
61
  def generate_url(template)
62
62
  @placeholders.inject(template) do |result, token|
63
63
  break result if result.index(':').nil?
64
- result.gsub(/:#{token.first}/, self.class.escape_path(token.last))
64
+ if token.last.nil?
65
+ # Remove leading '/' to avoid generating urls with `//`
66
+ result.gsub(/\/:#{token.first}/, '')
67
+ else
68
+ result.gsub(/:#{token.first}/, self.class.escape_path(token.last))
69
+ end
65
70
  end
66
71
  end
67
72
 
@@ -76,7 +81,7 @@ module Jekyll
76
81
  .gsub(/\A([^\/])/, '/\1')
77
82
 
78
83
  # Append a trailing slash to the URL if the unsanitized URL had one
79
- url << "/" if in_url[-1].eql?('/')
84
+ url << "/" if in_url.end_with?("/")
80
85
 
81
86
  url
82
87
  end
@@ -102,7 +107,7 @@ module Jekyll
102
107
  # pct-encoded = "%" HEXDIG HEXDIG
103
108
  # sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
104
109
  # / "*" / "+" / "," / ";" / "="
105
- URI.escape(path, /[^a-zA-Z\d\-._~!$&\'()*+,;=:@\/]/).encode('utf-8')
110
+ URI.escape(path, /[^a-zA-Z\d\-._~!$&'()*+,;=:@\/]/).encode('utf-8')
106
111
  end
107
112
 
108
113
  # Unescapes a URL path segment
@@ -158,5 +158,45 @@ module Jekyll
158
158
  downcase
159
159
  end
160
160
 
161
+ # Add an appropriate suffix to template so that it matches the specified
162
+ # permalink style.
163
+ #
164
+ # template - permalink template without trailing slash or file extension
165
+ # permalink_style - permalink style, either built-in or custom
166
+ #
167
+ # The returned permalink template will use the same ending style as
168
+ # specified in permalink_style. For example, if permalink_style contains a
169
+ # trailing slash (or is :pretty, which indirectly has a trailing slash),
170
+ # then so will the returned template. If permalink_style has a trailing
171
+ # ":output_ext" (or is :none, :date, or :ordinal) then so will the returned
172
+ # template. Otherwise, template will be returned without modification.
173
+ #
174
+ # Examples:
175
+ # add_permalink_suffix("/:basename", :pretty)
176
+ # # => "/:basename/"
177
+ #
178
+ # add_permalink_suffix("/:basename", :date)
179
+ # # => "/:basename:output_ext"
180
+ #
181
+ # add_permalink_suffix("/:basename", "/:year/:month/:title/")
182
+ # # => "/:basename/"
183
+ #
184
+ # add_permalink_suffix("/:basename", "/:year/:month/:title")
185
+ # # => "/:basename"
186
+ #
187
+ # Returns the updated permalink template
188
+ def add_permalink_suffix(template, permalink_style)
189
+ case permalink_style
190
+ when :pretty
191
+ template << "/"
192
+ when :date, :ordinal, :none
193
+ template << ":output_ext"
194
+ else
195
+ template << "/" if permalink_style.to_s.end_with?("/")
196
+ template << ":output_ext" if permalink_style.to_s.end_with?(":output_ext")
197
+ end
198
+ template
199
+ end
200
+
161
201
  end
162
202
  end
@@ -1,3 +1,3 @@
1
1
  module Jekyll
2
- VERSION = '3.0.0-beta1'
2
+ VERSION = '3.0.0.pre.beta2'
3
3
  end
@@ -1,2 +1,3 @@
1
1
  _site
2
2
  .sass-cache
3
+ .jekyll-metadata
@@ -5,7 +5,7 @@ description: > # this means to ignore newlines until "baseurl:"
5
5
  Write an awesome description for your new site here. You can edit this
6
6
  line in _config.yml. It will appear in your document head meta (for
7
7
  Google search results) and in your feed.xml site description.
8
- baseurl: "" # the subpath of your site, e.g. /blog/
8
+ baseurl: "" # the subpath of your site, e.g. /blog
9
9
  url: "http://yourdomain.com" # the base hostname & protocol for your site
10
10
  twitter_username: jekyllrb
11
11
  github_username: jekyll
@@ -46,7 +46,7 @@
46
46
  </div>
47
47
 
48
48
  <div class="footer-col footer-col-3">
49
- <p class="text">{{ site.description }}</p>
49
+ <p>{{ site.description }}</p>
50
50
  </div>
51
51
  </div>
52
52
 
@@ -5,7 +5,7 @@ layout: default
5
5
 
6
6
  <header class="post-header">
7
7
  <h1 class="post-title" itemprop="name headline">{{ page.title }}</h1>
8
- <p class="post-meta"><time datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">{{ page.date | date: "%b %-d, %Y" }}</time>{% if page.author %} • <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">{{ page.author }}</span></span>{% endif %}{% if page.meta %} • {{ page.meta }}{% endif %}</p>
8
+ <p class="post-meta"><time datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">{{ page.date | date: "%b %-d, %Y" }}</time>{% if page.author %} • <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">{{ page.author }}</span></span>{% endif %}</p>
9
9
  </header>
10
10
 
11
11
  <div class="post-content" itemprop="articleBody">
@@ -18,8 +18,8 @@ print_hi('Tom')
18
18
  #=> prints 'Hi, Tom' to STDOUT.
19
19
  {% endhighlight %}
20
20
 
21
- Check out the [Jekyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll’s dedicated Help repository][jekyll-help].
21
+ Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll’s dedicated Help repository][jekyll-help].
22
22
 
23
- [jekyll]: http://jekyllrb.com
23
+ [jekyll-docs]: http://jekyllrb.com/docs/home
24
24
  [jekyll-gh]: https://github.com/jekyll/jekyll
25
25
  [jekyll-help]: https://github.com/jekyll/jekyll-help
@@ -14,13 +14,15 @@ dl, dd, ol, ul, figure {
14
14
  * Basic styling
15
15
  */
16
16
  body {
17
- font-family: $base-font-family;
18
- font-size: $base-font-size;
19
- line-height: $base-line-height;
20
- font-weight: 300;
17
+ font: $base-font-weight #{$base-font-size}/#{$base-line-height} $base-font-family;
21
18
  color: $text-color;
22
19
  background-color: $background-color;
23
20
  -webkit-text-size-adjust: 100%;
21
+ -webkit-font-feature-settings: "kern" 1;
22
+ -moz-font-feature-settings: "kern" 1;
23
+ -o-font-feature-settings: "kern" 1;
24
+ font-feature-settings: "kern" 1;
25
+ font-kerning: normal;
24
26
  }
25
27
 
26
28
 
@@ -80,7 +82,7 @@ li {
80
82
  * Headings
81
83
  */
82
84
  h1, h2, h3, h4, h5, h6 {
83
- font-weight: 300;
85
+ font-weight: $base-font-weight;
84
86
  }
85
87
 
86
88
 
@@ -139,7 +141,7 @@ code {
139
141
 
140
142
  pre {
141
143
  padding: 8px 12px;
142
- overflow-x: scroll;
144
+ overflow-x: auto;
143
145
 
144
146
  > code {
145
147
  border: 0;
@@ -82,6 +82,11 @@
82
82
  .page-link {
83
83
  display: block;
84
84
  padding: 5px 10px;
85
+
86
+ &:not(:last-child) {
87
+ margin-right: 0;
88
+ }
89
+ margin-left: 20px;
85
90
  }
86
91
  }
87
92
  }
@@ -6,8 +6,9 @@
6
6
 
7
7
 
8
8
  // Our variables
9
- $base-font-family: Helvetica, Arial, sans-serif;
9
+ $base-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
10
10
  $base-font-size: 16px;
11
+ $base-font-weight: 300;
11
12
  $small-font-size: $base-font-size * 0.875;
12
13
  $base-line-height: 1.5;
13
14
 
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.0.0.pre.beta1
4
+ version: 3.0.0.pre.beta2
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: 2015-01-24 00:00:00.000000000 Z
11
+ date: 2015-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -81,89 +81,19 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.1'
83
83
  - !ruby/object:Gem::Dependency
84
- name: pygments.rb
84
+ name: rouge
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.6.0
89
+ version: '1.7'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.6.0
97
- - !ruby/object:Gem::Dependency
98
- name: redcarpet
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '3.1'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '3.1'
111
- - !ruby/object:Gem::Dependency
112
- name: toml
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 0.1.0
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 0.1.0
125
- - !ruby/object:Gem::Dependency
126
- name: jekyll-paginate
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '1.0'
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '1.0'
139
- - !ruby/object:Gem::Dependency
140
- name: jekyll-gist
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '1.0'
146
- type: :runtime
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '1.0'
153
- - !ruby/object:Gem::Dependency
154
- name: jekyll-coffeescript
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '1.0'
160
- type: :runtime
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: '1.0'
96
+ version: '1.7'
167
97
  - !ruby/object:Gem::Dependency
168
98
  name: jekyll-sass-converter
169
99
  requirement: !ruby/object:Gem::Requirement
@@ -192,20 +122,6 @@ dependencies:
192
122
  - - "~>"
193
123
  - !ruby/object:Gem::Version
194
124
  version: '1.1'
195
- - !ruby/object:Gem::Dependency
196
- name: classifier-reborn
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - "~>"
200
- - !ruby/object:Gem::Version
201
- version: '2.0'
202
- type: :runtime
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - "~>"
207
- - !ruby/object:Gem::Version
208
- version: '2.0'
209
125
  description: Jekyll is a simple, blog aware, static site generator.
210
126
  email: tom@mojombo.com
211
127
  executables:
@@ -306,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
306
222
  version: 1.3.1
307
223
  requirements: []
308
224
  rubyforge_project:
309
- rubygems_version: 2.4.5
225
+ rubygems_version: 2.2.2
310
226
  signing_key:
311
227
  specification_version: 2
312
228
  summary: A simple, blog aware, static site generator.