jekyll 3.2.0.pre.beta1 → 3.2.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.

Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +17 -95
  3. data/README.markdown +6 -4
  4. data/{bin → exe}/jekyll +18 -14
  5. data/lib/jekyll.rb +79 -76
  6. data/lib/jekyll/collection.rb +32 -16
  7. data/lib/jekyll/command.rb +17 -13
  8. data/lib/jekyll/commands/build.rb +7 -2
  9. data/lib/jekyll/commands/doctor.rb +3 -1
  10. data/lib/jekyll/commands/new.rb +3 -0
  11. data/lib/jekyll/commands/new_theme.rb +7 -4
  12. data/lib/jekyll/commands/serve.rb +2 -0
  13. data/lib/jekyll/commands/serve/servlet.rb +2 -2
  14. data/lib/jekyll/configuration.rb +187 -125
  15. data/lib/jekyll/converters/markdown.rb +19 -9
  16. data/lib/jekyll/converters/markdown/kramdown_parser.rb +12 -5
  17. data/lib/jekyll/converters/markdown/rdiscount_parser.rb +4 -4
  18. data/lib/jekyll/converters/markdown/redcarpet_parser.rb +90 -84
  19. data/lib/jekyll/convertible.rb +34 -21
  20. data/lib/jekyll/deprecator.rb +11 -6
  21. data/lib/jekyll/document.rb +52 -50
  22. data/lib/jekyll/drops/document_drop.rb +40 -5
  23. data/lib/jekyll/drops/drop.rb +49 -10
  24. data/lib/jekyll/drops/excerpt_drop.rb +15 -0
  25. data/lib/jekyll/drops/jekyll_drop.rb +12 -0
  26. data/lib/jekyll/drops/site_drop.rb +4 -2
  27. data/lib/jekyll/drops/url_drop.rb +4 -4
  28. data/lib/jekyll/entry_filter.rb +9 -6
  29. data/lib/jekyll/errors.rb +4 -3
  30. data/lib/jekyll/excerpt.rb +4 -6
  31. data/lib/jekyll/external.rb +4 -4
  32. data/lib/jekyll/filters.rb +67 -34
  33. data/lib/jekyll/frontmatter_defaults.rb +45 -38
  34. data/lib/jekyll/hooks.rb +21 -21
  35. data/lib/jekyll/layout.rb +3 -1
  36. data/lib/jekyll/liquid_renderer.rb +7 -3
  37. data/lib/jekyll/liquid_renderer/file.rb +1 -1
  38. data/lib/jekyll/liquid_renderer/table.rb +11 -11
  39. data/lib/jekyll/log_adapter.rb +2 -2
  40. data/lib/jekyll/page.rb +10 -10
  41. data/lib/jekyll/plugin.rb +5 -5
  42. data/lib/jekyll/plugin_manager.rb +12 -8
  43. data/lib/jekyll/publisher.rb +1 -1
  44. data/lib/jekyll/reader.rb +11 -7
  45. data/lib/jekyll/readers/data_reader.rb +9 -9
  46. data/lib/jekyll/readers/layout_reader.rb +7 -7
  47. data/lib/jekyll/readers/page_reader.rb +3 -1
  48. data/lib/jekyll/readers/post_reader.rb +9 -10
  49. data/lib/jekyll/readers/static_file_reader.rb +3 -1
  50. data/lib/jekyll/regenerator.rb +50 -28
  51. data/lib/jekyll/related_posts.rb +1 -1
  52. data/lib/jekyll/renderer.rb +29 -20
  53. data/lib/jekyll/site.rb +92 -50
  54. data/lib/jekyll/static_file.rb +33 -26
  55. data/lib/jekyll/stevenson.rb +6 -5
  56. data/lib/jekyll/tags/highlight.rb +50 -35
  57. data/lib/jekyll/tags/include.rb +42 -31
  58. data/lib/jekyll/tags/link.rb +11 -4
  59. data/lib/jekyll/tags/post_url.rb +8 -7
  60. data/lib/jekyll/theme.rb +4 -3
  61. data/lib/jekyll/theme_builder.rb +18 -6
  62. data/lib/jekyll/url.rb +21 -14
  63. data/lib/jekyll/utils.rb +57 -28
  64. data/lib/jekyll/utils/ansi.rb +9 -9
  65. data/lib/jekyll/utils/platforms.rb +2 -2
  66. data/lib/jekyll/version.rb +1 -1
  67. data/lib/site_template/_config.yml +2 -0
  68. data/lib/site_template/css/main.scss +3 -17
  69. data/lib/theme_template/_layouts/default.html +1 -0
  70. data/lib/theme_template/_layouts/page.html +5 -0
  71. data/lib/theme_template/_layouts/post.html +5 -0
  72. data/lib/theme_template/example/_post.md +1 -2
  73. data/lib/theme_template/example/index.html +2 -2
  74. data/lib/theme_template/gitignore.erb +4 -0
  75. data/lib/theme_template/theme.gemspec.erb +2 -6
  76. metadata +10 -18
  77. data/lib/site_template/_includes/footer.html +0 -38
  78. data/lib/site_template/_includes/head.html +0 -12
  79. data/lib/site_template/_includes/header.html +0 -27
  80. data/lib/site_template/_includes/icon-github.html +0 -1
  81. data/lib/site_template/_includes/icon-github.svg +0 -1
  82. data/lib/site_template/_includes/icon-twitter.html +0 -1
  83. data/lib/site_template/_includes/icon-twitter.svg +0 -1
  84. data/lib/site_template/_layouts/default.html +0 -20
  85. data/lib/site_template/_layouts/page.html +0 -14
  86. data/lib/site_template/_layouts/post.html +0 -15
  87. data/lib/site_template/_sass/_base.scss +0 -200
  88. data/lib/site_template/_sass/_layout.scss +0 -242
  89. data/lib/site_template/_sass/_syntax-highlighting.scss +0 -71
@@ -14,7 +14,9 @@ module Jekyll
14
14
  #
15
15
  # Returns an array of static pages.
16
16
  def read(files)
17
- files.map { |page| @unfiltered_content << Page.new(@site, @site.source, @dir, page) }
17
+ files.map do |page|
18
+ @unfiltered_content << Page.new(@site, @site.source, @dir, page)
19
+ end
18
20
  @unfiltered_content.select { |page| site.publisher.publish?(page) }
19
21
  end
20
22
  end
@@ -12,7 +12,7 @@ module Jekyll
12
12
  #
13
13
  # Returns nothing.
14
14
  def read_drafts(dir)
15
- read_publishable(dir, '_drafts', Document::DATELESS_FILENAME_MATCHER)
15
+ read_publishable(dir, "_drafts", Document::DATELESS_FILENAME_MATCHER)
16
16
  end
17
17
 
18
18
  # Read all the files in <source>/<dir>/_posts and create a new Document
@@ -22,7 +22,7 @@ module Jekyll
22
22
  #
23
23
  # Returns nothing.
24
24
  def read_posts(dir)
25
- read_publishable(dir, '_posts', Document::DATE_FILENAME_MATCHER)
25
+ read_publishable(dir, "_posts", Document::DATE_FILENAME_MATCHER)
26
26
  end
27
27
 
28
28
  # Read all the files in <source>/<dir>/<magic_dir> and create a new
@@ -32,15 +32,14 @@ module Jekyll
32
32
  #
33
33
  # Returns nothing.
34
34
  def read_publishable(dir, magic_dir, matcher)
35
- read_content(dir, magic_dir, matcher).tap do |docs|
36
- docs.each(&:read)
37
- end.select do |doc|
38
- site.publisher.publish?(doc).tap do |will_publish|
39
- if !will_publish && site.publisher.hidden_in_the_future?(doc)
40
- Jekyll.logger.debug "Skipping:", "#{doc.relative_path} has a future date"
35
+ read_content(dir, magic_dir, matcher).tap { |docs| docs.each(&:read) }
36
+ .select do |doc|
37
+ site.publisher.publish?(doc).tap do |will_publish|
38
+ if !will_publish && site.publisher.hidden_in_the_future?(doc)
39
+ Jekyll.logger.debug "Skipping:", "#{doc.relative_path} has a future date"
40
+ end
41
41
  end
42
42
  end
43
- end
44
43
  end
45
44
 
46
45
  # Read all the content files from <source>/<dir>/magic_dir
@@ -57,7 +56,7 @@ module Jekyll
57
56
  next unless entry =~ matcher
58
57
  path = @site.in_source_dir(File.join(dir, magic_dir, entry))
59
58
  Document.new(path, {
60
- :site => @site,
59
+ :site => @site,
61
60
  :collection => @site.posts
62
61
  })
63
62
  end.reject(&:nil?)
@@ -14,7 +14,9 @@ module Jekyll
14
14
  #
15
15
  # Returns an array of static files.
16
16
  def read(files)
17
- files.map { |file| @unfiltered_content << StaticFile.new(@site, @site.source, @dir, file) }
17
+ files.map do |file|
18
+ @unfiltered_content << StaticFile.new(@site, @site.source, @dir, file)
19
+ end
18
20
  @unfiltered_content
19
21
  end
20
22
  end
@@ -20,18 +20,14 @@ module Jekyll
20
20
  def regenerate?(document)
21
21
  case document
22
22
  when Page
23
- document.asset_file? || document.data['regenerate'] ||
24
- source_modified_or_dest_missing?(
25
- site.in_source_dir(document.relative_path), document.destination(@site.dest)
26
- )
23
+ regenerate_page?(document)
27
24
  when Document
28
- !document.write? || document.data['regenerate'] ||
29
- source_modified_or_dest_missing?(
30
- document.path, document.destination(@site.dest)
31
- )
25
+ regenerate_document?(document)
32
26
  else
33
- source_path = document.respond_to?(:path) ? document.path : nil
34
- dest_path = document.respond_to?(:destination) ? document.destination(@site.dest) : nil
27
+ source_path = document.respond_to?(:path) ? document.path : nil
28
+ dest_path = if document.respond_to?(:destination)
29
+ document.destination(@site.dest)
30
+ end
35
31
  source_modified_or_dest_missing?(source_path, dest_path)
36
32
  end
37
33
  end
@@ -44,7 +40,7 @@ module Jekyll
44
40
 
45
41
  metadata[path] = {
46
42
  "mtime" => File.mtime(path),
47
- "deps" => []
43
+ "deps" => []
48
44
  }
49
45
  cache[path] = true
50
46
  end
@@ -94,23 +90,14 @@ module Jekyll
94
90
  return cache[path]
95
91
  end
96
92
 
97
- # Check path that exists in metadata
98
- data = metadata[path]
99
- if data
100
- data["deps"].each do |dependency|
101
- if modified?(dependency)
102
- return cache[dependency] = cache[path] = true
103
- end
104
- end
105
- if File.exist?(path) && data["mtime"].eql?(File.mtime(path))
106
- return cache[path] = false
107
- else
108
- return add(path)
109
- end
93
+ if metadata[path]
94
+ # If we have seen this file before,
95
+ # check if it or one of its dependencies has been modified
96
+ existing_file_modified?(path)
97
+ else
98
+ # If we have not seen this file before, add it to the metadata and regenerate it
99
+ add(path)
110
100
  end
111
-
112
- # Path does not exist in metadata, add it
113
- return add(path)
114
101
  end
115
102
 
116
103
  # Add a dependency of a path
@@ -139,7 +126,7 @@ module Jekyll
139
126
  #
140
127
  # Returns the String path of the file.
141
128
  def metadata_file
142
- site.in_source_dir('.jekyll-metadata')
129
+ site.in_source_dir(".jekyll-metadata")
143
130
  end
144
131
 
145
132
  # Check if metadata has been disabled
@@ -173,5 +160,40 @@ module Jekyll
173
160
  {}
174
161
  end
175
162
  end
163
+
164
+ private
165
+ def regenerate_page?(document)
166
+ document.asset_file? || document.data["regenerate"] ||
167
+ source_modified_or_dest_missing?(
168
+ site.in_source_dir(document.relative_path), document.destination(@site.dest)
169
+ )
170
+ end
171
+
172
+ private
173
+ def regenerate_document?(document)
174
+ !document.write? || document.data["regenerate"] ||
175
+ source_modified_or_dest_missing?(
176
+ document.path, document.destination(@site.dest)
177
+ )
178
+ end
179
+
180
+ private
181
+ def existing_file_modified?(path)
182
+ # If one of this file dependencies have been modified,
183
+ # set the regeneration bit for both the dependency and the file to true
184
+ metadata[path]["deps"].each do |dependency|
185
+ if modified?(dependency)
186
+ return cache[dependency] = cache[path] = true
187
+ end
188
+ end
189
+
190
+ if File.exist?(path) && metadata[path]["mtime"].eql?(File.mtime(path))
191
+ # If this file has not been modified, set the regeneration bit to false
192
+ cache[path] = false
193
+ else
194
+ # If it has been modified, set it to true
195
+ add(path)
196
+ end
197
+ end
176
198
  end
177
199
  end
@@ -9,7 +9,7 @@ module Jekyll
9
9
  def initialize(post)
10
10
  @post = post
11
11
  @site = post.site
12
- Jekyll::External.require_with_graceful_fail('classifier-reborn') if site.lsi
12
+ Jekyll::External.require_with_graceful_fail("classifier-reborn") if site.lsi
13
13
  end
14
14
 
15
15
  def build
@@ -38,21 +38,21 @@ module Jekyll
38
38
  payload["paginator"] = document.pager.to_liquid
39
39
  end
40
40
 
41
- if document.is_a?(Document) && document.collection.label == 'posts'
42
- payload['site']['related_posts'] = document.related_posts
41
+ if document.is_a?(Document) && document.collection.label == "posts"
42
+ payload["site"]["related_posts"] = document.related_posts
43
43
  else
44
- payload['site']['related_posts'] = nil
44
+ payload["site"]["related_posts"] = nil
45
45
  end
46
46
 
47
47
  # render and transform content (this becomes the final content of the object)
48
- payload['highlighter_prefix'] = converters.first.highlighter_prefix
49
- payload['highlighter_suffix'] = converters.first.highlighter_suffix
48
+ payload["highlighter_prefix"] = converters.first.highlighter_prefix
49
+ payload["highlighter_suffix"] = converters.first.highlighter_suffix
50
50
 
51
51
  Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path
52
52
  document.trigger_hooks(:pre_render, payload)
53
53
 
54
54
  info = {
55
- :registers => { :site => site, :page => payload['page'] }
55
+ :registers => { :site => site, :page => payload["page"] }
56
56
  }
57
57
 
58
58
  output = document.content
@@ -88,7 +88,9 @@ module Jekyll
88
88
  begin
89
89
  converter.convert output
90
90
  rescue => e
91
- Jekyll.logger.error "Conversion error:", "#{converter.class} encountered an error while converting '#{document.relative_path}':"
91
+ Jekyll.logger.error "Conversion error:",
92
+ "#{converter.class} encountered an error while "\
93
+ "converting '#{document.relative_path}':"
92
94
  Jekyll.logger.error("", e.to_s)
93
95
  raise e
94
96
  end
@@ -106,12 +108,16 @@ module Jekyll
106
108
  def render_liquid(content, payload, info, path = nil)
107
109
  site.liquid_renderer.file(path).parse(content).render!(payload, info)
108
110
  rescue Tags::IncludeTagError => e
109
- Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}, included in #{path || document.relative_path}"
111
+ Jekyll.logger.error "Liquid Exception:",
112
+ "#{e.message} in #{e.path}, included in #{path || document.relative_path}"
110
113
  raise e
114
+ # rubocop: disable RescueException
111
115
  rescue Exception => e
112
- Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{path || document.relative_path}"
116
+ Jekyll.logger.error "Liquid Exception:",
117
+ "#{e.message} in #{path || document.relative_path}"
113
118
  raise e
114
119
  end
120
+ # rubocop: enable RescueException
115
121
 
116
122
  # Checks if the layout specified in the document actually exists
117
123
  #
@@ -132,14 +138,20 @@ module Jekyll
132
138
  output = content.dup
133
139
  layout = site.layouts[document.data["layout"]]
134
140
 
135
- Jekyll.logger.warn("Build Warning:", "Layout '#{document.data["layout"]}' requested in #{document.relative_path} does not exist.") if invalid_layout? layout
141
+ Jekyll.logger.warn(
142
+ "Build Warning:",
143
+ "Layout '#{document.data["layout"]}' requested in "\
144
+ "#{document.relative_path} does not exist."
145
+ ) if invalid_layout? layout
136
146
 
137
- used = Set.new([layout])
147
+ used = Set.new([layout])
148
+
149
+ # Reset the payload layout data to ensure it starts fresh for each page.
150
+ payload["layout"] = nil
138
151
 
139
152
  while layout
140
- payload['content'] = output
141
- payload['page'] = document.to_liquid
142
- payload['layout'] = Utils.deep_merge_hashes(payload['layout'] || {}, layout.data)
153
+ payload["content"] = output
154
+ payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
143
155
 
144
156
  output = render_liquid(
145
157
  layout.content,
@@ -154,12 +166,9 @@ module Jekyll
154
166
  site.in_source_dir(layout.path)
155
167
  ) if document.write?
156
168
 
157
- if layout = site.layouts[layout.data["layout"]]
158
- if used.include?(layout)
159
- layout = nil # avoid recursive chain
160
- else
161
- used << layout
162
- end
169
+ if (layout = site.layouts[layout.data["layout"]])
170
+ break if used.include?(layout)
171
+ used << layout
163
172
  end
164
173
  end
165
174
 
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
- require 'csv'
2
+ require "csv"
3
3
 
4
4
  module Jekyll
5
5
  class Site
@@ -18,8 +18,8 @@ module Jekyll
18
18
  # config - A Hash containing site configuration details.
19
19
  def initialize(config)
20
20
  # Source and destination may not be changed after the site has been created.
21
- @source = File.expand_path(config['source']).freeze
22
- @dest = File.expand_path(config['destination']).freeze
21
+ @source = File.expand_path(config["source"]).freeze
22
+ @dest = File.expand_path(config["destination"]).freeze
23
23
 
24
24
  self.config = config
25
25
 
@@ -29,10 +29,10 @@ module Jekyll
29
29
 
30
30
  Jekyll.sites << self
31
31
 
32
- Jekyll::Hooks.trigger :site, :after_init, self
33
-
34
32
  reset
35
33
  setup
34
+
35
+ Jekyll::Hooks.trigger :site, :after_init, self
36
36
  end
37
37
 
38
38
  # Public: Set the site's configuration. This handles side-effects caused by
@@ -49,19 +49,12 @@ module Jekyll
49
49
  self.send("#{opt}=", config[opt])
50
50
  end
51
51
 
52
- self.plugin_manager = Jekyll::PluginManager.new(self)
53
- self.plugins = plugin_manager.plugins_path
52
+ configure_plugins
53
+ configure_theme
54
+ configure_include_paths
55
+ configure_file_read_opts
54
56
 
55
- self.theme = nil
56
- self.theme = Jekyll::Theme.new(config["theme"]) if config["theme"]
57
-
58
- @includes_load_paths = Array(in_source_dir(config["includes_dir"].to_s))
59
- @includes_load_paths << theme.includes_path if self.theme
60
-
61
- self.file_read_opts = {}
62
- self.file_read_opts[:encoding] = config['encoding'] if config['encoding']
63
-
64
- self.permalink_style = config['permalink'].to_sym
57
+ self.permalink_style = config["permalink"].to_sym
65
58
 
66
59
  @config
67
60
  end
@@ -80,7 +73,7 @@ module Jekyll
80
73
  end
81
74
 
82
75
  def print_stats
83
- if @config['profile']
76
+ if @config["profile"]
84
77
  puts @liquid_renderer.stats_table
85
78
  end
86
79
  end
@@ -89,7 +82,11 @@ module Jekyll
89
82
  #
90
83
  # Returns nothing
91
84
  def reset
92
- self.time = (config['time'] ? Utils.parse_date(config['time'].to_s, "Invalid time in _config.yml.") : Time.now)
85
+ if config["time"]
86
+ self.time = Utils.parse_date(config["time"].to_s, "Invalid time in _config.yml.")
87
+ else
88
+ self.time = Time.now
89
+ end
93
90
  self.layouts = {}
94
91
  self.pages = []
95
92
  self.static_files = []
@@ -123,18 +120,23 @@ module Jekyll
123
120
  dest_pathname = Pathname.new(dest)
124
121
  Pathname.new(source).ascend do |path|
125
122
  if path == dest_pathname
126
- raise Errors::FatalException.new "Destination directory cannot be or contain the Source directory."
123
+ raise(
124
+ Errors::FatalException,
125
+ "Destination directory cannot be or contain the Source directory."
126
+ )
127
127
  end
128
128
  end
129
129
  end
130
130
 
131
131
  # The list of collections and their corresponding Jekyll::Collection instances.
132
- # If config['collections'] is set, a new instance is created for each item in the collection.
133
- # If config['collections'] is not set, a new hash is returned.
132
+ # If config['collections'] is set, a new instance is created
133
+ # for each item in the collection, a new hash is returned otherwise.
134
134
  #
135
135
  # Returns a Hash containing collection name-to-instance pairs.
136
136
  def collections
137
- @collections ||= Hash[collection_names.map { |coll| [coll, Jekyll::Collection.new(self, coll)] } ]
137
+ @collections ||= Hash[collection_names.map do |coll|
138
+ [coll, Jekyll::Collection.new(self, coll)]
139
+ end]
138
140
  end
139
141
 
140
142
  # The list of collection names.
@@ -142,11 +144,11 @@ module Jekyll
142
144
  # Returns an array of collection names from the configuration,
143
145
  # or an empty array if the `collections` key is not set.
144
146
  def collection_names
145
- case config['collections']
147
+ case config["collections"]
146
148
  when Hash
147
- config['collections'].keys
149
+ config["collections"].keys
148
150
  when Array
149
- config['collections']
151
+ config["collections"]
150
152
  when nil
151
153
  []
152
154
  else
@@ -168,7 +170,9 @@ module Jekyll
168
170
  # Returns nothing.
169
171
  def generate
170
172
  generators.each do |generator|
173
+ start = Time.now
171
174
  generator.generate(self)
175
+ Jekyll.logger.debug "Generating:", "#{generator.class} finished in #{Time.now - start} seconds."
172
176
  end
173
177
  end
174
178
 
@@ -182,26 +186,15 @@ module Jekyll
182
186
 
183
187
  Jekyll::Hooks.trigger :site, :pre_render, self, payload
184
188
 
185
- collections.each do |_, collection|
186
- collection.docs.each do |document|
187
- if regenerator.regenerate?(document)
188
- document.output = Jekyll::Renderer.new(self, document, payload).run
189
- document.trigger_hooks(:post_render)
190
- end
191
- end
192
- end
193
-
194
- pages.flatten.each do |page|
195
- if regenerator.regenerate?(page)
196
- page.output = Jekyll::Renderer.new(self, page, payload).run
197
- page.trigger_hooks(:post_render)
198
- end
199
- end
189
+ render_docs(payload)
190
+ render_pages(payload)
200
191
 
201
192
  Jekyll::Hooks.trigger :site, :post_render, self, payload
193
+ # rubocop: disable HandleExceptions
202
194
  rescue Errno::ENOENT
203
195
  # ignore missing layout dir
204
196
  end
197
+ # rubocop: enable HandleExceptions
205
198
 
206
199
  # Remove orphaned files and empty directories in destination.
207
200
  #
@@ -222,7 +215,7 @@ module Jekyll
222
215
  end
223
216
 
224
217
  def posts
225
- collections['posts'] ||= Collection.new(self, 'posts')
218
+ collections["posts"] ||= Collection.new(self, "posts")
226
219
  end
227
220
 
228
221
  # Construct a Hash of Posts indexed by the specified Post attribute.
@@ -242,17 +235,19 @@ module Jekyll
242
235
  # Build a hash map based on the specified post attribute ( post attr =>
243
236
  # array of posts ) then sort each array in reverse order.
244
237
  hash = Hash.new { |h, key| h[key] = [] }
245
- posts.docs.each { |p| p.data[post_attr].each { |t| hash[t] << p } if p.data[post_attr] }
238
+ posts.docs.each do |p|
239
+ p.data[post_attr].each { |t| hash[t] << p } if p.data[post_attr]
240
+ end
246
241
  hash.values.each { |posts| posts.sort!.reverse! }
247
242
  hash
248
243
  end
249
244
 
250
245
  def tags
251
- post_attr_hash('tags')
246
+ post_attr_hash("tags")
252
247
  end
253
248
 
254
249
  def categories
255
- post_attr_hash('categories')
250
+ post_attr_hash("categories")
256
251
  end
257
252
 
258
253
  # Prepare site data for site payload. The method maintains backward compatibility
@@ -260,7 +255,7 @@ module Jekyll
260
255
  #
261
256
  # Returns the Hash to be hooked to site.data.
262
257
  def site_data
263
- config['data'] || data
258
+ config["data"] || data
264
259
  end
265
260
 
266
261
  # The Hash payload containing site-wide data.
@@ -279,6 +274,7 @@ module Jekyll
279
274
  def site_payload
280
275
  Drops::UnifiedPayloadDrop.new self
281
276
  end
277
+ alias_method :to_liquid, :site_payload
282
278
 
283
279
  # Get the implementation class for the given Converter.
284
280
  # Returns the Converter instance implementing the given Converter.
@@ -305,7 +301,7 @@ module Jekyll
305
301
  #
306
302
  # Returns
307
303
  def relative_permalinks_are_deprecated
308
- if config['relative_permalinks']
304
+ if config["relative_permalinks"]
309
305
  Jekyll.logger.abort_with "Since v3.0, permalinks for pages" \
310
306
  " in subfolders must be relative to the" \
311
307
  " site source directory, not the parent" \
@@ -350,7 +346,7 @@ module Jekyll
350
346
  #
351
347
  # Returns a Boolean: true for a full rebuild, false for normal build
352
348
  def incremental?(override = {})
353
- override['incremental'] || config['incremental']
349
+ override["incremental"] || config["incremental"]
354
350
  end
355
351
 
356
352
  # Returns the publisher or creates a new publisher if it doesn't
@@ -398,11 +394,10 @@ module Jekyll
398
394
  end
399
395
  end
400
396
 
401
- private
402
-
403
397
  # Limits the current posts; removes the posts which exceed the limit_posts
404
398
  #
405
399
  # Returns nothing
400
+ private
406
401
  def limit_posts!
407
402
  if limit_posts > 0
408
403
  limit = posts.docs.length < limit_posts ? posts.docs.length : limit_posts
@@ -414,8 +409,55 @@ module Jekyll
414
409
  # already exist.
415
410
  #
416
411
  # Returns The Cleaner
412
+ private
417
413
  def site_cleaner
418
414
  @site_cleaner ||= Cleaner.new(self)
419
415
  end
416
+
417
+ private
418
+ def configure_plugins
419
+ self.plugin_manager = Jekyll::PluginManager.new(self)
420
+ self.plugins = plugin_manager.plugins_path
421
+ end
422
+
423
+ private
424
+ def configure_theme
425
+ self.theme = nil
426
+ self.theme = Jekyll::Theme.new(config["theme"]) if config["theme"]
427
+ end
428
+
429
+ private
430
+ def configure_include_paths
431
+ @includes_load_paths = Array(in_source_dir(config["includes_dir"].to_s))
432
+ @includes_load_paths << theme.includes_path if self.theme
433
+ end
434
+
435
+ private
436
+ def configure_file_read_opts
437
+ self.file_read_opts = {}
438
+ self.file_read_opts[:encoding] = config["encoding"] if config["encoding"]
439
+ end
440
+
441
+ private
442
+ def render_docs(payload)
443
+ collections.each do |_, collection|
444
+ collection.docs.each do |document|
445
+ if regenerator.regenerate?(document)
446
+ document.output = Jekyll::Renderer.new(self, document, payload).run
447
+ document.trigger_hooks(:post_render)
448
+ end
449
+ end
450
+ end
451
+ end
452
+
453
+ private
454
+ def render_pages(payload)
455
+ pages.flatten.each do |page|
456
+ if regenerator.regenerate?(page)
457
+ page.output = Jekyll::Renderer.new(self, page, payload).run
458
+ page.trigger_hooks(:post_render)
459
+ end
460
+ end
461
+ end
420
462
  end
421
463
  end