From 6657f2add9477daf035876b6b7d825ecd6ce5f93 Mon Sep 17 00:00:00 2001 From: zachgersh Date: Tue, 26 Mar 2013 23:04:42 -0700 Subject: [PATCH 1/2] Added abbreviated month + test. --- lib/jekyll/post.rb | 1 + test/test_post.rb | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 62c36d42..a124a8a8 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -169,6 +169,7 @@ module Jekyll "i_day" => date.strftime("%d").to_i.to_s, "i_month" => date.strftime("%m").to_i.to_s, "categories" => categories.map { |c| URI.escape(c.to_s) }.join('/'), + "abrv_month" => date.strftime("%b"), "output_ext" => self.output_ext }.inject(template) { |result, token| result.gsub(/:#{Regexp.escape token.first}/, token.last) diff --git a/test/test_post.rb b/test/test_post.rb index 5bff6e5e..63f68306 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -225,6 +225,17 @@ class TestPost < Test::Unit::TestCase end end + context "with custom abbreviated month date permalink" do + setup do + @post.site.permalink_style = '/:categories/:year/:abrv_month/:day/:title/' + @post.process(@fake_file) + end + + should "process the url correctly" do + assert_equal "/2008/Sep/09/foo-bar/", @post.url + end + end + context "with prefix style and no extension" do setup do @post.site.permalink_style = "/prefix/:title" From e931414b77078e7601c13f59342966c9247ec470 Mon Sep 17 00:00:00 2001 From: zachgersh Date: Wed, 27 Mar 2013 08:40:58 -0700 Subject: [PATCH 2/2] Changed to short_month and re-ran tests. --- lib/jekyll/post.rb | 2 +- test/test_post.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index a124a8a8..42350643 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -169,7 +169,7 @@ module Jekyll "i_day" => date.strftime("%d").to_i.to_s, "i_month" => date.strftime("%m").to_i.to_s, "categories" => categories.map { |c| URI.escape(c.to_s) }.join('/'), - "abrv_month" => date.strftime("%b"), + "short_month" => date.strftime("%b"), "output_ext" => self.output_ext }.inject(template) { |result, token| result.gsub(/:#{Regexp.escape token.first}/, token.last) diff --git a/test/test_post.rb b/test/test_post.rb index 63f68306..8a9721e4 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -227,7 +227,7 @@ class TestPost < Test::Unit::TestCase context "with custom abbreviated month date permalink" do setup do - @post.site.permalink_style = '/:categories/:year/:abrv_month/:day/:title/' + @post.site.permalink_style = '/:categories/:year/:short_month/:day/:title/' @post.process(@fake_file) end