Clean up some code per @baweaver's suggestions.

This commit is contained in:
Parker Moore 2014-04-14 17:14:12 -04:00
parent ad7efb23e6
commit a1af95c34e
2 changed files with 6 additions and 8 deletions

View File

@ -60,16 +60,14 @@ module Jekyll
# #
# Returns the converted content. # Returns the converted content.
def convert(content) def convert(content)
output = content.dup converters.reduce(content) do |output, converter|
converters.each do |converter|
begin begin
output = converter.convert(output) converter.convert output
rescue => e rescue => e
Jekyll.logger.error "Conversion error:", "#{converter.class} encountered an error converting '#{document.relative_path}'." Jekyll.logger.error "Conversion error:", "#{converter.class} encountered an error converting '#{document.relative_path}'."
raise e raise e
end end
end end
output
end end
# Render the given content with the payload and info # Render the given content with the payload and info

View File

@ -395,14 +395,14 @@ module Jekyll
end end
def documents def documents
docs = Set.new collections.reduce(Set.new) do |docs, (label, coll)|
collections.each do |label, coll|
if to_render.include?(label) if to_render.include?(label)
docs = docs.merge(coll.docs) docs.merge(coll.docs)
end else
end
docs docs
end end
end
end
def each_site_file def each_site_file
%w(posts pages static_files documents).each do |type| %w(posts pages static_files documents).each do |type|