include date.xsl nach common.xsl, weil es dort dringender benoetigt wird :)

microformats.org-Unterstuetzung
<event/>-support für news
ta-ruby und ta-python mit <event/>


git-svn-id: svn://svn.c3d2.de/c3d2-web/trunk@460 31f61c52-7bfb-0310-b897-fc00f8a278f0
This commit is contained in:
astro 2006-07-26 01:36:40 +00:00
parent 1dc4987970
commit 397aec6696
7 changed files with 168 additions and 40 deletions

View File

@ -3,12 +3,10 @@
<?xml-stylesheet type="text/xsl" href="../../xsl/html.xsl" ?>
<item title="TA: Python und Twisted" date="2006-07-13T15:00:00" author="Astro" category="Themenabend">
<image title="Snakes bite!">python.png</image>
<dl>
<dt>Termin</dt>
<dd>28. Juli 2006, 19:00 Uhr</dd>
<dt>Ort</dt>
<dd>Berufsakademie Dresden, Raum G3, Heideparkstr. 8, 01099 Dresden</dd>
</dl>
<event>
<start>2006-07-28T19:00:00</start>
<location>Berufsakademie Dresden, Raum G3, Heideparkstr. 8, 01099 Dresden</location>
</event>
<addendum>
<p>

View File

@ -3,12 +3,12 @@
<?xml-stylesheet type="text/xsl" href="../../xsl/html.xsl" ?>
<item title="TA: Ruby &amp; Ruby on Rails" date="2006-03-19T19:00:00" author="Astro" category="Themenabend">
<image title="Ruby">ruby.jpg</image>
<event>
<start>2006-03-10T19:00:00</start>
<end>2006-03-10T23:23:23</end>
<location>Berufsakademie Dresden, Raum G3, Heideparkstr. 8, 01099 Dresden</location>
</event>
<dl>
<dt>Termin</dt>
<dd>10. März 2006, 19:00 Uhr</dd>
<dt>Ort</dt>
<dd>Berufsakademie Dresden, Raum G3, Heideparkstr. 8, 01099 Dresden</dd>
<dt>Themen</dt>
<dd>Einführung in Ruby</dd>
<dd>Ruby-MediaWiki</dd>

View File

@ -13,7 +13,7 @@
<!ELEMENT news (newsfile)+>
<!ELEMENT newsfile (#PCDATA)>
<!ELEMENT item ((image)?, (%Block;)*, (addendum)?, (resource)*)>
<!ELEMENT item ((image)?, (event)?, (%Block;)*, (addendum)?, (resource)*)>
<!ATTLIST item
title CDATA #REQUIRED
date CDATA #REQUIRED
@ -48,6 +48,11 @@
title CDATA #REQUIRED
>
<!ELEMENT event ((start), (end)?, (location)?)>
<!ELEMENT start (#PCDATA)>
<!ELEMENT end (#PCDATA)>
<!ELEMENT location (#PCDATA)>
<!ELEMENT pre (#PCDATA)>
<!ATTLIST pre
xml:space (preserve) #FIXED 'preserve'

View File

@ -151,4 +151,58 @@
</div> <!-- id="news" -->
</xsl:template>
<!-- Support für <event/> bzw. Microformats -->
<xsl:include href="date.xsl" />
<xsl:template match="item/event/start">
<xsl:variable name="date" select="."/>
<dl>
<dt>
<xsl:choose>
<xsl:when test="../end">Beginn</xsl:when>
<xsl:otherwise>Datum</xsl:otherwise>
</xsl:choose>
</dt>
<dd>
<abbr class="dtstart">
<xsl:attribute name="title">
<xsl:call-template name="date-to-hevent">
<xsl:with-param name="date" select="$date"/>
</xsl:call-template>
</xsl:attribute>
<xsl:call-template name="get-datestring">
<xsl:with-param name="date" select="$date"/>
</xsl:call-template>
</abbr>
</dd>
</dl>
</xsl:template>
<xsl:template match="item/event/end">
<xsl:variable name="date" select="."/>
<dl>
<dt>Ende</dt>
<dd>
<abbr class="dtend">
<xsl:attribute name="title">
<xsl:call-template name="date-to-hevent">
<xsl:with-param name="date" select="$date"/>
</xsl:call-template>
</xsl:attribute>
<xsl:call-template name="get-datestring">
<xsl:with-param name="date" select="$date"/>
</xsl:call-template>
</abbr>
</dd>
</dl>
</xsl:template>
<xsl:template match="item/event/location">
<dl>
<dt>Ort</dt>
<dd class="location"><xsl:apply-templates/></dd>
</dl>
</xsl:template>
</xsl:stylesheet>

View File

@ -389,4 +389,31 @@
</xsl:template>
<xsl:template name="date-to-hevent">
<xsl:param name="date"/>
<xsl:variable name="month_in_year">
<xsl:if test="string-length(date:month-in-year($date))=1">0</xsl:if>
<xsl:value-of select="date:month-in-year($date)"/>
</xsl:variable>
<xsl:variable name="day_in_month">
<xsl:if test="string-length(date:day-in-month($date))=1">0</xsl:if>
<xsl:value-of select="date:day-in-month($date)"/>
</xsl:variable>
<xsl:variable name="hour_in_day">
<xsl:if test="string-length(date:hour-in-day($date))=1">0</xsl:if>
<xsl:value-of select="date:hour-in-day($date)"/>
</xsl:variable>
<xsl:variable name="minute_in_hour">
<xsl:if test="string-length(date:minute-in-hour($date))=1">0</xsl:if>
<xsl:value-of select="date:minute-in-hour($date)"/>
</xsl:variable>
<xsl:variable name="second_in_minute">
<xsl:if test="string-length(date:second-in-minute($date))=1">0</xsl:if>
<xsl:value-of select="date:second-in-minute($date)"/>
</xsl:variable>
<xsl:value-of select="date:year($date)"/><xsl:value-of select="$month_in_year"/><xsl:value-of select="$day_in_month"/>T<xsl:value-of select="$hour_in_day"/><xsl:value-of select="$minute_in_hour"/><xsl:value-of select="$second_in_minute"/>
</xsl:template>
</xsl:stylesheet>

View File

@ -84,4 +84,38 @@
</xsl:template>
<xsl:template match="resource" mode="escaped"/>
<!-- Support für <event/> -->
<xsl:include href="date.xsl" />
<xsl:template match="item/event/start" mode="escaped">
&lt;dl&gt;
&lt;dt&gt;
<xsl:choose>
<xsl:when test="../end">Beginn</xsl:when>
<xsl:otherwise>Datum</xsl:otherwise>
</xsl:choose>
&lt;/dt&gt;
&lt;dd&gt;
<xsl:call-template name="get-datestring">
<xsl:with-param name="date" select="."/>
</xsl:call-template>
&lt;/dd&gt;
&lt;/dl&gt;
</xsl:template>
<xsl:template match="item/event/end" mode="escaped">
&lt;dl&gt;
&lt;dt&gt;Ende&lt;/dt&gt;
&lt;dd&gt;
<xsl:call-template name="get-datestring">
<xsl:with-param name="date" select="."/>
</xsl:call-template>
&lt;/dd&gt;
&lt;/dl&gt;
</xsl:template>
<xsl:template match="item/event/location" mode="escaped">
&lt;dl&gt;
&lt;dt&gt;Ort&lt;/dt&gt;
&lt;dd&gt;<xsl:apply-templates/>&lt;/dd&gt;
&lt;/dl&gt;
</xsl:template>
</xsl:stylesheet>

View File

@ -13,7 +13,6 @@
<xsl:include href="common.xsl" />
<xsl:include href="date.xsl" />
<xsl:include href="header.xsl" />
<xsl:include href="footer.xsl" />
@ -127,6 +126,10 @@
</xsl:when>
<xsl:otherwise> <!-- normale Seite -->
<div id="content">
<xsl:if test="event">
<xsl:attribute name="class">vevent</xsl:attribute>
</xsl:if>
<h2>
<xsl:if test="name(.) = 'item'">
<xsl:attribute name="class">news</xsl:attribute>
@ -191,35 +194,42 @@
<xsl:if test="($newscategory = '') or ($newscategory = @category)">
<h3 class="news">
<a href="{substring-before(substring-after($newsfile, 'content/'), '.xml')}.html">
<xsl:value-of select="@title"/>
</a>
</h3>
<xsl:call-template name="news-meta"/>
<xsl:if test="$newsbodies != 'off'">
<div class="news">
<xsl:apply-templates>
<xsl:with-param name="itemposition" select="$itemposition"/>
</xsl:apply-templates>
<div>
<xsl:if test="event">
<xsl:attribute name="class">vevent</xsl:attribute>
</xsl:if>
<h3 class="news summary">
<a href="{substring-before(substring-after($newsfile, 'content/'), '.xml')}.html">
<xsl:value-of select="@title"/>
</a>
</h3>
<xsl:call-template name="include-resources">
<xsl:with-param name="include-hidden">no</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="news-meta"/>
<xsl:if test="//addendum">
<p>
<a href="{substring-before(substring-after($newsfile, 'content/'), '.xml')}.html">
Weiterlesen...
</a>
</p>
</xsl:if>
</div>
<hr class="news"/>
</xsl:if>
<xsl:if test="$newsbodies != 'off'">
<div class="news">
<xsl:apply-templates>
<xsl:with-param name="itemposition" select="$itemposition"/>
</xsl:apply-templates>
<xsl:call-template name="include-resources">
<xsl:with-param name="include-hidden">no</xsl:with-param>
</xsl:call-template>
<xsl:if test="//addendum">
<p>
<a href="{substring-before(substring-after($newsfile, 'content/'), '.xml')}.html">
Weiterlesen...
</a>
</p>
</xsl:if>
</div>
<hr class="news"/>
</xsl:if>
</div>
</xsl:if>