xsl/gemini.xsl: tidy up
c3d2-web build failure Details
c3d2-gemini deployed Details

This commit is contained in:
Astro 2022-03-08 18:02:04 +01:00
parent 73e22d6a38
commit 5f8400b5aa
1 changed files with 53 additions and 65 deletions

View File

@ -8,71 +8,46 @@
<output method="text" encoding="utf-8"/>
<strip-space elements="page item addendum image event 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 match="/page[portal]">
<text># c3d2.de&#10;</text>
<text>## &lt;&lt;&lt;/&gt;&gt; Chaos Computer Club Dresden&#10;&#10;</text>
<text>## Navigation&#10;</text>
<for-each select="document('../content/navigation.xml')/navigation/group">
<for-each select="file">
<text>=&gt; </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>&#10;</text>
</for-each>
</for-each>
<text>&#10;</text>
<call-template name="body"/>
</template>
<template match="/item">
<variable name="title">
<value-of select="/item/@title"/>
</variable>
<template match="/page[@pagetitle]">
<text># </text><value-of select="@pagetitle"/><text> | c3d2.de&#10;</text>
<call-template name="body">
<with-param name="title" select="$title" />
</call-template>
<call-template name="body"/>
</template>
<template match="/page[@title]">
<text># </text><value-of select="@title"/><text> | c3d2.de&#10;</text>
<call-template name="body"/>
</template>
<template name="body">
<param name="title" />
<text># </text><value-of select="$title"/><text>&#10;</text>
<text>## &lt;&lt;&lt;/&gt;&gt; Chaos Computer Club Dresden | c3d2&#10;&#10;</text>
<if test="/page/portal">
<text>## Navigation&#10;</text>
<for-each select="document('../content/navigation.xml')/navigation/group">
<for-each select="file">
<text>=&gt; </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>&#10;</text>
</for-each>
</for-each>
<text>&#10;</text>
</if>
<apply-templates/>
<text>&#10;&#10;=> </text>
@ -81,7 +56,20 @@
</template>
<!-- news -->
<template match="/item">
<text># </text><value-of select="@title"/><text> | c3d2&#10;</text>
<call-template name="get-datestring">
<with-param name="date" select="@date"/>
</call-template>
<text> von </text>
<value-of select="@author"/>
<text>&#10;&#10;</text>
<call-template name="body"/>
</template>
<template match="/page/news">
<for-each select="newsfile">
<sort select="date:seconds(document(concat('../', .))/item/@date)" data-type="number" order="descending" />
@ -94,10 +82,10 @@
),
'-'
)">
<variable name="newsfile"><value-of select="."/></variable>
<variable name="itemposition" select="position()"/>
<for-each select="$news/item">
<text>&#10;## </text>
<value-of select="@title"/>
@ -168,11 +156,11 @@
</template>
<!-- portal -->
<template match="/page/portal">
<text>&#10;## Kalender&#10;</text>
<call-template name="calendar-events"/>
<text>&#10;## Changelog&#10;</text>
<apply-templates select="item[position() &lt;= 42]"/>
</template>
@ -248,7 +236,7 @@
</template>
<!-- content templates -->
<template match="*[name() = 'resource' or name() = 'alternative']">
<variable name="url">
<call-template name="make-href">
@ -392,7 +380,7 @@
</template>
<!-- helpers -->
<template name="make-href">
<param name="href"/>