Tweeper.php: fix Invalid Character Error when converting Instagram json to XML
[tweeper.git] / src / rss_converter_twitter.com.xsl
index b59a97b..e14eaac 100644 (file)
@@ -1,7 +1,7 @@
 <!--
   Stylesheet to convert Twitter user timelines to RSS.
 
-  Copyright (C) 2013-2018  Antonio Ospite <ao2@ao2.it>
+  Copyright (C) 2013-2020  Antonio Ospite <ao2@ao2.it>
 
   This file is part of tweeper.
 
@@ -25,6 +25,7 @@
 
     <xsl:param name="generate-enclosure"/>
     <xsl:param name="show-usernames"/>
+    <xsl:param name="show-multimedia"/>
 
     <xsl:output method="xml" indent="yes"/>
 
          too instead of the t.co redirections.
     -->
     <xsl:template match="a[@data-pre-embedded='true']">
-        <!-- Prepend and append a white space for aestethic reasons -->
-        <xsl:text> </xsl:text>
-        <a>
-            <xsl:attribute name="href">
+        <xsl:if test="$show-multimedia = 1">
+            <!-- Prepend and append a white space for aestethic reasons -->
+            <xsl:text> </xsl:text>
+            <a>
+                <xsl:attribute name="href">
+                    <xsl:value-of select="concat('https://', .)"/>
+                </xsl:attribute>
                 <xsl:value-of select="concat('https://', .)"/>
-            </xsl:attribute>
-            <xsl:value-of select="concat('https://', .)"/>
-        </a>
-        <xsl:text> </xsl:text>
+            </a>
+            <xsl:text> </xsl:text>
+        </xsl:if>
     </xsl:template>
 
     <!-- Present images in a more convenient way -->
                     <xsl:attribute name="style">white-space: pre-wrap;</xsl:attribute>
                     <xsl:apply-templates select="$item-content/node()"/>
                 </xsl:element>
-                <xsl:apply-templates select="$item-media/node()"/>
+                <xsl:if test="$show-multimedia = 1">
+                    <xsl:apply-templates select="$item-media/node()"/>
+                </xsl:if>
                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
             <xsl:if test="$generate-enclosure = 1">