summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2007-08-10 06:22:04 +0100
committerAndrew Dolgov <[email protected]>2007-08-10 06:22:04 +0100
commita5472764c9bcd3eda58540e2cc97c5a42bb1bc1c (patch)
tree74c6ae7c9e33585f69c34854664d7631bbdbd945
parentf56e308090f460d97dbe834ad88754231c3459e9 (diff)
add XSL stylesheet to generated feeds
-rw-r--r--functions.php6
-rw-r--r--images/active_tab_new.pngbin0 -> 287 bytes
-rw-r--r--images/feed-icon-64x64.pngbin0 -> 3015 bytes
-rw-r--r--images/ttrss_logo_blackred.pngbin0 -> 5908 bytes
-rw-r--r--images/ttrss_logo_blackred.svg144
-rw-r--r--rss.xsl59
-rw-r--r--utility.css43
-rw-r--r--xsl_mop-up.js86
8 files changed, 336 insertions, 2 deletions
diff --git a/functions.php b/functions.php
index 7a9591535..eb14f52e5 100644
--- a/functions.php
+++ b/functions.php
@@ -2722,9 +2722,11 @@
$feed_site_url = $qfh_ret[2];
$last_error = $qfh_ret[3];
-# if (!$feed_site_url) $feed_site_url = "http://localhost/";
+// if (!$feed_site_url) $feed_site_url = "http://localhost/";
- print "<rss version=\"2.0\">
+ print "<?xml version=\"1.0\" encoding=\"utf-8\"?>
+ <?xml-stylesheet type=\"text/xsl\" href=\"rss.xsl\"?>
+ <rss version=\"2.0\">
<channel>
<title>$feed_title</title>
<link>$feed_site_url</link>
diff --git a/images/active_tab_new.png b/images/active_tab_new.png
new file mode 100644
index 000000000..a08308c09
--- /dev/null
+++ b/images/active_tab_new.png
Binary files differ
diff --git a/images/feed-icon-64x64.png b/images/feed-icon-64x64.png
new file mode 100644
index 000000000..240e45e3c
--- /dev/null
+++ b/images/feed-icon-64x64.png
Binary files differ
diff --git a/images/ttrss_logo_blackred.png b/images/ttrss_logo_blackred.png
new file mode 100644
index 000000000..a9b081ab4
--- /dev/null
+++ b/images/ttrss_logo_blackred.png
Binary files differ
diff --git a/images/ttrss_logo_blackred.svg b/images/ttrss_logo_blackred.svg
new file mode 100644
index 000000000..6205a40f4
--- /dev/null
+++ b/images/ttrss_logo_blackred.svg
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="155.00000pt"
+ height="25.000000pt"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45"
+ sodipodi:docbase="/home/fox/public_html/testbox/tt-rss/images"
+ sodipodi:docname="ttrss_logo_blackred.svg"
+ inkscape:export-filename="/home/fox/public_html/testbox/tt-rss/images/ttrss_logo_blackred.png"
+ inkscape:export-xdpi="120.76"
+ inkscape:export-ydpi="120.76"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ sodipodi:modified="TRUE">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3112">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop3114" />
+ <stop
+ style="stop-color:#d6d6d6;stop-opacity:1;"
+ offset="1"
+ id="stop3116" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2800">
+ <stop
+ style="stop-color:#000000;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop2802" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop2804" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2782">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop2784" />
+ <stop
+ style="stop-color:#f6b5b5;stop-opacity:1;"
+ offset="1"
+ id="stop2786" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3112"
+ id="linearGradient3118"
+ x1="50"
+ y1="12.985595"
+ x2="50"
+ y2="31.920942"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-0.474438,0.321428)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2782"
+ id="linearGradient3124"
+ gradientUnits="userSpaceOnUse"
+ x1="50"
+ y1="12.985595"
+ x2="50"
+ y2="31.920942"
+ gradientTransform="translate(139.6953,0.37974)" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="5.6"
+ inkscape:cx="109.86875"
+ inkscape:cy="3.8105931"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1600"
+ inkscape:window-height="1125"
+ inkscape:window-x="0"
+ inkscape:window-y="25"
+ showguides="true"
+ inkscape:guide-bbox="true" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <text
+ xml:space="preserve"
+ style="font-size:28px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:1;fill:url(#linearGradient3118);fill-opacity:1;stroke:#676767;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Verdana"
+ x="3.2755625"
+ y="24.07143"
+ id="text1306"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/fox/public_html/testbox/tt-rss-blue/images/ttrss_logo.png"
+ inkscape:export-xdpi="180.00000"
+ inkscape:export-ydpi="180.00000"><tspan
+ sodipodi:role="line"
+ id="tspan1308"
+ x="3.2755625"
+ y="24.07143"
+ style="fill:url(#linearGradient3118);fill-opacity:1;stroke:#676767;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">tiny tiny</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:28px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:1;fill:url(#linearGradient3124);fill-opacity:1.0;stroke:#ff3d3d;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Verdana"
+ x="143.44531"
+ y="24.129744"
+ id="text3120"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/fox/public_html/testbox/tt-rss-blue/images/ttrss_logo.png"
+ inkscape:export-xdpi="180.00000"
+ inkscape:export-ydpi="180.00000"><tspan
+ sodipodi:role="line"
+ id="tspan3122"
+ x="143.44531"
+ y="24.129744"
+ style="fill:url(#linearGradient3124);fill-opacity:1.0;stroke:#ff3d3d;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">rss</tspan></text>
+ </g>
+</svg>
diff --git a/rss.xsl b/rss.xsl
new file mode 100644
index 000000000..04da62d31
--- /dev/null
+++ b/rss.xsl
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:output method="html"/>
+
+<xsl:template match="/">
+<html>
+ <head>
+ <title><xsl:value-of select="rss/channel/title"/></title>
+ <link rel="stylesheet" type="text/css" href="utility.css"/>
+ <script language="javascript" src="xsl_mop-up.js"></script>
+ </head>
+
+ <body onload="go_decoding()">
+
+ <div id="cometestme" style="display:none;">
+ <xsl:text disable-output-escaping="yes">&amp;amp;</xsl:text>
+ </div>
+
+ <div class="rss">
+
+ <img class="feedicon" src="images/feed-icon-64x64.png" alt="feed icon"/>
+
+ <h1><xsl:value-of select="rss/channel/title"/></h1>
+
+ <p class="description">This is an RSS feed exported from
+ <a target="_new" class="extlink" href="http://tt-rss.spb.ru">Tiny Tiny RSS</a>.
+ You must install a news aggregator to subscribe to it.
+ This feed contains the following items:</p>
+
+ <!-- <p class="description"><xsl:value-of
+ select="rss/channel/description"/></p> -->
+
+ <xsl:for-each select="rss/channel/item">
+ <h2><xsl:value-of select="title"/></h2>
+
+ <div><a class="extlink" target="_new"
+ href="{link}"><xsl:value-of select="link"/></a></div>
+
+ <div name="decodeme" class="content">
+ <xsl:value-of select="description" disable-output-escaping="yes"/>
+ </div>
+
+ <xsl:if test="enclosure">
+ <p><a href="{enclosure/@url}">Extra...</a></p>
+ </xsl:if>
+
+ <hr/>
+
+ </xsl:for-each>
+
+ </div>
+
+ </body>
+ </html>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/utility.css b/utility.css
index d6cac4f22..b94b0d5d9 100644
--- a/utility.css
+++ b/utility.css
@@ -76,3 +76,46 @@ h2 {
border-color : black;
border-style : solid; */
}
+
+div.rss h1 {
+ border-width : 0px 0px 1px 0px;
+ border-color : gray;
+ border-style : dotted;
+ color : gray;
+ margin-right : 90px;
+}
+
+div.rss h2 {
+ font-size : 12pt;
+ margin : 0px;
+}
+
+div.rss a.extlink {
+ color : gray;
+ border-width : 0px 0px 1px 0px;
+ border-color : #778899;
+ border-style : dotted;
+ font-size : 9pt;
+}
+
+div.rss p.description {
+ color : gray;
+ font-size : 9pt;
+}
+
+div.rss p.content {
+ margin-left : 2em;
+
+}
+
+div.rss img.feedicon {
+ float : right;
+}
+
+div.rss hr {
+ border-width : 0px 0px 1px 0px;
+ border-style : dashed;
+ border-color : #e0e0e0;
+}
+
+
diff --git a/xsl_mop-up.js b/xsl_mop-up.js
new file mode 100644
index 000000000..87c967090
--- /dev/null
+++ b/xsl_mop-up.js
@@ -0,0 +1,86 @@
+// -*-coding: latin-1;-*-
+// Time-stamp: "2006-05-17 22:06:46 ADT" [email protected]
+
+// A workaround for XSL-to-XHTML systems that don't
+// implement XSL 'disable-output-escaping="yes"'.
+//
+// [email protected], Sean M. Burke.
+// - I hereby release this JavaScript code into the public domain.
+
+var is_decoding;
+var DEBUG = 0;
+
+function complaining (s) { alert(s); return new Error(s,s); }
+
+if(!( document.getElementById && document.getElementsByName ))
+ throw complaining("Your browser is too old to render this page properly."
+ + " Consider going to getfirefox.com to upgrade.");
+
+function check_decoding () {
+ var d = document.getElementById('cometestme');
+ if(!d) {
+ throw complaining("Can't find an id='cometestme' element?");
+ } else if(!('textContent' in d)) {
+ // It's a browser with a halfassed DOM implementation (like IE6)
+ // that doesn't implement textContent! Assume that if it's that
+ // dumb, it probably doesn't implement disable-content-encoding.
+
+ } else {
+ var ampy = d.textContent;
+ if(DEBUG > 1) { alert("Got " + ampy); }
+
+ if(ampy == undefined) throw complaining("'cometestme' element has undefined text content?!");
+ if(ampy == '' ) throw complaining("'cometestme' element has empty text content?!" );
+
+ if (ampy == "\x26" ) { is_decoding = true; }
+ else if (ampy == "\x26amp;" ) { is_decoding = false; }
+ else { throw complaining('Insane value: "' + ampy + '"!'); }
+ }
+
+ var msg =
+ (is_decoding == undefined) ? "I can't tell whether the XSL processor supports disable-content-encoding!D"
+ : is_decoding ? "The XSL processor DOES support disable-content-encoding"
+ : "The XSL processor does NOT support disable-content-encoding"
+ ;
+ if(DEBUG) alert(msg);
+ return msg;
+}
+
+
+function go_decoding () {
+ check_decoding();
+
+ if(is_decoding) {
+ DEBUG && alert("No work needs doing -- already decoded!");
+ return;
+ }
+
+ var to_decode = document.getElementsByName('decodeme');
+ if(!( to_decode && to_decode.length )) {
+ DEBUG && alert("No work needs doing -- no elements to decode!");
+ return;
+ }
+
+ if(!( ( "innerHTML" in to_decode[0]) && ( "textContent" in to_decode[0]) ))
+ throw complaining( "Your JavaScript version doesn't implement DOM " +
+ "properly enough to show this page correctly. " +
+ "Consider going to getfirefox.com to upgrade.");
+
+ var s;
+ for(var i = to_decode.length - 1; i >= 0; i--) {
+ s = to_decode[i].textContent;
+
+ if(
+ s == undefined ||
+ (s.indexOf('&') == -1 && s.indexOf('<') == -1)
+ ) {
+ // the null or markupless element needs no reworking
+ } else {
+ to_decode[i].innerHTML = s; // that's the magic
+ }
+ }
+
+ return;
+}
+
+//End