X-Git-Url: https://git.ao2.it/tweeper.git/blobdiff_plain/2bcb8505afe0be35329589845f835c9a64d709a8..01dfd03d97afd0d5d06a36af37d96892905340ad:/src/rss_converter_instagram.com.xsl diff --git a/src/rss_converter_instagram.com.xsl b/src/rss_converter_instagram.com.xsl index 2d54f3d..01bd3d1 100644 --- a/src/rss_converter_instagram.com.xsl +++ b/src/rss_converter_instagram.com.xsl @@ -21,10 +21,10 @@ + @@ -44,11 +44,16 @@ + + + + + @@ -65,7 +70,12 @@ <xsl:variable name="title-length" select="140"/> - <xsl:variable name="item-content-title" select="normalize-space(concat($screen-name, ': ', $item-content-caption))"/> + <xsl:variable name="item-content-title"> + <xsl:if test="$show-usernames = 1"> + <xsl:value-of select="concat($screen-name, ': ')"/> + </xsl:if> + <xsl:value-of select="normalize-space($item-content-caption)"/> + </xsl:variable> <!-- ellipsize, inspired from http://stackoverflow.com/questions/13622338 --> <xsl:choose> <xsl:when test="string-length($item-content-title) > $title-length"> @@ -114,12 +124,15 @@ <xsl:variable name="location-id" select="//LocationsPage/graphql/location/id"/> <xsl:value-of select="concat($BaseURL, '/explore/locations/', $location-id)"/> </xsl:when> + <xsl:when test="$hashtag-name != ''"> + <xsl:value-of select="concat($BaseURL, '/explore/tags/', $hashtag-name)"/> + </xsl:when> <xsl:otherwise> <xsl:value-of select="concat($BaseURL, '/', $user-name)"/> </xsl:otherwise> </xsl:choose> </xsl:variable> - <xsl:variable name="channel-image" select="//ProfilePage/graphql/user/profile_pic_url"/> + <xsl:variable name="channel-image" select="//profile_pic_url"/> <rss version="2.0"> <xsl:attribute name="xml:base"><xsl:value-of select="$BaseURL" /></xsl:attribute> @@ -133,16 +146,23 @@ </link> <description> <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text> - <xsl:value-of select="normalize-space(concat($screen-name, '. ', //user/biography))"/> - <xsl:if test="$location-name != ''"> - <xsl:variable name="location-latitude" select="//LocationsPage/graphql/location/lat"/> - <xsl:variable name="location-longitude" select="//LocationsPage/graphql/location/lng"/> - <xsl:value-of select="concat(' (', $location-latitude, ', ', $location-longitude, ')')"/> - </xsl:if> - <xsl:variable name="external-url" select="//user/external_url"/> - <xsl:if test="$external-url != ''"> - <xsl:text> </xsl:text><a href="{$external-url}"><xsl:value-of select="$external-url"/></a> - </xsl:if> + <xsl:choose> + <xsl:when test="$location-name != ''"> + <xsl:variable name="location-latitude" select="//LocationsPage/graphql/location/lat"/> + <xsl:variable name="location-longitude" select="//LocationsPage/graphql/location/lng"/> + <xsl:value-of select="concat($location-name, ' (', $location-latitude, ', ', $location-longitude, ')')"/> + </xsl:when> + <xsl:when test="$hashtag-name != ''"> + <xsl:value-of select="concat('#', $hashtag-name)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space(concat($screen-name, '. ', //user/biography))"/> + <xsl:variable name="external-url" select="//user/external_url"/> + <xsl:if test="$external-url != ''"> + <xsl:text> </xsl:text><a href="{$external-url}"><xsl:value-of select="$external-url"/></a> + </xsl:if> + </xsl:otherwise> + </xsl:choose> <xsl:text disable-output-escaping="yes">]]></xsl:text> </description> <xsl:if test="$channel-image != ''"> @@ -158,7 +178,7 @@ </url> </image> </xsl:if> - <xsl:apply-templates select="//ProfilePage/graphql/user/edge_owner_to_timeline_media/edges/node|//LocationsPage/graphql/location/edge_location_to_media/edges/node"/> + <xsl:apply-templates select="//ProfilePage/graphql/user/edge_owner_to_timeline_media/edges/node|//LocationsPage/graphql/location/edge_location_to_media/edges/node|//TagPage/graphql/hashtag/edge_hashtag_to_media/edges/node"/> </channel> </rss> </xsl:template>