projects
/
tweeper.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
debian/changelog: release package version 1.4.0-1
[tweeper.git]
/
src
/
rss_converter_twitter.com.xsl
diff --git
a/src/rss_converter_twitter.com.xsl
b/src/rss_converter_twitter.com.xsl
index
d1514c5
..
1c20e70
100644
(file)
--- a/
src/rss_converter_twitter.com.xsl
+++ b/
src/rss_converter_twitter.com.xsl
@@
-21,10
+21,11
@@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl"
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl"
- xsl:extension-element-prefixes="php"
exclude-result-prefixes="php">
<xsl:param name="generate-enclosure"/>
exclude-result-prefixes="php">
<xsl:param name="generate-enclosure"/>
+ <xsl:param name="show-usernames"/>
+ <xsl:param name="show-multimedia"/>
<xsl:output method="xml" indent="yes"/>
<xsl:output method="xml" indent="yes"/>
@@
-35,6
+36,11
@@
<!-- Identity transform -->
<xsl:template match="@*|node()">
<xsl:copy>
<!-- Identity transform -->
<xsl:template match="@*|node()">
<xsl:copy>
+ <!--
+ Strip the style attribute while copying elements because it may be
+ dangerous, see:
+ https://validator.w3.org/feed/docs/warning/DangerousStyleAttr.html
+ -->
<xsl:apply-templates select="@*[not(name() = 'style')]|node()"/>
</xsl:copy>
</xsl:template>
<xsl:apply-templates select="@*[not(name() = 'style')]|node()"/>
</xsl:copy>
</xsl:template>
@@
-67,15
+73,17
@@
too instead of the t.co redirections.
-->
<xsl:template match="a[@data-pre-embedded='true']">
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: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:template>
<!-- Present images in a more convenient way -->
@@
-84,7
+92,7
@@
<xsl:attribute name="href">
<xsl:value-of select="concat(@data-image-url, ':orig')"/>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="concat(@data-image-url, ':orig')"/>
</xsl:attribute>
- <img>
+ <img
style="max-width: 100%"
>
<xsl:attribute name="src">
<xsl:value-of select="@data-image-url"/>
</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="@data-image-url"/>
</xsl:attribute>
@@
-97,7
+105,7
@@
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="style">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="style">
- <xsl:value-of select="concat(@style, '; background-repeat: no-repeat')"/>
+ <xsl:value-of select="concat(@style, '; background-repeat: no-repeat
; background-size: 100% auto
')"/>
</xsl:attribute>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:attribute>
<xsl:apply-templates select="node()"/>
</xsl:copy>
@@
-120,9
+128,12
@@
<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-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>
<item>
<title>
- <xsl:value-of select="concat($user-name, ': ')"/>
+ <xsl:if test="($show-usernames = 1) or ($screen-name != $user-name)">
+ <xsl:value-of select="concat($user-name, ': ')"/>
+ </xsl:if>
<xsl:if test="$item-has-video">
<xsl:text>(Video) </xsl:text>
</xsl:if>
<xsl:if test="$item-has-video">
<xsl:text>(Video) </xsl:text>
</xsl:if>
@@
-149,17
+160,25
@@
</pubDate>
<description>
<xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
</pubDate>
<description>
<xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
- <xsl:value-of select="concat($user-name, ':')"/>
- <xsl:element name="br"/>
+ <xsl:if test="($show-usernames = 1) or ($screen-name != $user-name)">
+ <xsl:value-of select="concat($user-name, ':')"/>
+ <xsl:element name="br"/>
+ </xsl:if>
<xsl:if test="$item-has-video">
<xsl:text> (Video)</xsl:text>
<xsl:element name="br"/>
</xsl:if>
<xsl:if test="$item-has-video">
<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()"/>
</xsl:element>
<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:if test="$show-multimedia = 1">
+ <xsl:apply-templates select="$item-media/node()"/>
+ </xsl:if>
<xsl:text disable-output-escaping="yes">]]></xsl:text>
</description>
<xsl:if test="$generate-enclosure = 1">
<xsl:text disable-output-escaping="yes">]]></xsl:text>
</description>
<xsl:if test="$generate-enclosure = 1">