tweeper.php: fix a problem with https URLs ending up in the enclosure element
[tweeper.git] / rss_converter_twitter.com.xsl
index dbbc537..c154141 100644 (file)
     </xsl:template>
 
     <xsl:template match="a[@data-expanded-url]" mode="enclosure">
-        <xsl:copy-of select="php:function('Tweeper::generateEnclosure', string(./@data-expanded-url))"/>
+        <xsl:copy-of select="php:functionString('Tweeper::generateEnclosure', ./@data-expanded-url)"/>
+    </xsl:template>
+
+    <xsl:template match="div[@data-image-url]" mode="enclosure">
+        <xsl:copy-of select="php:functionString('Tweeper::generateEnclosure', concat(./@data-image-url, ':orig'))"/>
     </xsl:template>
 
     <xsl:variable name="screen-name" select="//div[@class='user-actions btn-group not-following ']/@data-screen-name"/>
                 -->
                 <xsl:variable
                     name="processed-title"
-                    select="php:function('preg_replace', '@((?&lt;!\()(?:http[s]?://|pic.twitter.com))@', ' \1', string($item-content))"/>
+                    select="php:functionString('preg_replace', '@((?&lt;!\()(?:http[s]?://|pic.twitter.com))@', ' \1', $item-content)"/>
                 <!-- Also strip &nbsp; and &hellip; -->
                 <xsl:value-of select="normalize-space(translate($processed-title, '&#xA0;&#x2026;', ''))"/>
             </title>
             </description>
             <xsl:if test="$generate-enclosure = 1">
                 <xsl:apply-templates select="$item-content//a[@data-expanded-url]" mode="enclosure"/>
+                <xsl:apply-templates select="$item-media//div[@data-image-url]" mode="enclosure"/>
             </xsl:if>
         </item>
     </xsl:template>