aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Mathis <brandon@imathis.com>2014-06-21 15:51:40 -0500
committerBrandon Mathis <brandon@imathis.com>2014-06-21 15:51:40 -0500
commita0229b2c9c1bb51bf6534bef528e6b2986c4064a (patch)
treef81ae6d75e93e50356c0ecc02ce570e429c2aaa6
parent72ea6042e33f0b92e4923c3af00e923f19472573 (diff)
downloadmy_new_personal_website-a0229b2c9c1bb51bf6534bef528e6b2986c4064a.tar.xz
my_new_personal_website-a0229b2c9c1bb51bf6534bef528e6b2986c4064a.zip
Replaced date plugin with jekyll-date-format
-rw-r--r--plugins/date.rb81
-rw-r--r--plugins/octopress_filters.rb1
2 files changed, 0 insertions, 82 deletions
diff --git a/plugins/date.rb b/plugins/date.rb
index 031e6736..e69de29b 100644
--- a/plugins/date.rb
+++ b/plugins/date.rb
@@ -1,81 +0,0 @@
-module Octopress
- module Date
-
- # Returns a datetime if the input is a string
- def datetime(date)
- if date.class == String
- date = Time.parse(date)
- end
- date
- end
-
- # Returns an ordidinal date eg July 22 2007 -> July 22nd 2007
- def ordinalize(date)
- date = datetime(date)
- "#{date.strftime('%b')} #{ordinal(date.strftime('%e').to_i)}, #{date.strftime('%Y')}"
- end
-
- # Returns an ordinal number. 13 -> 13th, 21 -> 21st etc.
- def ordinal(number)
- if (11..13).include?(number.to_i % 100)
- "#{number}<span>th</span>"
- else
- case number.to_i % 10
- when 1; "#{number}<span>st</span>"
- when 2; "#{number}<span>nd</span>"
- when 3; "#{number}<span>rd</span>"
- else "#{number}<span>th</span>"
- end
- end
- end
-
- # Formats date either as ordinal or by given date format
- # Adds %o as ordinal representation of the day
- def format_date(date, format)
- date = datetime(date)
- if format.nil? || format.empty? || format == "ordinal"
- date_formatted = ordinalize(date)
- else
- date_formatted = date.strftime(format)
- date_formatted.gsub!(/%o/, ordinal(date.strftime('%e').to_i))
- end
- date_formatted
- end
-
- # Returns the date-specific liquid attributes
- def liquid_date_attributes
- date_format = self.site.config['date_format']
- date_attributes = {}
- date_attributes['date_formatted'] = format_date(self.data['date'], date_format) if self.data.has_key?('date')
- date_attributes['updated_formatted'] = format_date(self.data['updated'], date_format) if self.data.has_key?('updated')
- date_attributes
- end
-
- end
-end
-
-
-module Jekyll
-
- class Post
- include Octopress::Date
-
- # Convert this Convertible's data to a Hash suitable for use by Liquid.
- # Overrides the default return data and adds any date-specific liquid attributes
- alias :super_to_liquid :to_liquid
- def to_liquid(attrs = nil)
- Utils.deep_merge_hashes super_to_liquid(attrs), liquid_date_attributes
- end
- end
-
- class Page
- include Octopress::Date
-
- # Convert this Convertible's data to a Hash suitable for use by Liquid.
- # Overrides the default return data and adds any date-specific liquid attributes
- alias :super_to_liquid :to_liquid
- def to_liquid(attrs = nil)
- Utils.deep_merge_hashes super_to_liquid(attrs), liquid_date_attributes
- end
- end
-end
diff --git a/plugins/octopress_filters.rb b/plugins/octopress_filters.rb
index d88cd639..aad5bf9f 100644
--- a/plugins/octopress_filters.rb
+++ b/plugins/octopress_filters.rb
@@ -39,7 +39,6 @@ end
module OctopressLiquidFilters
- include Octopress::Date
# Used on the blog index to split posts on the <!--more--> marker
def excerpt(input)