From: Antonio Ospite <ospite@studenti.unina.it>
Date: Sat, 6 Jul 2013 23:22:47 +0000 (+0200)
Subject: Embed the full HTML content of the tweet in the description field
X-Git-Tag: v0.1~35
X-Git-Url: https://git.ao2.it/tweeper.git/commitdiff_plain/1c17fb1edd46f24311fa2e4ad97be6ff46fd3156?ds=sidebyside

Embed the full HTML content of the tweet in the description field

Use CDATA to embed the exact copy of an element; it is neat and we get
click-able links in the feed reader for free.
---

diff --git a/twitter_user_timeline2rss.xsl b/twitter_user_timeline2rss.xsl
index b70cd07..6d72ceb 100644
--- a/twitter_user_timeline2rss.xsl
+++ b/twitter_user_timeline2rss.xsl
@@ -31,15 +31,12 @@
 
     <xsl:variable name="screen-name" select="//div[@class='profile-card-inner']/@data-screen-name"/>
 
-    <!-- TODO: make URLs hyperlinked (http://www.dpawson.co.uk/xsl/rev2/regex2.html) -->
-    <xsl:template name="tweet" match="//p[@class='js-tweet-text tweet-text']">
-        <xsl:value-of select="$screen-name"/>: <xsl:value-of select=".//p[@class='js-tweet-text tweet-text']"/>
-    </xsl:template>
-
     <xsl:template match="//div[@id='timeline']//ol[@id='stream-items-id']//li[@data-item-type='tweet']">
+        <xsl:variable name="tweet-text" select=".//p[@class='js-tweet-text tweet-text']"/>
         <item>
             <title>
-                <xsl:call-template name="tweet"/>
+                <xsl:value-of select="concat($screen-name, ': ')"/>
+                <xsl:value-of select="$tweet-text"/>
             </title>
             <link>
                 <xsl:value-of select="$twitterBaseURL"/><xsl:value-of select=".//a[@class='details with-icn js-details']/@href"/>
@@ -48,7 +45,10 @@
                 <xsl:value-of select="php:functionString('formatDate', .//small[@class='time']//span/@data-time)"/>
             </pubDate>
             <description>
-                <xsl:call-template name="tweet"/>
+                <xsl:value-of select="concat($screen-name, ': ')"/>
+                <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
+                <xsl:copy-of select="$tweet-text/node()"/>
+                <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
         </item>
     </xsl:template>