News-Archiv und Themenabende zu richtigen Seiten gemacht, benutzen nicht mehr standard-News-template mit globalen Variablen, sondern neues Element: <news-list/>

xhtml.xsl-Entwirrung


git-svn-id: svn://svn.c3d2.de/c3d2-web/trunk@481 31f61c52-7bfb-0310-b897-fc00f8a278f0
This commit is contained in:
astro 2006-07-27 00:01:48 +00:00
parent 2f396672a9
commit ab83aab0c9
7 changed files with 83 additions and 42 deletions

View File

@ -36,7 +36,7 @@ WWW_CCC_DE_UPDATES=chaosupdates.rdf
### Ziele ### ### Ziele ###
# Dateinamen der zu erzeugenden html-Dateien: # Dateinamen der zu erzeugenden html-Dateien:
CONTENT=$(PAGES) $(NEWS_PAGES) $(DS_PAGES) $(NEWSFILES) $(SEARCH_TMPL) $(DYNAMIC) CONTENT=$(PAGES) $(NEWS_PAGES) $(DS_PAGES) $(NEWSFILES) $(SEARCH_TMPL)
# 'normale' Seiten: # 'normale' Seiten:
PAGES:=$(patsubst content/pages/%.xml, build/%.html, $(wildcard content/pages/*.xml)) PAGES:=$(patsubst content/pages/%.xml, build/%.html, $(wildcard content/pages/*.xml))
@ -48,8 +48,6 @@ NEWSFILES:=build/news.html build/news-rss.xml build/news-atom.xml
DS_PAGES:=$(patsubst content/datenspuren/%.xml, build/datenspuren/%.html, $(wildcard content/datenspuren/*.xml)) build/datenspuren/schedule.html DS_PAGES:=$(patsubst content/datenspuren/%.xml, build/datenspuren/%.html, $(wildcard content/datenspuren/*.xml)) build/datenspuren/schedule.html
# Suchseiten-Template # Suchseiten-Template
SEARCH_TMPL:=build/cgi-bin/search.html SEARCH_TMPL:=build/cgi-bin/search.html
# Dynamische Seiten:
DYNAMIC:=build/themenabende.html build/news-archiv.html
# Quellen # Quellen
NEWSITEMS:=$(wildcard content/news/*.xml) NEWSITEMS:=$(wildcard content/news/*.xml)
@ -81,7 +79,7 @@ build/news-rss.xml : NOVALID_IGNORE:=true
build/news-atom.xml : STYLE=xsl/atom.xsl build/news-atom.xml : STYLE=xsl/atom.xsl
build/news-atom.xml : NOVALID_IGNORE:=true build/news-atom.xml : NOVALID_IGNORE:=true
.INTERMEDIATE: news.xml #.INTERMEDIATE: news.xml
news.xml: $(NEWSITEMS) news.xml: $(NEWSITEMS)
sh scripts/gen_news.xml.sh $^ > $@ sh scripts/gen_news.xml.sh $^ > $@
@ -89,7 +87,7 @@ $(NEWSFILES): news.xml $(NAVIGATION) $(STYLE)
$(call xml_process) $(call xml_process)
# Pages: # Pages:
build/%.html: content/pages/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES) build/%.html: content/pages/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES) news.xml
$(call xml_process) $(call xml_process)
# News: # News:
@ -97,15 +95,6 @@ build/news/%.html : BASEURL="../"
build/news/%.html: content/news/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES) build/news/%.html: content/news/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES)
$(call xml_process) $(call xml_process)
# Dynamisches:
build/news-archiv.html : PFLAGS+=--stringparam pagetitle News-Archiv --stringparam newsbodies off
build/news-archiv.html: news.xml $(NAVIGATION) $(STYLE)
$(call xml_process)
build/themenabende.html : PFLAGS+=--stringparam pagetitle Themenabende --stringparam newsbodies off --stringparam newscategory Themenabend
build/themenabende.html: news.xml $(NAVIGATION) $(STYLE)
$(call xml_process)
# Suche: # Suche:
build/cgi-bin/search.html : BASEURL="../" build/cgi-bin/search.html : BASEURL="../"
build/cgi-bin/search.html: content/cgi-bin/search.xml $(STYLE) $(NAVIGATION) build/cgi-bin/search.html: content/cgi-bin/search.xml $(STYLE) $(NAVIGATION)
@ -129,4 +118,4 @@ $(WWW_CCC_DE_UPDATES):
### Mr. Propper ### ### Mr. Propper ###
.PHONY: clean .PHONY: clean
clean: clean:
rm -f $(CLEAN) rm -f $(CLEAN) news.xml

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<navigation> <navigation>
<file title='News'>news</file> <file title="News">news</file>
<file>whois</file> <file>whois</file>
<file>kontakt</file> <file>kontakt</file>
<file>mailingliste</file> <file>mailingliste</file>
<file>treff</file> <file>treff</file>
<file title='Themenabende'>themenabende</file> <file>themenabende</file>
<file>projekte</file> <file>projekte</file>
<file>wiki</file> <file>wiki</file>
<file>silc</file> <file>silc</file>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page SYSTEM "http://www.c3d2.de/dtd/c3d2web.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/html.xsl" ?>
<page title="News-Archiv">
<p>
Alle C3D2-News kurzgefasst, neuere zuerst:
</p>
<news-list details="news"/>
</page>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page SYSTEM "http://www.c3d2.de/dtd/c3d2web.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/html.xsl" ?>
<page title="Themenabende">
<p>
Wir veranstalten in zumeist regelmäßigen Abständen Abende zu bestimmten Themen.
</p>
<news-list category="Themenabend" details="event"/>
</page>

View File

@ -312,6 +312,10 @@ dd {
margin-left: 4em; margin-left: 4em;
} }
ul.details_event {
list-style-type: none;
}
/* -- Search Engine -- */ /* -- Search Engine -- */
div.search div.estform { div.search div.estform {
margin: 0.8em 1.0em; padding: 0em 1.0em; margin: 0.8em 1.0em; padding: 0em 1.0em;

View File

@ -2,7 +2,7 @@
<!-- a Uniform Resource Identifier, see [RFC2396] --> <!-- a Uniform Resource Identifier, see [RFC2396] -->
<!ENTITY % Inline "(#PCDATA | link | em | image )*"> <!ENTITY % Inline "(#PCDATA | link | em | image )*">
<!ENTITY % Block "p|pre|dl|ul|ol"> <!ENTITY % Block "p|pre|dl|ul|ol|news-list">
<!ELEMENT page ((news)|(%Block;)*)> <!ELEMENT page ((news)|(%Block;)*)>
<!ATTLIST page <!ATTLIST page
@ -31,6 +31,12 @@
title CDATA #IMPLIED title CDATA #IMPLIED
> >
<!ELEMENT news-list EMPTY>
<!ATTLIST news-list
category CDATA #IMPLIED
details CDATA #REQUIRED
>
<!ELEMENT p %Inline;> <!ELEMENT p %Inline;>
<!ATTLIST p <!ATTLIST p
class CDATA #IMPLIED class CDATA #IMPLIED

View File

@ -7,11 +7,6 @@
exclude-result-prefixes="xsl rss rdf"> exclude-result-prefixes="xsl rss rdf">
<xsl:param name="newsbodies"/>
<xsl:param name="newscategory"/>
<xsl:param name="pagetitle"/>
<xsl:include href="common.xsl" /> <xsl:include href="common.xsl" />
<xsl:include href="header.xsl" /> <xsl:include href="header.xsl" />
<xsl:include href="footer.xsl" /> <xsl:include href="footer.xsl" />
@ -26,9 +21,6 @@
<xsl:template match="/page"> <xsl:template match="/page">
<xsl:variable name="title"> <xsl:variable name="title">
<xsl:choose> <xsl:choose>
<xsl:when test="$pagetitle != ''">
<xsl:value-of select="$pagetitle"/>
</xsl:when>
<xsl:when test="/page/@pagetitle"> <xsl:when test="/page/@pagetitle">
<xsl:value-of select="/page/@pagetitle"/> <xsl:value-of select="/page/@pagetitle"/>
</xsl:when> </xsl:when>
@ -185,15 +177,13 @@
<xsl:template match="/page/news"> <xsl:template match="/page/news">
<xsl:for-each select="newsfile"> <xsl:for-each select="newsfile">
<xsl:sort select="date:seconds(document(concat('../', .))/item/@date)" data-type="number" order="descending" /> <xsl:sort select="date:seconds(document(concat('../', .))/item/@date)" data-type="number" order="descending" />
<xsl:if test="(position() &lt;= 10) or ($newsbodies = 'off')"> <xsl:if test="position() &lt;= 10">
<xsl:variable name="newsfile"><xsl:value-of select="."/></xsl:variable> <xsl:variable name="newsfile"><xsl:value-of select="."/></xsl:variable>
<xsl:variable name="itemposition" select="position()"/> <xsl:variable name="itemposition" select="position()"/>
<xsl:for-each select="document(concat('../', $newsfile))/item"> <xsl:for-each select="document(concat('../', $newsfile))/item">
<xsl:if test="($newscategory = '') or ($newscategory = @category)">
<div> <div>
<xsl:if test="event"> <xsl:if test="event">
<xsl:attribute name="class">vevent</xsl:attribute> <xsl:attribute name="class">vevent</xsl:attribute>
@ -207,7 +197,6 @@
<xsl:call-template name="news-meta"/> <xsl:call-template name="news-meta"/>
<xsl:if test="$newsbodies != 'off'">
<div class="news"> <div class="news">
<xsl:apply-templates> <xsl:apply-templates>
<xsl:with-param name="itemposition" select="$itemposition"/> <xsl:with-param name="itemposition" select="$itemposition"/>
@ -227,22 +216,17 @@
</div> </div>
<hr class="news"/> <hr class="news"/>
</xsl:if>
</div> </div>
</xsl:if>
</xsl:for-each> </xsl:for-each>
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
<xsl:if test="$newsbodies != 'off'">
<p> <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> 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> abrufbar.
Mehr News gibts im <a href="{$baseurl}news-archiv.html">Archiv</a>. Mehr News gibts im <a href="{$baseurl}news-archiv.html">Archiv</a>.
</p> </p>
</xsl:if>
</xsl:template> </xsl:template>
<xsl:template name="news-meta"> <xsl:template name="news-meta">
@ -250,16 +234,12 @@
<xsl:value-of select="@author"/> <xsl:value-of select="@author"/>
</small> </small>
<xsl:variable name="datestring"> <small class="news_date">
@
<xsl:call-template name="get-datestring"> <xsl:call-template name="get-datestring">
<xsl:with-param name="date" select="@date" /> <xsl:with-param name="date" select="@date" />
</xsl:call-template> </xsl:call-template>
</xsl:variable> </small>
<xsl:element name="small">
<xsl:attribute name="class">news_date</xsl:attribute>
<xsl:value-of select="concat(' @ ', $datestring)"/>
</xsl:element>
</xsl:template> </xsl:template>
<xsl:template name="include-resources"> <xsl:template name="include-resources">
@ -329,4 +309,46 @@
</img> </img>
</xsl:template> </xsl:template>
<xsl:template match="news-list">
<xsl:variable name="category" select="@category"/>
<xsl:variable name="details" select="@details"/>
<xsl:message>category <xsl:value-of select="$category"/></xsl:message>
<xsl:for-each select="document('../news.xml')/page/news/newsfile">
<xsl:sort select="date:seconds(document(concat('../', .))/item/@date)" data-type="number" order="descending" />
<xsl:variable name="newsfile" select="."/>
<xsl:for-each select="document(concat('../', $newsfile))/item">
<xsl:if test="(string-length($category) = 0) or ($category = @category)">
<h3>
<a href="{substring-before(substring-after($newsfile, 'content/'), '.xml')}.html">
<xsl:value-of select="@title"/>
</a>
</h3>
<xsl:choose>
<xsl:when test="$details = 'news'">
<xsl:call-template name="news-meta"/>
</xsl:when>
<xsl:when test="($details = 'event') and event">
<ul class="details_event">
<li>
<xsl:call-template name="get-datestring">
<xsl:with-param name="date" select="event/start" />
</xsl:call-template>,
</li>
<li>
<xsl:value-of select="event/location"/>
</li>
</ul>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>