Permalink
Browse files

revert fix of vimberlin#15 and now fix it really

  • Loading branch information...
nougad committed Sep 20, 2013
1 parent dfd4e89 commit 54e4dc52217fbc6aff7ac9fabf1c2fffb3acafae
Showing with 13 additions and 7 deletions.
  1. +13 −7 _plugins/next_event_tag.rb
View
@@ -8,17 +8,23 @@ def initialize(tag_name, text, tokens)
def render(context)
next_event = context.registers[:site].posts
.select do |page| page.data['layout'] == 'event' end
.select do |page| Time.parse(page.data['when']) >= Time.now end
.sort_by do |page| page.data['when'] end
.first
loc = context.registers[:site].config['locations'][next_event.data['where']]
time = Time.parse(next_event.data['when']).strftime("%B, %eth %Y %l:%M %P")
# it doesn't support templates here :(
result = ""
result += "<a href='#{next_event.url}'>#{next_event.title}</a>:"
result += " #{time}"
result += " at <a href='#{loc["url"]}'>#{loc["name"]}</a>"
if next_event.nil? then
return "TBA"
else
loc = context.registers[:site].config['locations'][next_event.data['where']]
time = Time.parse(next_event.data['when']).strftime("%B, %eth %Y %l:%M %P")
# it doesn't support templates here :(
result = ""
result += "<a href='#{next_event.url}'>#{next_event.title}</a>:"
result += " #{time}"
result += " at <a href='#{loc["url"]}'>#{loc["name"]}</a>"
return result
end
end
end
end

0 comments on commit 54e4dc5

Please sign in to comment.