Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #890 from zachgersh/abbreviated_month

Added abbreviated month + test.
  • Loading branch information...
commit 483a0b68b6234e0b8d9a59b2bd61caa769536ce9 2 parents 8e18df5 + e931414
Parker Moore parkr authored
Showing with 12 additions and 0 deletions.
  1. +1 −0  lib/jekyll/post.rb
  2. +11 −0 test/test_post.rb
1  lib/jekyll/post.rb
View
@@ -169,6 +169,7 @@ def url
"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('/'),
+ "short_month" => date.strftime("%b"),
"output_ext" => self.output_ext
}.inject(template) { |result, token|
result.gsub(/:#{Regexp.escape token.first}/, token.last)
11 test/test_post.rb
View
@@ -225,6 +225,17 @@ def do_render(post)
end
end
+ context "with custom abbreviated month date permalink" do
+ setup do
+ @post.site.permalink_style = '/:categories/:year/:short_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"
Please sign in to comment.
Something went wrong with that request. Please try again.