handle torrent file links

This commit is contained in:
vv01f 2022-10-09 23:09:00 +02:00
parent b579a7fde9
commit 6bbd3d0867
4 changed files with 26 additions and 6 deletions

View File

@ -37,9 +37,13 @@
<link filesize="">pdfs/ds105.pdf</link>
<link filesize="">epubs/ds105.epub</link>
-->
<link filesize="4710515">vorab/ds105_sticker.zip</link>
<!--
<link filesize="4710515">105/sticker.zip</link>
<link filesize="575">105/sticker.zip.torrent</link>
-->
<preface>editorial/ds105.html</preface>
<references>references/ds105.html</references>
<info date="Wed, 05 Oct 2022 13:37 +0000">Die Sticker zur Ausgabe #105 sind nun ebenfalls online verfügbar (<a href="magnet:?xt=urn:btih:1b80b75274e4c2a6b91f5320c4526bf8df48f8ed&amp;dn=sticker.zip&amp;tr=http%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&amp;ws=https%3A%2F%2Fds.ccc.de%2F105%2Fsticker.zip">Magnet-Link</a>, <a href="105/sticker.zip.torrent">Torrent-Datei</a>).</info>
<info date="Tue, 12 Jul 2022 07:23 +0000">Nach Anpassungen der LaTeX-Klasse für die Ausgabe von ePUB ist nun auch die schon länger in den Regalen stehende Ausgabe #103 online.</info>
</schleuder>
<schleuder id="104" printonly="printonly">

View File

@ -51,6 +51,7 @@
<xsl:when test="substring($link, string-length($link) - 3) = 'html'">html</xsl:when>
<xsl:when test="substring($link, string-length($link) - 2) = 'pdf'">pdf</xsl:when>
<xsl:when test="substring($link, string-length($link) - 2) = 'zip'">other</xsl:when>
<xsl:when test="substring($link, string-length($link) - 6) = 'torrent'">other</xsl:when>
<xsl:otherwise>unknown</xsl:otherwise>
</xsl:choose>
</xsl:variable>
@ -166,6 +167,7 @@
<xsl:when test="substring($linkdata, string-length($linkdata) - 3) = 'epub'">epub</xsl:when>
<xsl:when test="substring($linkdata, string-length($linkdata) - 3) = 'html'">html</xsl:when>
<xsl:when test="substring($linkdata, string-length($linkdata) - 2) = 'zip'">other</xsl:when>
<xsl:when test="substring($linkdata, string-length($linkdata) - 6) = 'torrent'">other</xsl:when>
<xsl:otherwise>unknown</xsl:otherwise>
</xsl:choose>
</xsl:variable>

View File

@ -118,12 +118,12 @@ time { font-family: Arial, sans-serif; font-size: 10pt; }</xsl:text>
<xsl:for-each select="schleuder">
<xsl:if test="count(info)&gt;0">
<xsl:element name="p">
<xsl:element name="div">
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
<xsl:text>&#xa;</xsl:text>
<xsl:for-each select="info">
<p>
<xsl:element name="time">
<xsl:attribute name="datetime">
<xsl:if test="not(@date)"><xsl:value-of select="date"/></xsl:if>
@ -134,8 +134,9 @@ time { font-family: Arial, sans-serif; font-size: 10pt; }</xsl:text>
</xsl:call-template>
</xsl:element><br/><xsl:text>&#xa;</xsl:text>
<xsl:copy-of select="./node()" />
<xsl:text>&#xa;</xsl:text>
<xsl:copy-of select="./node()" />
<xsl:text>&#xa;</xsl:text>
</p>
</xsl:for-each>
</xsl:element><xsl:text>&#xa;</xsl:text>

15
rss.xsl
View File

@ -103,7 +103,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
<xsl:text>&#10;&#9;&#9;</xsl:text>
</xsl:if>
<xsl:for-each select="link">
<xsl:for-each select="link"><!-- files to link, bit maybe not add as enclosure -->
<!--
<xsl:if test="((position() &gt; 1) and ($limitenclosures = 1))">
-->
@ -113,6 +113,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
<xsl:when test="substring(., string-length(.) - 2) = 'zip'">ZIP</xsl:when>
<xsl:when test="substring(., string-length(.) - 3) = 'html'">HTML</xsl:when>
<xsl:when test="substring(., string-length(.) - 3) = 'epub'">ePUB</xsl:when>
<xsl:when test="substring(., string-length(.) - 6) = 'torrent'">Torrent</xsl:when>
<xsl:otherwise>unknown</xsl:otherwise>
</xsl:choose>
</xsl:variable>
@ -161,6 +162,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
<xsl:when test="substring($href, string-length($href) - 2) = 'zip'">zip</xsl:when>
<xsl:when test="substring($href, string-length($href) - 3) = 'html'">html</xsl:when>
<xsl:when test="substring($href, string-length($href) - 3) = 'epub'">epub</xsl:when>
<xsl:when test="substring($href, string-length($href) - 6) = 'torrent'">torrent</xsl:when>
<xsl:otherwise>unknown</xsl:otherwise>
</xsl:choose>
</xsl:variable>
@ -203,6 +205,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
</xsl:element><xsl:text>&#10;&#9;</xsl:text>
</xsl:when>
<!--
<xsl:when test="$type = 'zip'">
<xsl:element name="enclosure">
@ -212,6 +215,16 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
</xsl:element><xsl:text>&#10;&#9;</xsl:text>
</xsl:when>
-->
<xsl:when test="$type = 'torrent'">
<xsl:element name="enclosure">
<xsl:attribute name="url"><xsl:value-of select="$href"/></xsl:attribute>
<xsl:attribute name="length"><xsl:value-of select="$filesize"/></xsl:attribute>
<xsl:attribute name="type">application/octet-stream</xsl:attribute>
</xsl:element><xsl:text>&#10;&#9;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:element name="enclosure">
<xsl:attribute name="url"><xsl:value-of select="$href"/></xsl:attribute>