add links to 'other' files, here zip

This commit is contained in:
vv01f 2022-10-09 17:23:54 +02:00
parent d47a93e10a
commit b579a7fde9
4 changed files with 63 additions and 28 deletions

View File

@ -22,13 +22,22 @@
]>
<schleudern>
<schleuder id="105" printonly="printonly">
<!--
<schleuder id="106" printonly="printonly">
<date>Fri, 01 Apr 2022 19:38 +0200</date>
<image>covers/ds106.png</image>
<link filesize="">pdfs/ds106.pdf</link>
<link filesize="">epubs/ds106.epub</link>
</schleuder>
-->
<schleuder id="105">
<date>Fri, 01 Apr 2022 19:38 +0200</date>
<image>covers/ds105.png</image>
<!--
<link filesize="">pdfs/ds105.pdf</link>
<link filesize="">epubs/ds105.epub</link>
-->
<link filesize="4710515">vorab/ds105_sticker.zip</link>
<preface>editorial/ds105.html</preface>
<references>references/ds105.html</references>
<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>
@ -677,7 +686,7 @@ Zudem gibt es einen neuen Redaktions-PGP-Key, erhältlich auf allen Keyservern o
<schleuder id="1">
<image>covers/ds001.png</image>
<link>pdfs/ds001.pdf</link>
<filesize>486824</filesize>
<filesize>490571</filesize>
<!--date>1984</date-->
</schleuder>
</schleudern>

View File

@ -35,7 +35,10 @@
<xsl:element name="div">
<xsl:attribute name="id">schleudern</xsl:attribute>
<xsl:attribute name="class">schleudern</xsl:attribute>
<xsl:for-each select="schleuder"><xsl:if test="not(@printonly)">
<xsl:for-each select="schleuder">
<!--
<xsl:if test="not(@printonly)">
-->
<xsl:variable name="id">
<xsl:value-of select="@id"/>
</xsl:variable>
@ -47,6 +50,7 @@
<xsl:choose>
<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:otherwise>unknown</xsl:otherwise>
</xsl:choose>
</xsl:variable>
@ -138,7 +142,10 @@
</xsl:element>
</xsl:if>
</xsl:element>
</xsl:if></xsl:for-each>
<!--
</xsl:if>
-->
</xsl:for-each>
<xsl:element name="div">
<xsl:attribute name="style">clear: left</xsl:attribute>
</xsl:element>
@ -158,6 +165,7 @@
<xsl:when test="substring($linkdata, string-length($linkdata) - 2) = 'pdf'">pdf</xsl:when>
<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:otherwise>unknown</xsl:otherwise>
</xsl:choose>
</xsl:variable>

48
gen.sh
View File

@ -170,7 +170,30 @@ newdataentry () {
} || { printf "next argument not a number. using actual system time.\n"; datetime=0; } # remaining arguments should be teaser xml-message.
printf "using UTC (+0000) for expressing the timezone.\n"
printf "\n<schleuder id=\"$newentry\">\n"
imagelist=""
filelist=""
for d in covers pdfs epubs ; do
case "$d" in
covers) ffn=${d}"/"${fn}".jpg"; cover=$ffn ;;
pdfs) ffn=${d}"/"${fn}".pdf" ;;
epubs) ffn=${d}"/"${fn}".epub" ;;
#~ *) printf "file "${ffn}" not found, in "${d}".\n" ;;
esac
test -e ${customdir}"/"${ffn} && {
test "$d" = "covers" && {
imagelist="${imagelist}\t<image>"${cover}"</image>\n"
} || {
fs=$(wc -c <${customdir}"/"${ffn})
filelist="${filelist}\t<link filesize=\"%d\">%s</link>\n" "${fs}" "${ffn}"
}
} || {
mfl=${mfl}" "${ffn}"\n"
#~ printf "file "${ffn}" not found.\n"
err=3
}
done
test -z "${filelist}" && printonly=" printonly=\"printonly\"" || printonly=""
printf "\n<schleuder id=\"$newentry\"${printonly}>\n"
# todo: switch for dtg, integrate custom datetime input early
# or simply implement xslt for handling ISO and nothing else for input
# RFC-5322-Format without seconds using the current timezone
@ -192,27 +215,8 @@ newdataentry () {
}
printf "\t<date>%s %s</date>\n" "${datetime}" "${tz}" # custom format universal time
fn="ds"$(printf "%03d" $newentry)
for d in covers pdfs epubs ; do
case "$d" in
covers) ffn=${d}"/"${fn}".jpg"; cover=$ffn ;;
pdfs) ffn=${d}"/"${fn}".pdf" ;;
epubs) ffn=${d}"/"${fn}".epub" ;;
#~ *) printf "file "${ffn}" not found, in "${d}".\n" ;;
esac
#~ printf "$ffn\n"
test -e ${customdir}"/"${ffn} && {
test "$d" = "covers" && {
printf "\t<image>"${cover}"</image>\n"
} || {
fs=$(wc -c <${customdir}"/"${ffn})
printf "\t<link filesize=\"%d\">%s</link>\n" "${fs}" "${ffn}"
}
} || {
mfl=${mfl}" "${ffn}"\n"
#~ printf "file "${ffn}" not found.\n"
err=3
}
done
printf "${imagelist}"
printf "${filelist}"
#~ printf "\t<preface></preface>\n" # not used on server yet
test $# -eq 0 && { teaser="" ; } || {
teaser="$@";

18
rss.xsl
View File

@ -110,6 +110,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
<xsl:variable name="type">
<xsl:choose>
<xsl:when test="substring(., string-length(.) - 2) = 'pdf'">PDF</xsl:when>
<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:otherwise>unknown</xsl:otherwise>
@ -157,6 +158,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
<xsl:variable name="type">
<xsl:choose>
<xsl:when test="substring($href, string-length($href) - 2) = 'pdf'">pdf</xsl:when>
<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:otherwise>unknown</xsl:otherwise>
@ -201,10 +203,22 @@ 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">
<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/zip</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>
<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:otherwise>
-->
</xsl:choose>
</xsl:if>