People with cool browsers can now browse xml files directly.

git-svn-id: svn://svn.c3d2.de/c3d2-web/branches/toidinamais_coole_scheisse@106 31f61c52-7bfb-0310-b897-fc00f8a278f0
This commit is contained in:
toidinamai 2006-01-11 18:12:08 +00:00
parent 8823ec1d16
commit 4d42847a77
12 changed files with 138 additions and 60 deletions

View File

@ -36,13 +36,14 @@ CONTENT=$(PAGES) $(DS_PAGES) $(NEWSFILES)
PAGES:=$(patsubst content/%.xml, www/%.html, $(filter-out $(NAVIGATION) $(SKELETONS), $(wildcard content/*.xml)))
DS_PAGES:=$(patsubst content/datenspuren/%.xml, www/datenspuren/%.html, $(wildcard content/datenspuren/*.xml))
NEWSITEMS:=$(wildcard content/news/*.xml)
NEWSINDEX:=content/news/index.xml
NEWSITEMS:=$(filter-out $(NEWSINDEX), $(wildcard content/news/*.xml))
NEWSFILES:=www/news.html www/news-rss.xml www/news-atom.xml
DTD:=dtd/c3d2web.dtd
CLEAN=$(CONTENT) $(NEWSFILES)
### Defaults ###
.PHONY: export contents clean mrproper all install check
.PHONY: export contents clean mrproper all install check mirrorcontent
.PRECIOUS: content/%.xml www/%.html content/datenspuren/%.xml www/datenspuren/%.html
.SILENT: check
@ -53,7 +54,8 @@ install: export
contents: $(CONTENT) $(DTD)
export: contents
$(RSYNC) $(RSYNC_FLAGS) --exclude=".svn/" www/ $(DESTDIR)/
$(RSYNC) $(RSYNC_FLAGS) --exclude=".svn/" www/ chaosupdates.rdf content dtd xsl $(DESTDIR)/
check: $(PAGES)
ln -sfn $(PWD)/dtd www/DTD
@ -68,20 +70,25 @@ www/news.html: $(STYLE)
www/news-rss.xml: $(STYLE_RSS)
www/news-atom.xml: $(STYLE_ATOM)
$(NEWSFILES): $(NEWSITEMS) $(NAVIGATION)
$(NEWSFILES): $(NAVIGATION) $(NEWSINDEX)
$(VALIDATOR) $(VFLAGS) $(NEWSINDEX)
$(PROCESSOR) $(PFLAGS) -o $@ $(filter-out $(NEWSITEMS) $(NAVIGATION) $(NEWSINDEX),$^) $(NEWSINDEX)
$(NEWSINDEX): $(NEWSITEMS) Makefile
for item in $(NEWSITEMS) ; do \
$(VALIDATOR) $(VFLAGS) $${item} || exit 1 ; \
done
{ echo '<?xml version="1.0" encoding="UTF-8"?>' ; \
echo '<!DOCTYPE page SYSTEM "../../dtd/c3d2web.dtd">' ; \
echo '<?xml-stylesheet type="text/xsl" href="../../xsl/html.xsl" ?>' ; \
echo "<page>"; \
echo " <news>"; \
for item in $(NEWSITEMS) ; do \
for item in $(patsubst content/news/%,%,$(NEWSITEMS)) ; do \
echo " <newsfile>$${item}</newsfile>"; \
done; \
echo " </news>"; \
echo "</page>"; } | \
$(PROCESSOR) $(PFLAGS) -o $@ $(filter-out $(NEWSITEMS) $(NAVIGATION),$^) -
echo "</page>"; } > $@
www/datenspuren/%.html: content/datenspuren/%.xml $(DS_STYLE)
$(VALIDATOR) $(VFLAGS) $<
@ -118,7 +125,6 @@ chaosupdates.rdf:
### Mr. Propper ###
clean:
rm -f $(CLEAN)
rm -rf www/dtd
mrproper: clean
rm -f chaosupdates.rdf

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page SYSTEM "../dtd/c3d2web.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/html.xsl" ?>
<page title="Impressum">
<p>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page SYSTEM "../dtd/c3d2web.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/html.xsl" ?>
<page title="Kontakt" pagetitle="E-Mail">
<p>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page SYSTEM "../dtd/c3d2web.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/html.xsl" ?>
<page title="Mailingliste">
<p>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page SYSTEM "../dtd/c3d2web.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/html.xsl" ?>
<page pagetitle="Secure Internet Live Conferencing" title="SILC">
<p>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page SYSTEM "../dtd/c3d2web.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/html.xsl" ?>
<page pagetitle="" title="">
<p>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page SYSTEM "../dtd/c3d2web.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/html.xsl" ?>
<page title="Wiki" pagetitle="WikiWikiWeb">
<p>

View File

@ -3,12 +3,15 @@
<!ENTITY % Inline "(#PCDATA | link | pre | em | dl )*">
<!ELEMENT page (p|pre|dl)+>
<!ELEMENT page ((news)|(p|pre|dl)+)>
<!ATTLIST page
title CDATA #IMPLIED
pagetitle CDATA #IMPLIED
>
<!ELEMENT news (newsfile)+>
<!ELEMENT newsfile (#PCDATA)>
<!ELEMENT item ((image)?, (p|pre|dl)+)>
<!ATTLIST item
title CDATA #REQUIRED

View File

@ -57,4 +57,55 @@
<xsl:value-of select="."/>
</xsl:template>
<xsl:template name="navitem">
<xsl:param name="file"/>
<li>
<xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of select="$file"/>.html</xsl:attribute>
<xsl:if test="document(concat('../content/', $file, '.xml'))/page/@pagetitle">
<xsl:attribute name="title"><xsl:value-of select="document(concat('../content/', $file, '.xml'))/page/@pagetitle"/></xsl:attribute>
</xsl:if>
<xsl:value-of select="document(concat('../content/', $file, '.xml'))/page/@title"/>
</xsl:element>
</li>
</xsl:template>
<xsl:template name="navitems">
<ul>
<li>
<a href="news.html" title="News">News</a>
</li>
<xsl:for-each select="document('../content/navigation.xml')/navigation/file">
<xsl:call-template name="navitem">
<xsl:with-param name="file" select="."/>
</xsl:call-template>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="chaosupdates">
<div id="news">
<h2>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="document('../chaosupdates.rdf')/rdf:RDF/rss:channel/rss:link"/>
</xsl:attribute>
<xsl:value-of select="document('../chaosupdates.rdf')/rdf:RDF/rss:channel/rss:title"/>
</xsl:element>
</h2>
<ul>
<xsl:for-each select="document('../chaosupdates.rdf')/rdf:RDF/rss:item[position() &lt; 14]">
<li>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="rss:link"/>
</xsl:attribute>
<xsl:value-of select="rss:title"/>
</xsl:element>
</li>
</xsl:for-each>
</ul>
</div> <!-- id="news" -->
</xsl:template>
</xsl:stylesheet>

View File

@ -4,6 +4,13 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="xsl rss rdf">
<xsl:template name="links">
<link rel="icon" href="images/favicon.png" type="image/png" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="news-rss.xml" />
<link rel="alternate" type="application/atom" title="Atom 1.0" href="news-atom.xml" />
<link rel="stylesheet" title="Default" type="text/css" href="style/default.css" />
</xsl:template>
<xsl:template name="header">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="&lt;&lt;&lt;/&gt;&gt; c3d2, der Erfahrungsaustauschkreis aus dem sächsischen Dresden" />
@ -23,10 +30,8 @@
<meta name="DC.Coverage" content="Dresden" />
<meta name="DC.Title" content="c3d2: Chaos Computer Club Dresden" />
<link rel="icon" href="" type="image/png" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="news-rss.xml" />
<link rel="stylesheet" title="Default" type="text/css" href="style/default.css" />
<xsl:call-template name="links" />
<title>&lt;&lt;&lt;/&gt;&gt; Chaos Computer Club Dresden | c3d2</title>
</xsl:template>

49
xsl/html.xsl Normal file
View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsl">
<xsl:import href="xhtml.xsl" />
<xsl:template name="links">
<link rel="icon" type="image/png" href="../images/favicon.png" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="../news-rss.xml" />
<link rel="alternate" type="application/atom" title="Atom 1.0" href="../news-atom.xml" />
<link rel="stylesheet" title="Default" type="text/css" href="../style/default.css" />
</xsl:template>
<xsl:output method="html"
version="1.0"
encoding="utf-8"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="DTD/xhtml1-strict.dtd"
indent="yes"/>
<xsl:template name="navitem">
<xsl:param name="file"/>
<li>
<xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of select="$file"/>.xml</xsl:attribute>
<xsl:if test="document(concat('../content/', $file, '.xml'))/page/@pagetitle">
<xsl:attribute name="title"><xsl:value-of select="document(concat('../content/', $file, '.xml'))/page/@pagetitle"/></xsl:attribute>
</xsl:if>
<xsl:value-of select="document(concat('../content/', $file, '.xml'))/page/@title"/>
</xsl:element>
</li>
</xsl:template>
<xsl:template name="navitems">
<ul>
<li>
<a href="news.xml" title="News">News</a>
</li>
<xsl:for-each select="document('../content/navigation.xml')/navigation/file">
<xsl:call-template name="navitem">
<xsl:with-param name="file" select="."/>
</xsl:call-template>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>

View File

@ -59,14 +59,8 @@
</p>
</form>
<ul>
<li>
<a href="news.html" title="News">News</a>
</li>
<xsl:for-each select="document('../content/navigation.xml')/navigation/file">
<xsl:call-template name="navitem"><xsl:with-param name="file" select="."/></xsl:call-template>
</xsl:for-each>
</ul>
<xsl:call-template name="navitems" />
</div> <!-- id="navigation" -->
<!-- ### Content ### -->
@ -82,9 +76,6 @@
<xsl:when test="/page/@title">
<xsl:value-of select="/page/@title"/>
</xsl:when>
<xsl:when test="/page/news">
<xsl:text>News</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:comment><xsl:text> missing title </xsl:text></xsl:comment>
</xsl:otherwise>
@ -97,28 +88,8 @@
<xsl:comment>
<xsl:text> ### News ### </xsl:text>
</xsl:comment>
<div id="news">
<h2>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="document('../chaosupdates.rdf')/rdf:RDF/rss:channel/rss:link"/>
</xsl:attribute>
<xsl:value-of select="document('../chaosupdates.rdf')/rdf:RDF/rss:channel/rss:title"/>
</xsl:element>
</h2>
<ul>
<xsl:for-each select="document('../chaosupdates.rdf')/rdf:RDF/rss:item[position() &lt; 14]">
<li>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="rss:link"/>
</xsl:attribute>
<xsl:value-of select="rss:title"/>
</xsl:element>
</li>
</xsl:for-each>
</ul>
</div>
<xsl:call-template name="chaosupdates" />
</div> <!-- id="body" -->
@ -205,17 +176,4 @@
<!-- Nothing to do here, see above... -->
</xsl:template>
<xsl:template name="navitem">
<xsl:param name="file"/>
<li>
<xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of select="$file"/>.html</xsl:attribute>
<xsl:if test="document(concat('../content/', $file, '.xml'))/page/@pagetitle">
<xsl:attribute name="title"><xsl:value-of select="document(concat('../content/', $file, '.xml'))/page/@pagetitle"/></xsl:attribute>
</xsl:if>
<xsl:value-of select="document(concat('../content/', $file, '.xml'))/page/@title"/>
</xsl:element>
</li>
</xsl:template>
</xsl:stylesheet>