2022-03-04 20:58:31 +01:00
|
|
|
<?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"/>
|
2022-03-08 17:42:31 +01:00
|
|
|
<strip-space elements="page item addendum image event div p ul ol li blockquote"/>
|
2022-03-04 20:58:31 +01:00
|
|
|
<include href="date.xsl"/>
|
|
|
|
|
2022-03-08 18:02:04 +01:00
|
|
|
<template match="/page[portal]">
|
|
|
|
<text># c3d2.de </text>
|
|
|
|
<text>## <<</>> Chaos Computer Club Dresden </text>
|
|
|
|
|
|
|
|
<text>## Navigation </text>
|
|
|
|
<for-each select="document('../content/navigation.xml')/navigation/group">
|
2024-03-08 00:42:18 +01:00
|
|
|
<apply-templates mode="navitem" select="child::*"/>
|
|
|
|
<text> </text>
|
2022-03-08 18:02:04 +01:00
|
|
|
</for-each>
|
|
|
|
|
|
|
|
<call-template name="body"/>
|
2022-03-04 20:58:31 +01:00
|
|
|
</template>
|
|
|
|
|
2024-03-08 00:42:18 +01:00
|
|
|
<template mode="navitem" match="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>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template mode="navitem" match="link">
|
|
|
|
<text>=> </text>
|
|
|
|
<call-template name="make-href">
|
|
|
|
<with-param name="href">
|
|
|
|
<choose>
|
|
|
|
<when test="@href"><value-of select="@href"/></when>
|
|
|
|
<otherwise><value-of select="."/></otherwise>
|
|
|
|
</choose>
|
|
|
|
</with-param>
|
|
|
|
</call-template>
|
|
|
|
<text> </text>
|
|
|
|
<call-template name="normalize-paragraph">
|
|
|
|
<with-param name="text" select="normalize-space(.)"/>
|
|
|
|
</call-template>
|
|
|
|
<text> </text>
|
|
|
|
</template>
|
|
|
|
|
2022-03-08 18:02:04 +01:00
|
|
|
<template match="/page[@pagetitle]">
|
|
|
|
<text># </text><value-of select="@pagetitle"/><text> | c3d2.de </text>
|
2022-03-04 20:58:31 +01:00
|
|
|
|
2022-03-08 18:02:04 +01:00
|
|
|
<call-template name="body"/>
|
2022-03-04 20:58:31 +01:00
|
|
|
</template>
|
|
|
|
|
2022-03-08 18:02:04 +01:00
|
|
|
<template match="/page[@title]">
|
|
|
|
<text># </text><value-of select="@title"/><text> | c3d2.de </text>
|
|
|
|
|
|
|
|
<call-template name="body"/>
|
|
|
|
</template>
|
2022-03-04 20:58:31 +01:00
|
|
|
|
2022-03-08 18:02:04 +01:00
|
|
|
<template name="body">
|
2022-03-04 20:58:31 +01:00
|
|
|
<apply-templates/>
|
|
|
|
|
|
|
|
<text> => </text>
|
|
|
|
<value-of select="$baseurl"/>
|
2022-03-04 21:09:16 +01:00
|
|
|
<text>index.gmi Start </text>
|
2022-03-04 20:58:31 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<!-- news -->
|
2022-03-08 18:02:04 +01:00
|
|
|
|
|
|
|
<template match="/item">
|
|
|
|
<text># </text><value-of select="@title"/><text> | c3d2 </text>
|
|
|
|
|
|
|
|
<call-template name="get-datestring">
|
|
|
|
<with-param name="date" select="@date"/>
|
|
|
|
</call-template>
|
|
|
|
<text> von </text>
|
|
|
|
<value-of select="@author"/>
|
|
|
|
<text> </text>
|
|
|
|
|
|
|
|
<call-template name="body"/>
|
|
|
|
</template>
|
|
|
|
|
2022-03-04 20:58:31 +01:00
|
|
|
<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')
|
|
|
|
),
|
|
|
|
'-'
|
|
|
|
)">
|
2022-03-08 18:02:04 +01:00
|
|
|
|
2022-03-04 20:58:31 +01:00
|
|
|
<variable name="newsfile"><value-of select="."/></variable>
|
|
|
|
<variable name="itemposition" select="position()"/>
|
2022-03-08 18:02:04 +01:00
|
|
|
|
2022-03-04 20:58:31 +01:00
|
|
|
<for-each select="$news/item">
|
2022-03-05 00:56:39 +01:00
|
|
|
<text> ## </text>
|
2022-03-04 20:58:31 +01:00
|
|
|
<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"/>
|
2022-03-08 17:57:32 +01:00
|
|
|
<text> </text>
|
2022-03-04 20:58:31 +01:00
|
|
|
|
2022-06-29 00:44:52 +02:00
|
|
|
<apply-templates select="*[
|
|
|
|
name() = 'p' or name() = 'blockquote' or name() = 'ul' or name() = 'ol' or
|
|
|
|
name() = 'event' or name() = 'resource'
|
|
|
|
]"/>
|
2022-03-08 17:42:31 +01:00
|
|
|
|
2022-03-04 20:58:31 +01:00
|
|
|
<text>=> </text>
|
|
|
|
<value-of select="substring-before(substring-after($newsfile, 'content/'), '.xml')"/>
|
|
|
|
<text>.gmi News lesen </text>
|
|
|
|
</for-each>
|
|
|
|
</if>
|
|
|
|
</for-each>
|
|
|
|
|
2022-03-08 17:42:31 +01:00
|
|
|
<text> # Ressourcen </text>
|
2022-03-04 20:58:31 +01:00
|
|
|
<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')
|
|
|
|
),
|
|
|
|
'-'
|
|
|
|
)">
|
|
|
|
|
2022-03-05 00:56:39 +01:00
|
|
|
<text> ## </text>
|
2022-03-04 20:58:31 +01:00
|
|
|
<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 -->
|
2022-03-08 18:02:04 +01:00
|
|
|
|
2022-03-04 20:58:31 +01:00
|
|
|
<template match="/page/portal">
|
2022-03-05 00:56:39 +01:00
|
|
|
<text> ## Kalender </text>
|
2022-03-05 01:17:22 +01:00
|
|
|
<call-template name="calendar-events"/>
|
2022-03-08 18:02:04 +01:00
|
|
|
|
2022-03-05 00:56:39 +01:00
|
|
|
<text> ## Changelog </text>
|
2022-03-08 03:05:25 +01:00
|
|
|
<apply-templates select="item[position() <= 42]"/>
|
2022-03-04 20:58:31 +01:00
|
|
|
</template>
|
|
|
|
|
2022-03-05 01:17:22 +01:00
|
|
|
<template match="calendar">
|
|
|
|
<text> ## Kalender </text>
|
|
|
|
<call-template name="calendar-events">
|
|
|
|
<with-param name="limit" select="23"/>
|
|
|
|
<with-param name="src" select="@src"/>
|
|
|
|
</call-template>
|
2022-03-08 03:05:25 +01:00
|
|
|
<text> </text>
|
2022-03-05 01:17:22 +01:00
|
|
|
</template>
|
|
|
|
|
2022-03-04 20:58:31 +01:00
|
|
|
<template name="calendar-events">
|
2022-03-05 01:17:22 +01:00
|
|
|
<param name="limit" select="8"/>
|
|
|
|
<param name="src" select="'../calendar-summary.xml'"/>
|
2022-03-04 20:58:31 +01:00
|
|
|
|
2022-03-05 01:17:22 +01:00
|
|
|
<for-each select="document($src)/page/calendar-summary/event[date:seconds(end) >= date:seconds(date:date())]">
|
2022-03-04 20:58:31 +01:00
|
|
|
<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>
|
2022-03-05 01:21:28 +01:00
|
|
|
<call-template name="make-href">
|
|
|
|
<with-param name="href" select="link"/>
|
|
|
|
</call-template>
|
2022-03-04 20:58:31 +01:00
|
|
|
<text> </text>
|
2022-03-08 03:05:25 +01:00
|
|
|
<if test="@date">
|
|
|
|
<value-of select="substring-before(@date, 'T')"/>
|
|
|
|
<text> </text>
|
|
|
|
</if>
|
2022-03-04 20:58:31 +01:00
|
|
|
<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 -->
|
2022-03-08 18:02:04 +01:00
|
|
|
|
2022-03-04 20:58:31 +01:00
|
|
|
<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>
|
|
|
|
|
2022-03-08 17:42:31 +01:00
|
|
|
<template match="event">
|
2022-06-29 00:44:52 +02:00
|
|
|
<apply-templates/>
|
2022-03-08 17:42:31 +01:00
|
|
|
<text> </text>
|
|
|
|
</template>
|
|
|
|
|
2022-03-04 21:06:01 +01:00
|
|
|
<template match="event/start">
|
|
|
|
<text>* Beginn: </text>
|
|
|
|
<call-template name="get-datestring">
|
|
|
|
<with-param name="date" select="."/>
|
|
|
|
</call-template>
|
|
|
|
<text> </text>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template match="event/end">
|
|
|
|
<text>* Ende: </text>
|
|
|
|
<call-template name="get-datestring">
|
|
|
|
<with-param name="date" select="."/>
|
|
|
|
</call-template>
|
|
|
|
<text> </text>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template match="event/location">
|
|
|
|
<text>* Ort: </text>
|
|
|
|
<call-template name="normalize-paragraph">
|
|
|
|
<with-param name="text" select="normalize-space(.)"/>
|
|
|
|
</call-template>
|
|
|
|
<text> </text>
|
|
|
|
</template>
|
|
|
|
|
2022-03-04 20:58:31 +01:00
|
|
|
<template match="image"/>
|
|
|
|
|
|
|
|
<template match="ol">
|
|
|
|
<apply-templates/>
|
|
|
|
<text> </text>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template match="ul">
|
|
|
|
<apply-templates/>
|
|
|
|
<text> </text>
|
|
|
|
</template>
|
|
|
|
|
2022-03-05 04:26:02 +01:00
|
|
|
<template match="li[string(.) = string(link)]">
|
|
|
|
<text>=> </text>
|
|
|
|
<call-template name="make-href">
|
2022-03-08 18:27:47 +01:00
|
|
|
<with-param name="href">
|
|
|
|
<choose>
|
|
|
|
<when test="link/@href"><value-of select="link/@href"/></when>
|
|
|
|
<otherwise><value-of select="."/></otherwise>
|
|
|
|
</choose>
|
|
|
|
</with-param>
|
2022-03-05 04:26:02 +01:00
|
|
|
</call-template>
|
|
|
|
<text> </text>
|
|
|
|
<call-template name="normalize-paragraph">
|
|
|
|
<with-param name="text" select="normalize-space(link)"/>
|
|
|
|
</call-template>
|
|
|
|
<text> </text>
|
|
|
|
</template>
|
|
|
|
|
2022-03-04 20:58:31 +01:00
|
|
|
<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>
|
|
|
|
|
2022-03-04 21:06:01 +01:00
|
|
|
<template match="blockquote">
|
2022-03-05 00:56:39 +01:00
|
|
|
<text> ``` </text>
|
2022-03-04 21:06:01 +01:00
|
|
|
<apply-templates/>
|
2022-03-05 00:56:39 +01:00
|
|
|
<text> ``` </text>
|
2022-03-04 21:06:01 +01:00
|
|
|
</template>
|
|
|
|
|
2022-03-04 20:58:31 +01:00
|
|
|
<template name="normalize-paragraph">
|
|
|
|
<param name="text"/>
|
|
|
|
|
|
|
|
<choose>
|
2022-03-08 17:42:31 +01:00
|
|
|
<when test="contains($text, ' ')">
|
|
|
|
<value-of select="substring-before($text, ' ')"/>
|
2022-03-04 20:58:31 +01:00
|
|
|
<call-template name="normalize-paragraph">
|
2022-03-08 17:42:31 +01:00
|
|
|
<with-param name="text" select="substring-after($text, ' ')"/>
|
2022-03-04 20:58:31 +01:00
|
|
|
</call-template>
|
|
|
|
</when>
|
|
|
|
<otherwise>
|
|
|
|
<value-of select="$text"/>
|
|
|
|
</otherwise>
|
|
|
|
</choose>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template name="link-list">
|
|
|
|
<for-each select=".//link">
|
|
|
|
<text>=> </text>
|
2022-03-05 00:56:39 +01:00
|
|
|
<call-template name="make-href">
|
2022-03-08 18:27:47 +01:00
|
|
|
<with-param name="href">
|
|
|
|
<choose>
|
|
|
|
<when test="@href"><value-of select="@href"/></when>
|
|
|
|
<otherwise><value-of select="."/></otherwise>
|
|
|
|
</choose>
|
|
|
|
</with-param>
|
2022-03-05 00:56:39 +01:00
|
|
|
</call-template>
|
2022-03-04 20:58:31 +01:00
|
|
|
<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 -->
|
2022-03-08 18:02:04 +01:00
|
|
|
|
2022-03-04 20:58:31 +01:00
|
|
|
<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>
|