From: Antonio Ospite <ao2@ao2.it> Date: Wed, 18 May 2016 20:41:54 +0000 (+0200) Subject: rss_converter_twitter.com.xsl: cleanup titles X-Git-Tag: v0.6~24 X-Git-Url: https://git.ao2.it/tweeper.git/commitdiff_plain/5b6ed12927fe2a9ff14d1a286cfa467efd1ebbfe?ds=sidebyside;hp=7a4dbe25b0005af8f330ac4fd48c50054a3893c3 rss_converter_twitter.com.xsl: cleanup titles Prepend a white space in front of some URLs (those not preceded by an open parenthesis) because otherwise they get rendered attached to the preceding text. Also strip non-breaking spaces and horizontal ellipses, they are not needed because the RSS feed show the full URLs. --- diff --git a/rss_converter_twitter.com.xsl b/rss_converter_twitter.com.xsl index 6ef86dd..b7c7124 100644 --- a/rss_converter_twitter.com.xsl +++ b/rss_converter_twitter.com.xsl @@ -44,7 +44,17 @@ <xsl:variable name="item-permalink" select="concat($BaseURL, .//div[@data-permalink-path]/@data-permalink-path)"/> <item> <title> - <xsl:value-of select="concat($user-name, ': ', $item-content)"/> + <xsl:value-of select="concat($user-name, ': ')"/> + <!-- + Prepend a space in front of the URLs which are not + preceded by an open parenthesis, for aestethic reasons. + Also, regex, I know: http://xkcd.com/1171/ + --> + <xsl:variable + name="processed-title" + select="php:function('preg_replace', '@((?<!\()(?:http[s]?://|pic.twitter.com))@', ' \1', string($item-content))"/> + <!-- Also strip and … --> + <xsl:value-of select="normalize-space(translate($processed-title, ' …', ''))"/> </title> <link> <xsl:value-of select="$item-permalink"/>