From bad275b7bd1e25ed4bfe99c8f2e093323afc1543 Mon Sep 17 00:00:00 2001 From: Ryan Oglesby Date: Wed, 6 Jul 2016 15:36:23 -0500 Subject: [PATCH 1/2] Use correct pluralized words in Jekyll Hooks. Move 'pages' hook to be pre_render so that it has time to load the front matter. --- lib/octopress-date-format.rb | 6 +++- .../2014/07/03/welcome-to-jekyll.html | 2 -- test/_expected/index.html | 28 ++++++++----------- test/_expected/page.html | 2 -- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/lib/octopress-date-format.rb b/lib/octopress-date-format.rb index 1fbbba7..761e9dc 100644 --- a/lib/octopress-date-format.rb +++ b/lib/octopress-date-format.rb @@ -117,7 +117,11 @@ def datetime(input) DateFormat.config = site.config end - Jekyll::Hooks.register [:page, :post], :post_init do |item| + Jekyll::Hooks.register :posts, :pre_render do |item| + DateFormat.hack_date(item) + end + + Jekyll::Hooks.register :pages, :post_init do |item| DateFormat.hack_date(item) end else diff --git a/test/_expected/2014/07/03/welcome-to-jekyll.html b/test/_expected/2014/07/03/welcome-to-jekyll.html index 964d2ad..4eb42ef 100644 --- a/test/_expected/2014/07/03/welcome-to-jekyll.html +++ b/test/_expected/2014/07/03/welcome-to-jekyll.html @@ -1,6 +1,4 @@ - - ## Date - Date: 2014-07-03 14:08:00 +0000 - Formatted Date: Jul 3rd, 2014 diff --git a/test/_expected/index.html b/test/_expected/index.html index a246052..34d0443 100644 --- a/test/_expected/index.html +++ b/test/_expected/index.html @@ -1,7 +1,5 @@ - - ## Date - Date: 2014-07-03 14:08:00 +0000 - Formatted Date: Jul 3rd, 2014 @@ -12,17 +10,15 @@ ## Updated -- Date: 2014-07-03 15:03:15 +0000 -- Formatted Date: Jul 3rd, 2014 -- Formatted Time: 3:03 pm -- XML: 2014-07-03T15:03:15+00:00 -- HTML: -- Date Time HTML: - +- Date: 2014-07-04 16:03:05 +0000 +- Formatted Date: Jul 4th, 2014 +- Formatted Time: 4:03 pm +- XML: 2014-07-04T16:03:05+00:00 +- HTML: +- Date Time HTML: - ## Date - Date: 2014-07-03 14:08:00 +0000 @@ -34,12 +30,12 @@ ## Updated -- Date: 2014-07-04 16:03:05 +0000 -- Formatted Date: Jul 4th, 2014 -- Formatted Time: 4:03 pm -- XML: 2014-07-04T16:03:05+00:00 -- HTML: -- Date Time HTML: +- Date: 2014-07-03 15:03:15 +0000 +- Formatted Date: Jul 3rd, 2014 +- Formatted Time: 3:03 pm +- XML: 2014-07-03T15:03:15+00:00 +- HTML: +- Date Time HTML: diff --git a/test/_expected/page.html b/test/_expected/page.html index 3705930..e90df1e 100644 --- a/test/_expected/page.html +++ b/test/_expected/page.html @@ -1,6 +1,4 @@ - - ## Date - Date: 2013-08-16 14:08:15 +0000 - Formatted Date: Aug 16th, 2013 From 371248cc407391fe0f5e97f9764ee6c204f35801 Mon Sep 17 00:00:00 2001 From: Ryan Oglesby Date: Wed, 6 Jul 2016 15:49:34 -0500 Subject: [PATCH 2/2] Version bump to 3.0.4 for the bug fix --- lib/octopress-date-format/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/octopress-date-format/version.rb b/lib/octopress-date-format/version.rb index 73ca795..e8a1702 100644 --- a/lib/octopress-date-format/version.rb +++ b/lib/octopress-date-format/version.rb @@ -1,5 +1,5 @@ module Octopress module DateFormat - VERSION = "3.0.3" + VERSION = "3.0.4" end end