Merge location data in events

This commit is contained in:
Stefan Schlott 2013-08-25 09:54:05 +02:00
parent 58a5b4b7d5
commit 73ece643ca
2 changed files with 14 additions and 0 deletions

1
Rules
View file

@ -3,6 +3,7 @@
preprocess do preprocess do
generate_archive_pages generate_archive_pages
generate_twitter_archive_pages generate_twitter_archive_pages
merge_location_data()
end end

13
lib/location.rb Normal file
View file

@ -0,0 +1,13 @@
def merge_item_location_data(location)
if (location && location[:location])
templates = @items['/_data/locations/'].attributes
if templates[location[:location].to_sym]
location.merge!(templates[location[:location].to_sym])
end
end
end
def merge_location_data()
items.select { |i| i[:kind] == 'event' }.each { |e| merge_item_location_data(e[:location]) }
end