add initial support for Gemini
This commit is contained in:
parent
cb79225e75
commit
61afd7cc3d
|
@ -0,0 +1,249 @@
|
|||
# eingebaute Variablen und Regeln werden nicht gebraucht
|
||||
MAKEFLAGS += -rR
|
||||
|
||||
### Programme ###
|
||||
# XSLT-Prozessor:
|
||||
PROCESSOR=xsltproc
|
||||
PFLAGS=--novalid --catalogs --stringparam baseurl $(BASEURL)
|
||||
BASEURL=""
|
||||
RM=rm -f
|
||||
# XML-Validator
|
||||
VALIDATOR=xmllint
|
||||
VFLAGS=--noout --nonet
|
||||
# VALIDATOR-Flags für Eingabe-XML (meist c3d2web)
|
||||
VFLAGS_IN=$(VFLAGS) --schema xsd/c3d2web.xsd
|
||||
# VALIDATOR-Flags für Ausgabe-XML (xhtml, rss, atom, ...)
|
||||
VFLAGS_OUT=$(VFLAGS)
|
||||
SGML_CATALOG_FILES=$(XML_CATALOG)
|
||||
export SGML_CATALOG_FILES
|
||||
# Downloadmanager (Alternativ: curl, fetch):
|
||||
WGET=wget
|
||||
# rsync
|
||||
RSYNC=rsync
|
||||
# -l, --links copy symlinks as symlinks
|
||||
RSYNC_FLAGS=--links --verbose --recursive --delete --delete-after --delete-excluded --checksum --chmod=ugo=rX
|
||||
|
||||
# Verzeichnis, in das exportiert werden soll
|
||||
DESTDIR?=www-export
|
||||
|
||||
### Ressourcen ###
|
||||
# XSLT-Stylesheets:
|
||||
STYLE=xsl/gemini.xsl
|
||||
# Document-Type-Definition:
|
||||
DTD:=dtd/c3d2web.dtd
|
||||
# XML-Katalog (Pfad zu den DTDs) - wird benötigt vom Validator
|
||||
XML_CATALOG:=dtd/catalog.xml
|
||||
# Navigationsleiste:
|
||||
NAVIGATION=content/navigation.xml
|
||||
# Chaosupdates:
|
||||
#WWW_CCC_DE_UPDATES=chaosupdates.xml
|
||||
# Calendar summary::
|
||||
CALENDAR_SUMMARY=calendar-summary.xml
|
||||
|
||||
### Ziele ###
|
||||
# Mindestens 1x täglich neubauen wegen Chaosupdates & Kalender
|
||||
DATESTAMP=build/.stamp-$(shell date +%Y-%m-%d)
|
||||
|
||||
# Dateinamen der zu erzeugenden gmi-Dateien:
|
||||
CONTENT=$(PAGES) $(NEWS_PAGES) $(NEWSFILES) build/calendar.gmi
|
||||
|
||||
# 'normale' Seiten:
|
||||
PAGES:=$(patsubst content/pages/%.xml, build/%.gmi, $(wildcard content/pages/*.xml))
|
||||
# Seiten zu einzelnen News-Items:
|
||||
NEWS_PAGES:=$(patsubst content/news/%.xml, build/news/%.gmi, $(wildcard content/news/*.xml))
|
||||
# News-Index und Feeds:
|
||||
NEWSFILES:=build/news.gmi build/news-rss.xml build/news-atom.xml \
|
||||
build/podcast.xml build/pentaradio.xml build/pentacast.xml build/pentamusic.xml build/pentamedia.xml \
|
||||
build/news-archiv-rss.xml build/news-archiv-atom.xml \
|
||||
build/podcast-archiv.xml build/pentaradio-archiv.xml build/pentacast-archiv.xml \
|
||||
build/pentamusic-archiv.xml build/pentamedia-archiv.xml \
|
||||
build/ical.ics build/hq.ics build/xcal.xml build/reminders \
|
||||
build/pentacast-ogg.xml build/pentacast-ogg-archiv.xml \
|
||||
build/portal.gmi
|
||||
PLAYLISTS:=$(patsubst content/news/pentaradio%.xml, build/news/pentaradio%.xspf, $(wildcard content/news/pentaradio*.xml)) \
|
||||
$(patsubst content/news/pentaradio%.xml, build/news/pentaradio%.pls, $(wildcard content/news/pentaradio*.xml)) \
|
||||
$(patsubst content/news/pentaradio%.xml, build/news/pentaradio%.m3u, $(wildcard content/news/pentaradio*.xml))
|
||||
|
||||
# Quellen
|
||||
NEWSITEMS:=$(wildcard content/news/*.xml)
|
||||
#CLEAN=$(CONTENT) $(NEWSFILES) $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY) $(DS_PAGES) $(DS_FEEDS)
|
||||
CLEAN=$(CONTENT) $(NEWSFILES) $(CALENDAR_SUMMARY) $(DS_PAGES) $(DS_FEEDS)
|
||||
|
||||
NOINPUTVALID:=false
|
||||
NOVALID:=false
|
||||
|
||||
ALL_XSLS = $(wildcard xsl/*.xsl)
|
||||
|
||||
define xml_process
|
||||
$(PROCESSOR) $(PFLAGS) -o $@ $(STYLE) $<
|
||||
@$(NOVALID) || echo $(VALIDATOR) $(VFLAGS_OUT) $@ || \
|
||||
{ touch -m -t 197001010000 Makefile $@ ; exit 1 ; }
|
||||
@$(NOVALID) || $(VALIDATOR) $(VFLAGS_OUT) $@ || \
|
||||
{ touch -m -t 197001010000 Makefile $@ ; exit 1 ; }
|
||||
endef
|
||||
|
||||
### Defaults ###
|
||||
|
||||
.PHONY: www
|
||||
www: $(XML_CATALOG) $(CONTENT)
|
||||
$(RSYNC) $(RSYNC_FLAGS) --exclude=".stamp-*" content/static/ content/old-site/ build/ $@
|
||||
|
||||
.PHONY: export
|
||||
export: www
|
||||
$(RSYNC) $(RSYNC_FLAGS) --exclude=".git/" www/ $(DESTDIR)/
|
||||
|
||||
$(DATESTAMP):
|
||||
mkdir -p build
|
||||
$(RM) $(wildcard build/.stamp-*)
|
||||
touch $@
|
||||
|
||||
### Regeln für den XSLT-Prozess ###
|
||||
|
||||
build/%.gmi : NOVALID:=true
|
||||
#build/news.gmi: $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY) $(DATESTAMP)
|
||||
build/news.gmi: $(CALENDAR_SUMMARY) $(DATESTAMP)
|
||||
|
||||
## Feedgrößen begrenzen!
|
||||
build/%.xml : MAX_ITEMS=23
|
||||
build/%.xml : PFLAGS+=--param maxitems $(MAX_ITEMS)
|
||||
build/%-archiv.xml build/news-archiv-%.xml : MAX_ITEMS=9999999
|
||||
## Erscheinen regelmäßig, aber guck durch mehr als 23 Items zurück
|
||||
build/podcast.xml build/pentamedia.xml build/pentaradio.xml build/pentamusic.xml : MAX_ITEMS=100
|
||||
## Erscheint leider nicht so oft
|
||||
build/pentacast.xml build/pentacast-ogg.xml : MAX_ITEMS=200
|
||||
|
||||
build/news-rss.xml build/news-archiv-rss.xml : STYLE=xsl/rss.xsl
|
||||
build/news-rss.xml build/news-archiv-rss.xml : PFLAGS+=--stringparam prefix ""
|
||||
build/news-rss.xml build/news-archiv-rss.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
|
||||
build/news-rss.xml : PFLAGS+=--stringparam archivefeed news-archiv-rss.xml
|
||||
build/news-atom.xml build/news-archiv-atom.xml : STYLE=xsl/atom.xsl
|
||||
build/news-atom.xml build/news-archiv-atom.xml : PFLAGS+=--stringparam prefix ""
|
||||
build/news-atom.xml build/news-archiv-atom.xml : NOVALID=true
|
||||
build/news-atom.xml build/news-archiv-atom.xml : VFLAGS_OUT=$(VFLAGS) --relaxng xsd/atom.rng
|
||||
build/news-atom.xml : PFLAGS+=--stringparam archivefeed news-archiv-atom.xml
|
||||
build/podcast.xml build/podcast-archiv.xml : STYLE=xsl/podcast.xsl
|
||||
build/podcast.xml build/podcast-archiv.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
|
||||
build/podcast.xml build/podcast-archiv.xml : PFLAGS+=--stringparam format audio/mpeg,video/mp4
|
||||
build/podcast.xml build/podcast-archiv.xml: xsl/podcast.xsl # Does not work with $(STYLE) - why?
|
||||
build/podcast.xml : PFLAGS+=--stringparam archivefeed podcast-archiv.xml
|
||||
build/pentaradio.xml build/pentaradio-archiv.xml : STYLE=xsl/podcast.xsl
|
||||
build/pentaradio.xml build/pentaradio-archiv.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
|
||||
build/pentaradio.xml build/pentaradio-archiv.xml : PFLAGS+=--stringparam selection pentaradio --stringparam format audio/mpeg,video/mp4
|
||||
build/pentaradio.xml build/pentaradio-archiv.xml: xsl/podcast.xsl # Does not work with $(STYLE) - why?
|
||||
build/pentaradio.xml : PFLAGS+=--stringparam archivefeed pentaradio-archiv.xml
|
||||
build/pentacast.xml build/pentacast-archiv.xml : STYLE=xsl/podcast.xsl
|
||||
build/pentacast.xml build/pentacast-archiv.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
|
||||
build/pentacast.xml build/pentacast-archiv.xml : PFLAGS+=--stringparam selection pentacast --stringparam format audio/mpeg,video/mp4
|
||||
build/pentacast.xml build/pentacast-archiv.xml: xsl/podcast.xsl # Does not work with $(STYLE) - why?
|
||||
build/pentacast.xml : PFLAGS+=--stringparam archivefeed pentacast-archiv.xml
|
||||
|
||||
build/pentacast-ogg.xml build/pentacast-ogg-archiv.xml : STYLE=xsl/podcast.xsl
|
||||
build/pentacast-ogg.xml build/pentacast-ogg-archiv.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
|
||||
build/pentacast-ogg.xml build/pentacast-ogg-archiv.xml : PFLAGS+=--stringparam selection pentacast --stringparam format audio/ogg,video/ogg,application/ogg,video/webm
|
||||
build/pentacast-ogg.xml build/pentacast-ogg-archiv.xml : xsl/podcast.xsl # Does not work with $(STYLE) - why?
|
||||
build/pentacast-ogg.xml : PFLAGS+=--stringparam archivefeed pentacast-ogg-archiv.xml
|
||||
|
||||
build/pentamusic.xml build/pentamusic-archiv.xml : STYLE=xsl/podcast.xsl
|
||||
build/pentamusic.xml build/pentamusic-archiv.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
|
||||
build/pentamusic.xml build/pentamusic-archiv.xml : PFLAGS+=--stringparam selection pentamusic --stringparam format audio/mpeg,video/mp4
|
||||
build/pentamusic.xml build/pentamusic-archiv.xml: xsl/podcast.xsl # Does not work with $(STYLE) - why?
|
||||
build/pentamusic.xml : PFLAGS+=--stringparam archivefeed pentamusic-archiv.xml
|
||||
|
||||
build/pentamedia.xml build/pentamedia-archiv.xml : STYLE=xsl/podcast.xsl
|
||||
build/pentamedia.xml build/pentamedia-archiv.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
|
||||
build/pentamedia.xml build/pentamedia-archiv.xml : PFLAGS+=--stringparam selection pentamedia --stringparam format audio/mpeg,video/mp4
|
||||
build/pentamedia.xml build/pentamedia-archiv.xml: xsl/podcast.xsl # Does not work with $(STYLE) - why?
|
||||
build/pentamedia.xml : PFLAGS+=--stringparam archivefeed pentamedia-archiv.xml
|
||||
|
||||
#.INTERMEDIATE: news.xml
|
||||
news.xml: $(NEWSITEMS)
|
||||
sh scripts/gen_news.xml.sh $^ > $@
|
||||
|
||||
$(NEWSFILES): news.xml $(NAVIGATION) $(STYLE)
|
||||
$(call xml_process)
|
||||
|
||||
# Calendar
|
||||
$(CALENDAR_SUMMARY) : STYLE=xsl/calendar-summary.xsl
|
||||
$(CALENDAR_SUMMARY) : NOVALID:=true
|
||||
$(CALENDAR_SUMMARY) : VFLAGS_IN=$(VFLAGS)
|
||||
$(CALENDAR_SUMMARY): content/events.xml news.xml
|
||||
$(call xml_process)
|
||||
|
||||
# XCal
|
||||
build/xcal.xml : STYLE=xsl/xcal.xsl
|
||||
build/xcal.xml : VFLAGS_IN=$(VFLAGS)
|
||||
build/xcal.xml: $(CALENDAR_SUMMARY) $(STYLE)
|
||||
$(call xml_process)
|
||||
|
||||
# iCal
|
||||
build/ical.ics : STYLE=xsl/ical.xsl
|
||||
build/ical.ics : NOVALID:=true
|
||||
build/ical.ics : VFLAGS_IN=$(VFLAGS)
|
||||
build/ical.ics : VFLAGS_OUT=$(VFLAGS)
|
||||
build/ical.ics: $(CALENDAR_SUMMARY) $(STYLE)
|
||||
$(call xml_process)
|
||||
|
||||
# iCal with events at our hackerspace, for http://itedd.de/ + https://spaceapi.ccc.de/
|
||||
build/hq.ics : STYLE=xsl/ical.xsl
|
||||
build/hq.ics : PFLAGS+=--stringparam location-filter HQ
|
||||
build/hq.ics : NOVALID:=true
|
||||
build/hq.ics : VFLAGS_IN=$(VFLAGS)
|
||||
build/hq.ics : VFLAGS_OUT=$(VFLAGS)
|
||||
build/hq.ics: $(CALENDAR_SUMMARY) $(STYLE)
|
||||
$(call xml_process)
|
||||
|
||||
# Remind
|
||||
build/reminders : STYLE=xsl/remind.xsl
|
||||
build/reminders : NOVALID:=true
|
||||
build/reminders : VFLAGS_IN=$(VFLAGS)
|
||||
build/reminders : VFLAGS_OUT=$(VFLAGS)
|
||||
build/reminders: $(CALENDAR_SUMMARY) $(STYLE)
|
||||
$(call xml_process)
|
||||
|
||||
# Playlists
|
||||
build/%.xspf : VFLAGS_OUT=$(VFLAGS) --relaxng xsd/xspf-1_0.5.rng
|
||||
build/%.m3u : NOVALID:=true
|
||||
build/%.pls : NOVALID:=true
|
||||
|
||||
# Portal
|
||||
portal:
|
||||
mkdir $@
|
||||
|
||||
portal/Makefile : STYLE=xsl/portal2fetch.xsl
|
||||
portal/Makefile : NOINPUTVALID:=true
|
||||
portal/Makefile : NOVALID:=true
|
||||
portal/Makefile: content/portal-config.xml $(STYLE)
|
||||
$(call xml_process)
|
||||
|
||||
portal/items.xml : STYLE=xsl/portal2items.xsl
|
||||
portal/items.xml : NOINPUTVALID:=true
|
||||
portal/items.xml : NOVALID:=true
|
||||
portal/items.xml: content/portal-config.xml $(STYLE) portal/Makefile news.xml
|
||||
$(MAKE) -C portal fetch
|
||||
$(call xml_process)
|
||||
|
||||
portal/items-sorted.xml : STYLE=xsl/portal-sort.xsl
|
||||
portal/items-sorted.xml: portal/items.xml $(STYLE)
|
||||
$(call xml_process)
|
||||
|
||||
build/portal.gmi : NOINPUTVALID:=true
|
||||
build/portal.gmi: portal/items-sorted.xml $(CALENDAR_SUMMARY) $(STYLE) $(CALENDAR_SUMMARY)
|
||||
$(call xml_process)
|
||||
|
||||
# Pages:
|
||||
build/%.gmi: content/pages/%.xml $(STYLE) $(NAVIGATION) $(DATESTAMP) news.xml
|
||||
$(call xml_process)
|
||||
|
||||
build/calendar.gmi: content/pages/calendar.xml $(STYLE) $(NAVIGATION) $(DATESTAMP) $(CALENDAR_SUMMARY)
|
||||
$(call xml_process)
|
||||
|
||||
# News:
|
||||
build/news/%.gmi : BASEURL="../"
|
||||
build/news/%.gmi: content/news/%.xml $(STYLE) $(NAVIGATION) $(DATESTAMP)
|
||||
$(call xml_process)
|
||||
|
||||
### Mr. Propper ###
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(RM) $(CLEAN) news.xml
|
||||
$(RM) -r portal
|
|
@ -8,8 +8,8 @@
|
|||
vors Mikro zu holen um diese einer breiteren Öffentlichkeit bekannt
|
||||
zu machen.
|
||||
</p>
|
||||
<image title="(((pentamusic))" class="right">images/pentamusic.png</image>
|
||||
<p>
|
||||
<image title="(((pentamusic))" class="right">images/pentamusic.png</image>
|
||||
|
||||
Die Feeds der C3D2-News (<link href="news-rss.xml">RSS</link>, <link href="news-atom.xml">ATOM</link>) beinhalten die Mitschnitte als Podcasts.
|
||||
|
||||
|
|
|
@ -10,9 +10,8 @@
|
|||
ausgestrahlt wird, bestehend aus einem informativen Rahmenprogramm
|
||||
und Beiträgen zu einem sendungsspezifischen Thema.
|
||||
</p>
|
||||
<image title="(((pentradio))" class="right">images/pentaradio.png</image>
|
||||
<p>
|
||||
<image title="(((pentradio))" class="right">images/pentaradio.png</image>
|
||||
|
||||
Die Feeds der C3D2-News
|
||||
(<link href="news-rss.xml">RSS</link>, <link href="news-atom.xml">ATOM</link>)
|
||||
beinhalten die Mitschnitte als Podcasts.
|
||||
|
|
|
@ -0,0 +1,373 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<stylesheet version="1.0"
|
||||
xmlns="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:date="http://exslt.org/dates-and-times"
|
||||
xmlns:crypto="http://exslt.org/crypto">
|
||||
|
||||
<output method="text" encoding="utf-8"/>
|
||||
<strip-space elements="page item div p ul ol li blockquote"/>
|
||||
<include href="date.xsl"/>
|
||||
|
||||
<template match="/page">
|
||||
<variable name="title">
|
||||
<choose>
|
||||
<when test="/page/portal">
|
||||
C3D2.de
|
||||
</when>
|
||||
<when test="/page/@pagetitle">
|
||||
<value-of select="normalize-space(/page/@pagetitle)"/>
|
||||
</when>
|
||||
<when test="/page/@title">
|
||||
<value-of select="normalize-space(/page/@title)"/>
|
||||
</when>
|
||||
<when test="/page/calendar-summary">
|
||||
<call-template name="calendar-title"/>
|
||||
</when>
|
||||
<otherwise>
|
||||
<comment><text> missing title </text></comment>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</variable>
|
||||
|
||||
<call-template name="body">
|
||||
<with-param name="title" select="normalize-space($title)" />
|
||||
</call-template>
|
||||
</template>
|
||||
|
||||
<template match="/item">
|
||||
<variable name="title">
|
||||
<value-of select="/item/@title"/>
|
||||
</variable>
|
||||
|
||||
<call-template name="body">
|
||||
<with-param name="title" select="$title" />
|
||||
</call-template>
|
||||
</template>
|
||||
|
||||
<template name="body">
|
||||
<param name="title" />
|
||||
|
||||
<text># </text><value-of select="$title"/><text> </text>
|
||||
<text><<</>> Chaos Computer Club Dresden | c3d2 </text>
|
||||
|
||||
|
||||
<if test="/page/portal">
|
||||
<text>## Navigation </text>
|
||||
<for-each select="document('../content/navigation.xml')/navigation/group">
|
||||
<for-each select="file">
|
||||
<text>=> </text>
|
||||
<value-of select="concat($baseurl, ., '.gmi')"/>
|
||||
<text> </text>
|
||||
<choose>
|
||||
<when test="string-length(@title) = 0">
|
||||
<value-of select="document(concat('../content/pages/', ., '.xml'))/page/@title"/>
|
||||
</when>
|
||||
<otherwise>
|
||||
<value-of select="@title"/>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<text> </text>
|
||||
</for-each>
|
||||
</for-each>
|
||||
<text> </text>
|
||||
</if>
|
||||
|
||||
<apply-templates/>
|
||||
|
||||
<text> => </text>
|
||||
<value-of select="$baseurl"/>
|
||||
<text>portal.gmi Start </text>
|
||||
</template>
|
||||
|
||||
<!-- news -->
|
||||
|
||||
<template match="/page/news">
|
||||
<for-each select="newsfile">
|
||||
<sort select="date:seconds(document(concat('../', .))/item/@date)" data-type="number" order="descending" />
|
||||
<variable name="news" select="document(concat('../', .))"/>
|
||||
<if test="position() <= 10 and
|
||||
starts-with(
|
||||
date:difference(
|
||||
date:date-time(),
|
||||
concat($news/item/@date, '+02:00')
|
||||
),
|
||||
'-'
|
||||
)">
|
||||
|
||||
<variable name="newsfile"><value-of select="."/></variable>
|
||||
<variable name="itemposition" select="position()"/>
|
||||
|
||||
<for-each select="$news/item">
|
||||
<text>## </text>
|
||||
<value-of select="@title"/>
|
||||
<text> </text>
|
||||
|
||||
<call-template name="get-datestring">
|
||||
<with-param name="date" select="@date"/>
|
||||
</call-template>
|
||||
<text> von </text>
|
||||
<value-of select="@author"/>
|
||||
<text> </text>
|
||||
|
||||
<text>=> </text>
|
||||
<value-of select="substring-before(substring-after($newsfile, 'content/'), '.xml')"/>
|
||||
<text>.gmi News lesen </text>
|
||||
</for-each>
|
||||
</if>
|
||||
</for-each>
|
||||
|
||||
<text> </text>
|
||||
<text>=> news-atom.xml ATOM </text>
|
||||
<text>=> news-rss.xml RSS </text>
|
||||
<text>=> news-archiv.gmi Archiv </text>
|
||||
</template>
|
||||
|
||||
<template match="news-list">
|
||||
<variable name="prefix" select="@prefix"/>
|
||||
<variable name="details" select="@details"/>
|
||||
|
||||
<for-each select="document('../news.xml')/page/news/newsfile">
|
||||
<sort select="date:seconds(document(concat('../', .))/item/@date)" data-type="number" order="descending" />
|
||||
<variable name="newsfile" select="."/>
|
||||
<variable name="news" select="document(concat('../', $newsfile))"/>
|
||||
|
||||
<for-each select="$news/item">
|
||||
<if test="((string-length($prefix) = 0) or
|
||||
starts-with($newsfile, concat('content/news/', $prefix))) and
|
||||
(($details != 'resources-only') or
|
||||
(count(resource) > 0)) and
|
||||
starts-with(
|
||||
date:difference(
|
||||
date:date-time(),
|
||||
concat($news/item/@date, '+02:00')
|
||||
),
|
||||
'-'
|
||||
)">
|
||||
|
||||
<text>## </text>
|
||||
<value-of select="@title"/>
|
||||
<text> </text>
|
||||
|
||||
<call-template name="get-datestring">
|
||||
<with-param name="date" select="@date"/>
|
||||
</call-template>
|
||||
<text> von </text>
|
||||
<value-of select="@author"/>
|
||||
<text> </text>
|
||||
|
||||
<text>=> </text>
|
||||
<value-of select="substring-before(substring-after($newsfile, 'content/'), '.xml')"/>
|
||||
<text>.gmi News lesen </text>
|
||||
|
||||
</if>
|
||||
</for-each>
|
||||
</for-each>
|
||||
</template>
|
||||
|
||||
<!-- portal -->
|
||||
|
||||
<template match="/page/portal">
|
||||
<text>## Kalender </text>
|
||||
<call-template name="calendar-events">
|
||||
<with-param name="limit" select="10"/>
|
||||
</call-template>
|
||||
|
||||
<text>## Changelog </text>
|
||||
<apply-templates/>
|
||||
</template>
|
||||
|
||||
<template name="calendar-events">
|
||||
<param name="limit" select="5"/>
|
||||
|
||||
<for-each select="document('../calendar-summary.xml')/page/calendar-summary/event[date:seconds(end) >= date:seconds(date:date())]">
|
||||
<sort select="date:seconds(start)" data-type="number" order="ascending" />
|
||||
|
||||
<if test="position() <= $limit">
|
||||
<choose>
|
||||
<when test="string-length(link) > 0">
|
||||
<text>=> </text>
|
||||
<call-template name="make-href">
|
||||
<with-param name="href" select="link"/>
|
||||
</call-template>
|
||||
</when>
|
||||
<otherwise>
|
||||
<text>*</text>
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
<text> </text>
|
||||
<call-template name="datespan-to-human">
|
||||
<with-param name="start" select="start"/>
|
||||
<with-param name="end" select="end"/>
|
||||
</call-template>
|
||||
<text>: </text>
|
||||
<value-of select="title"/>
|
||||
<text> </text>
|
||||
</if>
|
||||
</for-each>
|
||||
</template>
|
||||
|
||||
<template match="/page/portal/item">
|
||||
<text>=> </text>
|
||||
<value-of select="link"/>
|
||||
<text> </text>
|
||||
<if test="content-text">
|
||||
<call-template name="normalize-paragraph">
|
||||
<with-param name="text" select="normalize-space(content-text)"/>
|
||||
</call-template>
|
||||
<text> (</text>
|
||||
</if>
|
||||
<call-template name="normalize-paragraph">
|
||||
<with-param name="text" select="normalize-space(header)"/>
|
||||
</call-template>
|
||||
<text> </text>
|
||||
<call-template name="normalize-paragraph">
|
||||
<with-param name="text" select="normalize-space(footer)"/>
|
||||
</call-template>
|
||||
<if test="content-text">
|
||||
<text>)</text>
|
||||
</if>
|
||||
<text> </text>
|
||||
</template>
|
||||
|
||||
<!-- content templates -->
|
||||
|
||||
<template match="*[name() = 'resource' or name() = 'alternative']">
|
||||
<variable name="url">
|
||||
<call-template name="make-href">
|
||||
<with-param name="href" select="@url"/>
|
||||
</call-template>
|
||||
</variable>
|
||||
|
||||
<text>=> </text>
|
||||
<value-of select="$url"/>
|
||||
<text> </text>
|
||||
<value-of select="@type"/>
|
||||
<text> (</text>
|
||||
<call-template name="format-filesize">
|
||||
<with-param name="value" select="@size"/>
|
||||
</call-template>
|
||||
<text>) </text>
|
||||
</template>
|
||||
|
||||
<template match="image"/>
|
||||
|
||||
<template match="ol">
|
||||
<apply-templates/>
|
||||
<text> </text>
|
||||
</template>
|
||||
|
||||
<template match="ul">
|
||||
<apply-templates/>
|
||||
<text> </text>
|
||||
</template>
|
||||
|
||||
<template match="li">
|
||||
<text>* </text>
|
||||
<call-template name="normalize-paragraph">
|
||||
<with-param name="text" select="normalize-space(.)"/>
|
||||
</call-template>
|
||||
<text> </text>
|
||||
</template>
|
||||
|
||||
<template match="p">
|
||||
<if test="@title">
|
||||
<text>## </text>
|
||||
<value-of select="@title"/>
|
||||
<text> </text>
|
||||
</if>
|
||||
|
||||
<call-template name="normalize-paragraph">
|
||||
<with-param name="text" select="normalize-space(.)"/>
|
||||
</call-template>
|
||||
<text> </text>
|
||||
|
||||
<call-template name="link-list"/>
|
||||
<text> </text>
|
||||
</template>
|
||||
|
||||
<template name="normalize-paragraph">
|
||||
<param name="text"/>
|
||||
|
||||
<choose>
|
||||
<when test="contains($text, ' ')">
|
||||
<value-of select="substring-before($text, ' ')"/>
|
||||
<call-template name="normalize-paragraph">
|
||||
<with-param name="text" select="substring-after($text, ' ')"/>
|
||||
</call-template>
|
||||
</when>
|
||||
<otherwise>
|
||||
<value-of select="$text"/>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</template>
|
||||
|
||||
<template name="link-list">
|
||||
<for-each select=".//link">
|
||||
<text>=> </text>
|
||||
<value-of select="@href"/>
|
||||
<text> </text>
|
||||
<choose>
|
||||
<when test="image/@title">
|
||||
<call-template name="normalize-paragraph">
|
||||
<with-param name="text" select="normalize-space(image/@title)"/>
|
||||
</call-template>
|
||||
</when>
|
||||
<otherwise>
|
||||
<call-template name="normalize-paragraph">
|
||||
<with-param name="text" select="normalize-space(.)"/>
|
||||
</call-template>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<text> </text>
|
||||
</for-each>
|
||||
</template>
|
||||
|
||||
<template match="xhtml:*">
|
||||
</template>
|
||||
|
||||
<!-- helpers -->
|
||||
|
||||
<template name="make-href">
|
||||
<param name="href"/>
|
||||
|
||||
<choose>
|
||||
<when test="$href and not(contains($href, ':')) and substring($href, string-length($href) - 4) = '.html'">
|
||||
<value-of select="concat($baseurl, substring-before($href, '.html'), '.gmi')"/>
|
||||
</when>
|
||||
<when test="$href and not(contains($href, ':'))">
|
||||
<value-of select="concat($baseurl, $href)"/>
|
||||
</when>
|
||||
<when test="$href">
|
||||
<value-of select="$href"/>
|
||||
</when>
|
||||
<otherwise>
|
||||
<value-of select="."/>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</template>
|
||||
|
||||
<template name="format-filesize">
|
||||
<param name="value"/>
|
||||
|
||||
<choose>
|
||||
<when test="$value > 1024 * 1024 * 1024">
|
||||
<value-of select="format-number($value div (1024 * 1024 * 1024), '0.0')"/>
|
||||
<text> GiB</text>
|
||||
</when>
|
||||
<when test="$value > 1024 * 1024">
|
||||
<value-of select="format-number($value div (1024 * 1024), '0.0')"/>
|
||||
<text> MiB</text>
|
||||
</when>
|
||||
<when test="$value > 1024">
|
||||
<value-of select="format-number($value div (1024), '0.0')"/>
|
||||
<text> KiB</text>
|
||||
</when>
|
||||
<otherwise>
|
||||
<value-of select="$value"/>
|
||||
<text> Byte</text>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</template>
|
||||
</stylesheet>
|
Loading…
Reference in New Issue