| ... | ... |
@@ -11,6 +11,7 @@ simple_search: http://google.com/search |
| 11 | 11 |
# Default date format is "ordinal" (resulting in "July 22nd 2007") |
| 12 | 12 |
# You can customize the format as defined in |
| 13 | 13 |
# http://www.ruby-doc.org/core-1.9.2/Time.html#method-i-strftime |
| 14 |
+# Additionally, %o will give you the ordinal representation of the day |
|
| 14 | 15 |
date_format: "ordinal" |
| 15 | 16 |
|
| 16 | 17 |
# RSS / Email (optional) subscription links (change if using something like Feedburner) |
| ... | ... |
@@ -92,6 +93,6 @@ disqus_show_comment_count: false |
| 92 | 92 |
|
| 93 | 93 |
# Google Analytics |
| 94 | 94 |
google_analytics_tracking_id: |
| 95 |
- |
|
| 95 |
+ |
|
| 96 | 96 |
# Facebook Like |
| 97 |
-facebook_like: true |
|
| 97 |
+facebook_like: true |
| ... | ... |
@@ -29,12 +29,16 @@ module Octopress |
| 29 | 29 |
end |
| 30 | 30 |
end |
| 31 | 31 |
|
| 32 |
+ # Formats date either as ordinal or by given date format |
|
| 33 |
+ # Adds %o as ordinal representation of the day |
|
| 32 | 34 |
def format_date(date, format) |
| 33 | 35 |
date = datetime(date) |
| 34 | 36 |
if format.nil? || format.empty? || format == "ordinal" |
| 35 | 37 |
date_formatted = ordinalize(date) |
| 36 | 38 |
else |
| 39 |
+ format.gsub!(/%o/, '%%o') |
|
| 37 | 40 |
date_formatted = date.strftime(format) |
| 41 |
+ date_formatted.gsub!(/%o/, ordinal(date.strftime('%e').to_i))
|
|
| 38 | 42 |
end |
| 39 | 43 |
date_formatted |
| 40 | 44 |
end |