iCal-Support
Elementreihenfolge im RSS korrigiert git-svn-id: svn://svn.c3d2.de/c3d2-web/trunk@510 31f61c52-7bfb-0310-b897-fc00f8a278f0
This commit is contained in:
parent
bffd988202
commit
fed533415e
5
Makefile
5
Makefile
|
@ -46,7 +46,7 @@ PAGES:=$(patsubst content/pages/%.xml, build/%.html, $(wildcard content/pages/*.
|
|||
# Seiten zu einzelnen News-Items:
|
||||
NEWS_PAGES:=$(patsubst content/news/%.xml, build/news/%.html, $(wildcard content/news/*.xml))
|
||||
# News-Index und Feeds:
|
||||
NEWSFILES:=build/news.html build/news-rss.xml build/news-atom.xml build/xcal.xml
|
||||
NEWSFILES:=build/news.html build/news-rss.xml build/news-atom.xml build/xcal.xml build/ical.ics
|
||||
# Datenspuren-Seiten:
|
||||
DS_PAGES:=$(patsubst content/datenspuren/%.xml, build/datenspuren/%.html, $(wildcard content/datenspuren/*.xml)) build/datenspuren/schedule.html
|
||||
# Suchseiten-Template
|
||||
|
@ -84,6 +84,9 @@ build/news-atom.xml : STYLE=xsl/atom.xsl
|
|||
build/news-atom.xml : NOVALID_IGNORE:=true
|
||||
build/news-atom.xml : VFLAGS_OUT=--noout --relaxng xsd/atom.rng
|
||||
build/xcal.xml : STYLE=xsl/xcal.xsl
|
||||
build/ical.ics : STYLE=xsl/ical.xsl
|
||||
build/ical.ics : NOVALID_IGNORE:=true
|
||||
build/ical.ics : VFLAGS_OUT=--noout
|
||||
|
||||
#.INTERMEDIATE: news.xml
|
||||
news.xml: $(NEWSITEMS)
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:date="http://exslt.org/dates-and-times"
|
||||
xmlns:crypto="http://exslt.org/crypto"
|
||||
>
|
||||
|
||||
<xsl:output method="text" encoding="utf-8"/>
|
||||
|
||||
<xsl:include href="date.xsl"/>
|
||||
|
||||
<xsl:variable name="baseurl">https://www.c3d2.de/</xsl:variable>
|
||||
|
||||
<xsl:template match="news">
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>BEGIN:VCALENDAR</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>VERSION:2.0</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>PRODID:-//C3D2-Web//event iCal-Export//DE</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>CALSCALE:GREGORIAN</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>METHOD:PUBLISH</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>X-WR-CALDESC;VALUE=TEXT:Events und Themenabende beim CCC Dresden</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>X-WR-CALNAME;VALUE=TEXT:C3D2-Events</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>X-WR-TIMEZONE;VALUE=TEXT:Europe/Berlin</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:for-each select="newsfile">
|
||||
<xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" />
|
||||
|
||||
<xsl:if test="document(.)/item/event">
|
||||
<xsl:apply-templates select="document(.)/item">
|
||||
<xsl:with-param name="newsfile" select="."/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:for-each>
|
||||
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:text>END:VCALENDAR</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item">
|
||||
<xsl:param name="newsfile"/>
|
||||
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>BEGIN:VEVENT</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>METHOD:PUBLISH</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>UID:</xsl:text>
|
||||
<xsl:value-of select="crypto:sha1(concat(@title,@date))"/>
|
||||
<xsl:text>@www.c3d2.de</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>DTSTAMP:</xsl:text>
|
||||
<xsl:call-template name="date-to-hevent">
|
||||
<xsl:with-param name="date" select="@date"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>DTSTART:</xsl:text>
|
||||
<xsl:call-template name="date-to-hevent">
|
||||
<xsl:with-param name="date" select="event/start"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:if test="event/end">
|
||||
<xsl:text>DTEND:</xsl:text>
|
||||
<xsl:call-template name="date-to-hevent">
|
||||
<xsl:with-param name="date" select="event/end"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:call-template name="wrap-text">
|
||||
<xsl:with-param name="text">SUMMARY:<xsl:value-of select="@title"/></xsl:with-param>
|
||||
<xsl:with-param name="length" select="70"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>CLASS:PUBLIC</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>CATEGORY:</xsl:text>
|
||||
<xsl:value-of select="@category"/>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>URL:</xsl:text>
|
||||
<xsl:value-of select="$baseurl"/>
|
||||
<xsl:value-of select="substring-after(substring-before($newsfile, '.xml'), 'content/')"/>
|
||||
<xsl:text>.html</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:call-template name="wrap-text">
|
||||
<xsl:with-param name="text">LOCATION:<xsl:value-of select="event/location"/></xsl:with-param>
|
||||
<xsl:with-param name="length" select="70"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:text>END:VEVENT</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- Copy left by Tim Pritlove -->
|
||||
<xsl:template name="wrap-text">
|
||||
<xsl:param name="text" />
|
||||
<xsl:param name="length" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($text) > $length">
|
||||
<xsl:value-of select="substring($text, 0, $length)" />
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:call-template name="wrap-text">
|
||||
<xsl:with-param name="text" select="substring($text, $length)" />
|
||||
<xsl:with-param name="length" select="$length" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$text" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
|
@ -48,11 +48,11 @@
|
|||
|
||||
<title><xsl:value-of select="@title"/></title>
|
||||
<description><xsl:apply-templates mode="escaped"/></description>
|
||||
|
||||
<guid isPermaLink="true"><xsl:value-of select="$href"/></guid>
|
||||
<link><xsl:value-of select="$href"/></link>
|
||||
<author><xsl:value-of select="@author"/></author>
|
||||
<category><xsl:value-of select="@category"/></category>
|
||||
<guid isPermaLink="true"><xsl:value-of select="$href"/></guid>
|
||||
|
||||
<pubDate>
|
||||
<xsl:call-template name="date-to-rfc822">
|
||||
<xsl:with-param name="date" select="@date"/>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<xsl:template match="news">
|
||||
<iCalendar>
|
||||
<vcalendar method="PUBLISH" version="2.0" prodid="-//HandGen//NONSGML vGen v1.0//EN">
|
||||
<vcalendar method="PUBLISH" version="2.0" prodid="-//C3D2-Web//event iCal-Export//DE">
|
||||
<xsl:for-each select="newsfile">
|
||||
<xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" />
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@
|
|||
</xsl:for-each>
|
||||
|
||||
<p>
|
||||
Die Neuigkeiten des C3D2 sind auch als <a href="{$baseurl}news-atom.xml">ATOM</a> und <a href="{$baseurl}news-rss.xml">RSS</a>, die Veranstaltungen als <a href="{$baseurl}xcal.xml">XCal</a> abrufbar.
|
||||
Die Neuigkeiten des C3D2 sind auch als <a href="{$baseurl}news-atom.xml">ATOM</a> und <a href="{$baseurl}news-rss.xml">RSS</a>, die Veranstaltungen als <a href="{$baseurl}ical.ics">iCal</a> und <a href="{$baseurl}xcal.xml">XCal</a> abrufbar.
|
||||
Mehr News gibts im <a href="{$baseurl}news-archiv.html">Archiv</a>.
|
||||
</p>
|
||||
</xsl:template>
|
||||
|
|
Loading…
Reference in New Issue