rss_converter_twitter.com.xsl: preserve spaces in tweet content
authorAntonio Ospite <ao2@ao2.it>
Fri, 23 Feb 2018 14:34:02 +0000 (15:34 +0100)
committerAntonio Ospite <ao2@ao2.it>
Fri, 23 Feb 2018 16:12:39 +0000 (17:12 +0100)
Wrap the tweet content into a span element with a CSS style attribute
set to "white-space: pre-wrap", this allows to have the spaces rendered
like on the twitter web page: with spaces and newlines preserved.

This is especially desirable if the tweet content contains any ASCII
art, like in https://twitter.com/sarahjeong/status/955651919279722496

src/rss_converter_twitter.com.xsl

index b6b4257..44a0416 100644 (file)
                     <xsl:text>(Video)</xsl:text>
                     <xsl:element name="br"/>
                 </xsl:if>
-                <xsl:apply-templates select="$item-content/node()"/>
+                <xsl:element name="span">
+                    <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:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>