lib/jekyll/site.rb in mojombo-jekyll-0.5.0 vs lib/jekyll/site.rb in mojombo-jekyll-0.5.1

- old
+ new

@@ -1,9 +1,9 @@ module Jekyll class Site - attr_accessor :config, :layouts, :posts, :categories + attr_accessor :config, :layouts, :posts, :categories, :exclude attr_accessor :source, :dest, :lsi, :pygments, :permalink_style # Initialize the site # +config+ is a Hash containing site configurations details # @@ -14,10 +14,11 @@ self.source = config['source'] self.dest = config['destination'] self.lsi = config['lsi'] self.pygments = config['pygments'] self.permalink_style = config['permalink'].to_sym + self.exclude = config['exclude'] || [] self.reset self.setup end @@ -39,11 +40,10 @@ def markdown(content) RDiscount.new(content).to_html end - puts 'Using rdiscount for Markdown' rescue LoadError puts 'You must have the rdiscount gem installed first' end when 'maruku' begin @@ -128,16 +128,17 @@ post.categories.each { |c| self.categories[c] << post } end end end + self.posts.sort! + # second pass renders each post now that full site payload is available self.posts.each do |post| post.render(self.layouts, site_payload) end - self.posts.sort! self.categories.values.map { |cats| cats.sort! { |a, b| b <=> a} } rescue Errno::ENOENT => e # ignore missing layout dir end @@ -226,13 +227,11 @@ # unless they are "_posts" directories or web server files such as # '.htaccess' def filter_entries(entries) entries = entries.reject do |e| unless ['_posts', '.htaccess'].include?(e) - # Reject backup/hidden - ['.', '_', '#'].include?(e[0..0]) or e[-1..-1] == '~' + ['.', '_', '#'].include?(e[0..0]) || e[-1..-1] == '~' || self.exclude.include?(e) end end end - end end