lib/octopress-ink/jekyll/hooks.rb in octopress-ink-1.0.0.rc.5 vs lib/octopress-ink/jekyll/hooks.rb in octopress-ink-1.0.0.rc.6
- old
+ new
@@ -16,17 +16,21 @@
if type == :post
self.data.merge! add_post_vars(self.data)
end
- if self.data['date']
- text = format_date(self.data['date'])
- xmlschema = datetime(self.data['date']).xmlschema
- html = date_html(text, xmlschema)
- self.data['date_xml'] = xmlschema
- self.data['date_html'] = html
+ if type == :page || type == :post
+ if self.data['date'] || self.respond_to?(:date)
+ the_date = self.data['date'] || self.date
+ text = format_date(the_date)
+ xmlschema = datetime(the_date).xmlschema
+ html = date_html(text, xmlschema)
+
+ self.data['date_xml'] = xmlschema
+ self.data['date_html'] = html
+ end
end
if self.data['updated']
text = format_date(self.data['updated'])
xmlschema = datetime(self.data['updated']).xmlschema
@@ -74,11 +78,11 @@
# Returns an ordidinal date eg July 22 2007 -> July 22nd 2007
def ordinalize(date)
date = datetime(date)
d = "<span class='date-month'>#{date.strftime('%b')}</span> "
- d = "<span class='date-day'>#{date.strftime('%e')}</span> "
+ d += "<span class='date-day'>#{date.strftime('%-d')}</span>"
d += "<span class='date-suffix'>#{ordinal_suffix(date)}</span>, "
d += "<span class='date-year'>#{date.strftime('%Y')}</span>"
end
# Returns an ordinal number. 13 -> 13th, 21 -> 21st etc.
@@ -118,13 +122,15 @@
marker = "<span class='post-marker post-marker-#{config['marker_position']}'>#{config['marker']}</span>"
position = config['marker_position']
if config['marker_position'] == 'before'
- "#{marker} #{title}"
+ title = "#{marker} #{title}"
else
- "#{title} #{marker}"
+ title = "#{title} #{marker}"
end
+
+ title
end
def title_text(config, title)
return title if !config['marker']
position = config['marker_position']