Remove double semicolon in Tweeper::get_info()
[tweeper.git] / rss_converter_pump.io.xsl
1 <!--
2   Stylesheet to convert Pump.io activity streams to RSS.
3
4   Copyright (C) 2013  Antonio Ospite <ospite@studenti.unina.it>
5
6   This file is part of tweeper.
7
8   This program is free software: you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation, either version 3 of the License, or
11   (at your option) any later version.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 -->
21 <!-- To Evan, please reconsider publishing RSS ouput for _public_ contents -->
22 <xsl:stylesheet version="1.0"
23     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
24     xmlns:php="http://php.net/xsl"
25     xsl:extension-element-prefixes="php">
26
27     <xsl:output method="xml" indent="yes"/>
28
29     <xsl:variable name="user-name" select="substring-after(//div[@id='profile-block']/@data-profile-id, ':')"/>
30
31     <xsl:template match="//div[@id='user-content-activities']//ul[@id='major-stream']/li">
32         <xsl:variable name="activity-text" select=".//div[@class='activity-content']"/>
33         <item>
34             <title>
35                 <xsl:value-of select="concat($user-name, ': ', normalize-space($activity-text))"/>
36             </title>
37             <link>
38                 <xsl:value-of select=".//p[@class='muted']/small/a/@href"/>
39             </link>
40             <pubDate>
41                 <xsl:value-of select="php:functionString('Tweeper::str_to_gmdate', .//abbr[@class='easydate']/@title)"/>
42             </pubDate>
43             <description>
44                 <xsl:value-of select="concat($user-name, ': ')"/>
45                 <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
46                 <xsl:copy-of select="$activity-text/node()"/>
47                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
48             </description>
49         </item>
50     </xsl:template>
51
52     <xsl:template match="/">
53
54         <rss version="2.0">
55             <channel>
56                 <generator>Tweeper</generator>
57                 <title>
58                     <xsl:value-of select="concat(substring-after($user-name, '@'), ' / ', substring-before($user-name, '@'))"/>
59                 </title>
60                 <link>
61                     <xsl:value-of select="concat('https://', substring-after($user-name, '@'), '/', substring-before($user-name, '@'))"/>
62                 </link>
63                 <description>
64                     <xsl:value-of select="normalize-space(//h1[@class='media-header'])"/>
65                 </description>
66                 <image>
67                     <url>
68                         <xsl:value-of select="//div[@id='profile-block']/span/img[@class='img-rounded media-object']/@src"/>
69                     </url>
70                 </image>
71                 <xsl:apply-templates select="//div[@id='user-content-activities']//ul[@id='major-stream']/li"/>
72             </channel>
73         </rss>
74     </xsl:template>
75 </xsl:stylesheet>