Skip to content
This repository

Added abbreviated month + test. #890

Merged
merged 2 commits into from about 1 year ago

3 participants

Zach Matt Rogers Parker Moore
Zach

This is my stab at #410. Hopefully this helps us get to the 1.0 milestone! Know the change is relatively simple but if you need anything drop me a comment.

Matt Rogers

What do you think about using abbr_month for the key instead of abrv_month? I think that makes for a clearer key name.

Matt Rogers
Owner

:+1: from me. Would prefer to see my change to the key made before this is merged, but either way, I'm good with this.

Parker Moore
Owner
parkr commented March 27, 2013

I'd prefer something like short_month. @mojombo will probably have thoughts on this as well.

Zach

@parkr @mattr- figured the thing that would be most up for discussion was the naming convention :wink:

Thanks so much for the feedback! Let me know if this should be changed around again.

Zach

Any word on a merge for this guys? Already working on a separate commit for another issue I'd like to tackle!

Parker Moore parkr commented on the diff April 03, 2013
test/test_post.rb
@@ -225,6 +225,17 @@ def do_render(post)
225 225
           end
226 226
         end
227 227
 
  228
+        context "with custom abbreviated month date permalink" do
  229
+          setup do
  230
+            @post.site.permalink_style = '/:categories/:year/:short_month/:day/:title/'
  231
+            @post.process(@fake_file)
  232
+          end
  233
+
  234
+          should "process the url correctly" do
  235
+            assert_equal "/2008/Sep/09/foo-bar/", @post.url
1
Parker Moore Owner
parkr added a note April 03, 2013

Any reason you would prefer capitalized over lowercase?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Zach

I believe it's automatically returned capitalized. I have no preference either way and we could standardize on lowercase if that is the preferred way to go. Could set to lowercase and add another test to make sure the casing is always consistent?

Parker Moore
Owner
parkr commented April 03, 2013

Right, that's what I was thinking. I'm just not sure I like the lowercase version... Hm.

Do you have a preference? As you write your blog, would you prefer one or the other?

Zach

Personally, for me, I'd prefer the month's to stick to the capitalized abbreviation as that would be my expectation if I was going to abbreviate a month anywhere.

Parker Moore
Owner
parkr commented April 05, 2013

Ok capital it is!

Parker Moore parkr merged commit 483a0b6 into from April 05, 2013
Parker Moore parkr closed this April 05, 2013
Parker Moore parkr referenced this pull request from a commit April 05, 2013
Parker Moore Update history to reflect merge of #890 464ea6e
Parker Moore parkr referenced this pull request from a commit July 10, 2013
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Mar 26, 2013
Zach Added abbreviated month + test. 6657f2a
Mar 27, 2013
Zach Changed to short_month and re-ran tests. e931414
This page is out of date. Refresh to see the latest.
1  lib/jekyll/post.rb
@@ -169,6 +169,7 @@ def url
169 169
           "i_day"      => date.strftime("%d").to_i.to_s,
170 170
           "i_month"    => date.strftime("%m").to_i.to_s,
171 171
           "categories" => categories.map { |c| URI.escape(c.to_s) }.join('/'),
  172
+          "short_month" => date.strftime("%b"),
172 173
           "output_ext" => self.output_ext
173 174
         }.inject(template) { |result, token|
174 175
           result.gsub(/:#{Regexp.escape token.first}/, token.last)
11  test/test_post.rb
@@ -225,6 +225,17 @@ def do_render(post)
225 225
           end
226 226
         end
227 227
 
  228
+        context "with custom abbreviated month date permalink" do
  229
+          setup do
  230
+            @post.site.permalink_style = '/:categories/:year/:short_month/:day/:title/'
  231
+            @post.process(@fake_file)
  232
+          end
  233
+
  234
+          should "process the url correctly" do
  235
+            assert_equal "/2008/Sep/09/foo-bar/", @post.url
  236
+          end
  237
+        end
  238
+
228 239
         context "with prefix style and no extension" do
229 240
           setup do
230 241
             @post.site.permalink_style = "/prefix/:title"
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.