debian/changelog: release package version 1.4.0-1
[tweeper.git] / src / rss_converter_dilbert.com.xsl
index b6d1975..94d7fef 100644 (file)
@@ -1,7 +1,7 @@
 <!--
   Stylesheet to convert Dilbert daily strips to RSS.
 
 <!--
   Stylesheet to convert Dilbert daily strips to RSS.
 
-  Copyright (C) 2013-2014  Antonio Ospite <ao2@ao2.it>
+  Copyright (C) 2013-2018  Antonio Ospite <ao2@ao2.it>
 
   This file is part of tweeper.
 
 
   This file is part of tweeper.
 
 <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:php="http://php.net/xsl"
 <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:php="http://php.net/xsl"
-    xsl:extension-element-prefixes="php"
     exclude-result-prefixes="php">
 
     exclude-result-prefixes="php">
 
+    <xsl:param name="generate-enclosure"/>
+    <xsl:param name="show-multimedia"/>
+
     <xsl:output method="xml" indent="yes"/>
 
     <xsl:variable name="BaseURL" select="//meta[@property='og:url']/@content"/>
     <xsl:output method="xml" indent="yes"/>
 
     <xsl:variable name="BaseURL" select="//meta[@property='og:url']/@content"/>
                 <xsl:value-of select="$item-permalink"/>
             </guid>
             <pubDate>
                 <xsl:value-of select="$item-permalink"/>
             </guid>
             <pubDate>
-                <xsl:value-of select="php:functionString('Tweeper::strToRssDate', normalize-space(.//date))"/>
+                <xsl:value-of select="php:functionString('Tweeper\Tweeper::strToRssDate', normalize-space(.//date))"/>
             </pubDate>
             <description>
                 <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
             </pubDate>
             <description>
                 <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
-                <img src="{$picture-url}" alt="{$picture-title}"/>
+                <xsl:if test="$show-multimedia = 1">
+                    <img src="{$picture-url}" alt="{$picture-title}"/>
+                </xsl:if>
                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
             <xsl:if test="$generate-enclosure = 1">
                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
             <xsl:if test="$generate-enclosure = 1">
-                <xsl:copy-of select="php:functionString('Tweeper::generateEnclosure', $picture-url)"/>
+                <!--
+                    Dilbert.com uses protocol-relative urls for pictures but
+                    generateEnclosure() relies on curl which cannot work
+                    without a schema.
+
+                    Use http as protocol because curl gives some error when
+                    attempting TLS negotiation with the server where
+                    Dilbert.com assets are.
+                -->
+                <xsl:copy-of select="php:functionString('Tweeper\Tweeper::generateEnclosure', concat('http:', $picture-url))"/>
             </xsl:if>
         </item>
     </xsl:template>
             </xsl:if>
         </item>
     </xsl:template>