From 3db77d4afa6729bd8cc9bb349797a8d3b953ba08 Mon Sep 17 00:00:00 2001 From: Stefan Schlott Date: Tue, 27 Aug 2013 20:28:20 +0200 Subject: [PATCH] ical export --- Gemfile | 1 + Gemfile.lock | 2 ++ Rules | 8 ++++++++ content/ical.txt | 28 ++++++++++++++++++++++++++++ content/index.html | 2 +- 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 content/ical.txt diff --git a/Gemfile b/Gemfile index 833bb246..a959447a 100644 --- a/Gemfile +++ b/Gemfile @@ -11,4 +11,5 @@ gem 'rdiscount' gem 't' gem 'nokogiri' gem 'feedzirra' +gem 'ri_cal' diff --git a/Gemfile.lock b/Gemfile.lock index f8d795bb..0ecd68d1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -94,6 +94,7 @@ GEM rdoc (3.12.2) json (~> 1.4) retryable (1.3.2) + ri_cal (0.8.8) sass (3.2.10) sax-machine (0.1.0) nokogiri (> 0.0.0) @@ -135,6 +136,7 @@ DEPENDENCIES nanoc3 nokogiri rdiscount + ri_cal sass systemu t diff --git a/Rules b/Rules index 211bc92d..35ed53e7 100644 --- a/Rules +++ b/Rules @@ -28,6 +28,10 @@ compile '/styles/*' do end end +compile "/ical" do + filter :erb +end + compile "/htaccess" do filter :erb end @@ -73,6 +77,10 @@ route '/styles/*' do item.identifier.chop + '.css' end +route "/ical" do + "/cccs.ical" +end + route "/htaccess" do "/.htaccess" end diff --git a/content/ical.txt b/content/ical.txt new file mode 100644 index 00000000..313b36ce --- /dev/null +++ b/content/ical.txt @@ -0,0 +1,28 @@ +<% require 'ri_cal' + +upcomingEvents = get_public_events().select { |e| e[:startdate].to_datetime > DateTime.now } +upcomingEvents.sort! { |a,b| a[:startdate].to_datetime <=> b[:startdate].to_datetime } + +cal = RiCal.Calendar do |cal| + upcomingEvents.each do |e| + cal.event do |event| + event.summary = e[:title] + event.description = "" + event.dtstart = e[:startdate] + event.dtend = e[:enddate] + if e[:location] + if e[:location][:details] + event.location = "#{e[:location][:name]}, #{e[:location][:details]}" + else + event.location = e[:location][:name] + end + end + if e[:url] + event.url = e[:url] + elsif e.identifier.start_with?('/events') + event.url = e.path + end + end + end +end +%><%= cal.to_s %> diff --git a/content/index.html b/content/index.html index 2784969a..20a2067c 100644 --- a/content/index.html +++ b/content/index.html @@ -21,7 +21,7 @@ feed: stehen die Termine von uns veranstalteter Aktionen. Zusätzlich sind wir mitunter bei fremden Veranstaltungen eingeladen, die findest Du unter Aktivitäten (möglicherweise sind nicht alle öffentlich). - Du kannst all diese Termine auch per ical abonnieren. + Du kannst all diese Termine auch per ical abonnieren.

Aktuelle Informationen? Unten auf der Seite stehen blog-artig Artikel und Notizen. Wenn Du diese automatisch beziehen möchtest, kannst