From: Antonio Ospite <ao2@ao2.it>
Date: Mon, 13 Aug 2018 15:17:41 +0000 (+0200)
Subject: src/rss_converter_twitter.com.xsl: add a label to tweets containing GIFs
X-Git-Tag: v1.4.0~16
X-Git-Url: https://git.ao2.it/tweeper.git/commitdiff_plain/da1c49e6f2d849221446cde331a3180f0246da71?ds=inline

src/rss_converter_twitter.com.xsl: add a label to tweets containing GIFs

The static scraped content only provides a preview of GIF files with the
first frame only, just like in the case of videos.

Set a label when a tweet contains a GIF so that the user can decide to
open the tweet in a full fledged browser to properly see the GIF.
---

diff --git a/src/rss_converter_twitter.com.xsl b/src/rss_converter_twitter.com.xsl
index 88f3b94..2cf1868 100644
--- a/src/rss_converter_twitter.com.xsl
+++ b/src/rss_converter_twitter.com.xsl
@@ -120,6 +120,7 @@
         <xsl:variable name="item-permalink" select="concat($BaseURL, .//div[@data-permalink-path]/@data-permalink-path)"/>
 
         <xsl:variable name="item-has-video" select="$item-media//*[contains(@class, 'PlayableMedia--video')]"/>
+        <xsl:variable name="item-has-gif" select="$item-media//*[contains(@class, 'PlayableMedia--gif')]"/>
         <item>
             <title>
                 <xsl:value-of select="concat($user-name, ': ')"/>
@@ -155,6 +156,10 @@
                     <xsl:text> (Video)</xsl:text>
                     <xsl:element name="br"/>
                 </xsl:if>
+                <xsl:if test="$item-has-gif">
+                    <xsl:text> (GIF)</xsl:text>
+                    <xsl:element name="br"/>
+                </xsl:if>
                 <xsl:element name="span">
                     <xsl:attribute name="style">white-space: pre-wrap;</xsl:attribute>
                     <xsl:apply-templates select="$item-content/node()"/>