From 5b886e87046967999dbcf7f9509a60785e78266e Mon Sep 17 00:00:00 2001 From: Josh Dady Date: Thu, 25 Dec 2008 09:23:57 -0500 Subject: [PATCH 01/24] Added a strftime filter --- lib/jekyll/filters.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index 6051626a8ca..f3cd84706da 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -9,6 +9,10 @@ def date_to_long_string(date) date.strftime("%d %B %Y") end + def strftime(date, format = '%x') + date.strftime(format) + end + def date_to_xmlschema(date) date.xmlschema end From 863b0dd990b8b01ce9dbb9b1c00c9b1a061cf877 Mon Sep 17 00:00:00 2001 From: Josh Dady Date: Thu, 25 Dec 2008 09:31:33 -0500 Subject: [PATCH 02/24] Okay, I didn't really need to create a new filter --- lib/jekyll/filters.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index f3cd84706da..c05d8c67e79 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -1,18 +1,14 @@ module Jekyll module Filters - def date_to_string(date) - date.strftime("%d %b %Y") + def date_to_string(date, format="%d %b %Y") + date.strftime(format) end def date_to_long_string(date) date.strftime("%d %B %Y") end - def strftime(date, format = '%x') - date.strftime(format) - end - def date_to_xmlschema(date) date.xmlschema end From 340dd68ee5b579aabecdda82f04698bb5d727f57 Mon Sep 17 00:00:00 2001 From: Josh Dady Date: Thu, 25 Dec 2008 10:00:46 -0500 Subject: [PATCH 03/24] Didn't I try using standard Liquid filters first? --- lib/jekyll/filters.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index c05d8c67e79..6051626a8ca 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -1,8 +1,8 @@ module Jekyll module Filters - def date_to_string(date, format="%d %b %Y") - date.strftime(format) + def date_to_string(date) + date.strftime("%d %b %Y") end def date_to_long_string(date) From bac34fab3a27a12b35add1ecab409b19941e29a6 Mon Sep 17 00:00:00 2001 From: Josh Dady Date: Thu, 25 Dec 2008 13:49:56 -0500 Subject: [PATCH 04/24] Test and fix the site.categories hash --- lib/jekyll/site.rb | 11 ++++------- .../foo/_posts/bar/2008-12-12-topical-post.textile | 8 ++++++++ test/test_post.rb | 6 ++++++ test/test_site.rb | 7 +++++-- 4 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 test/source/foo/_posts/bar/2008-12-12-topical-post.textile diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 9c205431204..8238b803349 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -2,7 +2,7 @@ module Jekyll class Site attr_accessor :source, :dest - attr_accessor :layouts, :posts + attr_accessor :layouts, :posts, :categories # Initialize the site # +source+ is String path to the source directory containing @@ -16,6 +16,7 @@ def initialize(source, dest) self.dest = dest self.layouts = {} self.posts = [] + self.categories = Hash.new { |hash, key| hash[key] = Array.new } end # Do the actual work of processing the site and generating the @@ -63,6 +64,7 @@ def read_posts(dir) if Post.valid?(f) post = Post.new(self.source, dir, f) self.posts << post + post.categories.each { |c| self.categories[c] << post } end end @@ -72,6 +74,7 @@ def read_posts(dir) end self.posts.sort! + self.categories.values.map { |cats| cats.sort! { |a, b| b <=> a} } rescue Errno::ENOENT => e # ignore missing layout dir end @@ -133,12 +136,6 @@ def transform_pages(dir = '') # # Returns {"site" => {"time" =>