ATOM, RSS, Podcast feeds: <link rel="payment"/> to Flattr

http://developers.flattr.net/feed/

No support in podcatchers /yet/.
This commit is contained in:
Astro 2012-02-04 02:34:41 +01:00
parent 5f5758d9da
commit da72afd816
4 changed files with 45 additions and 0 deletions

View File

@ -90,6 +90,15 @@
length="{@size}" />
</xsl:for-each>
<xsl:variable name="flattr_link">
<xsl:call-template name="make-flattr-link">
<xsl:with-param name="newsfile" select="$newsfile"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="string-length($flattr_link) &gt; 0">
<link rel="payment" href="{$flattr_link}" type="text/html"/>
</xsl:if>
</entry>
</xsl:template>

View File

@ -561,4 +561,21 @@
</xsl:choose>
</xsl:template>
<xsl:template name="make-flattr-link">
<xsl:param name="newsfile"/>
<xsl:choose>
<xsl:when test="contains($newsfile, '/')">
<!-- Recurse w/o directory part until bare filename -->
<xsl:call-template name="make-flattr-link">
<xsl:with-param name="newsfile" select="substring-after($newsfile, '/')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="starts-with($newsfile, 'pentaradio24-')">https://flattr.com/thing/51034/Pentaradio-24</xsl:when>
<xsl:when test="starts-with($newsfile, 'pentacast-')">https://flattr.com/thing/51037/Pentacast</xsl:when>
<xsl:when test="starts-with($newsfile, 'pentamusic-')">https://flattr.com/thing/51039/Pentamusic</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -9,6 +9,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:atom="http://www.w3.org/2005/Atom"
exclude-result-prefixes="xsl date">
<xsl:output method="xml"
@ -241,6 +242,14 @@
<itunes:subtitle><xsl:value-of select="$resource_title"/></itunes:subtitle>
<itunes:author>CCC Dresden</itunes:author>
<xsl:variable name="flattr_link">
<xsl:call-template name="make-flattr-link">
<xsl:with-param name="newsfile" select="$newsfile"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="string-length($flattr_link) &gt; 0">
<atom:link rel="payment" href="{$flattr_link}" type="text/html"/>
</xsl:if>
</item>
</xsl:template>

View File

@ -3,6 +3,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:atom="http://www.w3.org/2005/Atom"
exclude-result-prefixes="xsl date">
<xsl:include href="common.xsl" />
@ -108,6 +109,15 @@
</div>
<xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
</content:encoded>
<xsl:variable name="flattr_link">
<xsl:call-template name="make-flattr-link">
<xsl:with-param name="newsfile" select="$newsfile"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="string-length($flattr_link) &gt; 0">
<atom:link rel="payment" href="{$flattr_link}" type="text/html"/>
</xsl:if>
</item>
</xsl:template>