Skip to content

Instantly share code, notes, and snippets.

@mono0x
Created December 30, 2012 04:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mono0x/4410963 to your computer and use it in GitHub Desktop.
Save mono0x/4410963 to your computer and use it in GitHub Desktop.
require 'parallel'
module Jekyll
class Site
def render
payload = site_payload
self.posts.zip(Parallel.map(self.posts) {|post|
post.render(self.layouts, payload)
[ post.output, post.content ]
}).each do |post, result|
post.output = result[0]
post.content = result[1]
end
self.pages.zip(Parallel.map(self.pages) {|page|
page.render(self.layouts, payload)
[ page.output, page.content ]
}).each do |page, result|
page.output = result[0]
page.content = result[1]
end
self.categories.values.map { |ps| ps.sort! { |a, b| b <=> a } }
self.tags.values.map { |ps| ps.sort! { |a, b| b <=> a } }
rescue Errno::ENOENT => e
# ignore missing layout dir
end
def write
Parallel.each(self.posts + self.pages + self.static_files) do |item|
item.write(self.dest)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment