Initial set of files.

This commit is contained in:
Schimon Jehudah, Adv. 2024-11-28 08:19:43 +02:00
parent d454e36bb3
commit d868301262
13 changed files with 1980 additions and 1 deletions

View file

@ -1,3 +1,35 @@
# Feedr # Feedr
Open syndication feed files from desktop. Feedr is a syndication utility with simple functionality, to open syndication
files directly from your desktop.
## Functionality
With a click, Feed will open and render given XML based syndication files of
type Atom Syndication Format, RDF, and RSS.
## Customization
CSS and XSL stylesheets can be changed, by adding custom CSS and XSL files to
`.local/share/feedr/css/stylesheet.css` and `.local/share/feedr/xsl/stylesheet.xsl`
respectively.
## Note
Your browser of choice must support XSLT.
## Recommendations
It is recommended to install one of these browsers:
- Falkon https://falkon.org
- Otter Browser https://otter-browser.org
- qutebrowser https://qutebrowser.org
## License
Feedr is subjected to the license MIT.
## Author
Schimon Jehudah Zachary

25
css/stylesheet-rtl.css Normal file
View file

@ -0,0 +1,25 @@
/*
* Copyright (C) 2016 - 2017 Schimon Jehuda. Released under MIT license
* Feeds rendered using this XSLT stylesheet, or it's derivatives, must
* include https://sjehuda.github.io/ in attribute name='generator' of
* element <meta/> inside of html element </head>
*/
#feed {
direction: rtl;
}
#logo {
float: left;
margin-left: -5px;
}
.geolocation > a {
padding-right: 6px;
}
.image {
float: right;
/* margin: 20px auto auto 40px; */
margin-left: 40px;
margin-right: auto;
}

303
css/stylesheet.css Normal file
View file

@ -0,0 +1,303 @@
/*
TODO
pubsub: news.movim.eu
node: fake-news
item: fdef84f5-e3e1-41ea-9b68-af4bb9130f77
title: #14October2023EpochEclipse
date: Fri, 15 Jan 2021 20:24:46
*/
* {
color: #eee;
max-width: 100%;
}
/*
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
*/
body {
background: #000;
}
code, pre {
overflow: auto;
max-height: 100%;
max-width: 100%; }
img, svg, video {
display: block;
max-height: 500px;
width: auto;
height: auto;
}
h1#title, h2#subtitle, #actions, #references {
text-align: center;
text-transform: uppercase;
line-height: 140%;
}
h5.related > a {
margin-right: 5px;
text-decoration: none;
user-select: none;
}
h3.title > a {
display: block;
padding-top: 50px;
}
#actions, #references {
border-bottom: 1px solid #eee;
line-height: 150%;
padding: 10px;
user-select: none;
}
#actions > *, #references * {
letter-spacing: 5px;
margin: 5px;
text-decoration: none;
}
#header, #menu {
line-height: 120%;
padding-bottom: 20px;
}
#menu > h3 {
padding-left: 2%;
}
#menu > ol > li {
padding: 5px;
}
#references {
margin-top: 5em;
border-top: 1px solid #eee;
}
#articles {
min-height: 80vh;
display: flex;
}
#articles #journal {
margin-left: 2%;
margin-right: 2%;
margin-top: 2%;
min-width: 350px;
padding-bottom: 0.67em;
width: 20%;
}
#journal {
margin: auto;
padding-top: 50px;
}
#articles > ul {
margin: auto;
margin-left: 2%;
margin-top: 2%;
}
#articles #journal ol,
#articles #journal ul {
/* height: 500px; */
line-height: 160%;
overflow: auto;
word-wrap: break-word;
}
#articles div.content {
font-size: 120%;
line-height: 200%;
margin: auto;
padding-left: 2%;
padding-right: 10%;
/* text-align: justify; */
word-wrap: break-word;
}
#articles div.entry {
padding-bottom: 0.67em;
}
#articles div.entry h1 {
font-size: 115%; /* 2vw */
}
#articles div.entry h2 {
font-size: 1.5vw;
}
#selection-page {
background: #000;
bottom: 0;
left: 0;
line-height: 200%;
overflow: overlay;
position: fixed;
right: 0;
text-align: center;
top: 0;
}
#selection-page p {
margin-left: 10%;
margin-right: 10%;
}
#selection-page span {
display: inline-grid;
margin: 2%
}
#selection-page img {
height: 128px;
margin-bottom: 20%;
margin-top: 20%;
width: 128px;
}
#selection-page #selection {
margin-bottom: 2%;
}
#selection-page #return {
/* font-style: italic; */
margin: auto;
}
#selection-link, #selection-page #return {
cursor: pointer;
text-decoration: underline;
}
.content[type='text'] {
white-space: pre-wrap;
}
#articles div.entry span.tags {
display: inline-flex;
/* display: ruby; */
flex-wrap: wrap;
}
#articles div.entry span.tags > div {
margin: 5px;
}
.enclosures {
cursor: help;
direction: ltr;
margin: 5px auto 15px 1%;
padding: 15px;
padding: 1em;
/* background: #222;
border: 1px solid GrayText;
border-radius: 4px;
border-radius: .5em;
color: #525c66;
border-left: double;
max-width: 40%; */
}
.enclosure a {
margin: 3px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.enclosure > span[icon='atom']:after,
.enclosure > span[icon='html5']:after,
.enclosure > span[icon='rss']:after {
content: '📰';
margin:3px;
}
.enclosure > span.audio:after {
content: ' (Audio file) ';
}
.enclosure > span[icon='audio']:after{
content: '🎼️';
margin: 3px;
}
.enclosure > span:after {
content: ' (Document file) ';
}
.enclosure > span[icon]:after {
content: '📄️';
margin: 3px;
}
.enclosure > span.executable:after{
content: ' (Executable file) ';
}
.enclosure > span[icon='executable']:after {
content: '📦️';
margin: 3px;
}
.enclosure > span.image:after {
content: ' (Image file) ';
}
.enclosure > span[icon='image']:after {
content: '🖼️';
margin: 3px;
}
.enclosure > span.video:after {
content: ' (Video file) ';
}
.enclosure > span[icon='video']:after {
content: '📽️';
margin:3px;
}
#note, #small {
line-height: 30px;
margin: auto;
margin-top: 0.67em;
max-width: 80%;
padding: 10px;
text-align: center;
user-select: none;
}
#small {
font-size: 80%;
}
@media (max-width: 1550px) {
#articles {
display: unset;
}
#articles #journal {
margin-right: unset;
min-width: unset;
width: unset;
}
}

62
feedr.sh Normal file
View file

@ -0,0 +1,62 @@
#!/bin/bash
# Check if the correct number of arguments is provided
if [ $# -ne 1 ]; then
echo "Usage: $0 XML_FILE"
exit 1
fi
function browser() {
local URL="$1";
xdg-open $URL || sensible-browser $URL || x-www-browser $URL || gnome-open $URL;
}
# Get the XML file and stylesheet file from the arguments
XML_FILE="$1"
XML_FILENAME=$(basename $XML_FILE)
# Create a temporary directory
TEMPORARY_DIRECTORY="/tmp/feedr"
if [ ! -f "$TEMPORARY_DIRECTORY" ]; then
mkdir $TEMPORARY_DIRECTORY/
mkdir $TEMPORARY_DIRECTORY/css/
mkdir $TEMPORARY_DIRECTORY/xsl/
fi
# Check whether a custom stylesheet is present
STYLESHEET_DIRECTORY="$HOME/.local/share/feedr"
cp -rf "$STYLESHEET_DIRECTORY/css/" "$TEMPORARY_DIRECTORY/"
cp -rf "$STYLESHEET_DIRECTORY/xsl/" "$TEMPORARY_DIRECTORY/"
if [ ! -f "$STYLESHEET_DIRECTORY" ]; then
STYLESHEET_DIRECTORY="/usr/share/feedr"
fi
# Copy stylesheets to temporary directory
cp -rf "$STYLESHEET_DIRECTORY/css/" "$TEMPORARY_DIRECTORY/"
cp -rf "$STYLESHEET_DIRECTORY/xsl/" "$TEMPORARY_DIRECTORY/"
# Restructure file with xmllint
XML_FILE_TMP="$TEMPORARY_DIRECTORY/$XML_FILENAME.xml"
xmllint --format "$XML_FILE" > "$XML_FILE_TMP"
if ! grep -q xml-stylesheet "$XML_FILE_TMP"; then
sed -i '1a <?xml-stylesheet type="text/xsl" href="xsl/stylesheet.xsl"?>' "$XML_FILE_TMP"
# Move modified content back to the original file
#mv "$XML_FILE_TMP" "$XML_FILE"
# Print a confirmation message
echo "Stylesheet instruction added to $XML_FILE."
fi
export WEBKIT_DISABLE_DMABUF_RENDERER=1
#badwolf "$XML_FILE_TMP"
#chrome --new-window "$XML_FILE_TMP"
#falkon "$XML_FILE_TMP" --new-window
#firefox --new-window "$XML_FILE_TMP"
#luakit "$XML_FILE_TMP"
otter-browser "$XML_FILE_TMP"
qutebrowser "$XML_FILE_TMP"
#xdg-open "$XML_FILE_TMP"

536
xsl/atom_as_xhtml.xsl Normal file
View file

@ -0,0 +1,536 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2016 - 2024 Schimon Jehuda. Released under MIT license
Feeds rendered using this XSLT stylesheet, or it's derivatives, must
include https://schimon.i2p/ in attribute name='generator' of
element <meta/> inside of html element </head>
-->
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:xml='http://www.w3.org/XML/1998/namespace'
xmlns:media='http://search.yahoo.com/mrss/'
xmlns:georss='http://www.georss.org/georss'
xmlns:geo='http://www.w3.org/2003/01/geo/wgs84_pos#'
xmlns:atom10='http://www.w3.org/2005/Atom'
xmlns:atom='http://www.w3.org/2005/Atom'>
<xsl:template match='/atom:feed'>
<!-- index right-to-left language codes -->
<!-- TODO http://www.w3.org/TR/xpath/#function-lang -->
<xsl:variable name='rtl'
select='@xml:lang[
contains(self::node(),"ar") or
contains(self::node(),"fa") or
contains(self::node(),"he") or
contains(self::node(),"ji") or
contains(self::node(),"ku") or
contains(self::node(),"ur") or
contains(self::node(),"yi")]'/>
<html>
<head>
<xsl:call-template name='metadata'>
<xsl:with-param name='name' select='"description"' />
<xsl:with-param name='content' select='atom:subtitle' />
</xsl:call-template>
<xsl:call-template name='metadata'>
<xsl:with-param name='name' select='"generator"' />
<xsl:with-param name='content' select='StreamBurner' />
</xsl:call-template>
<xsl:call-template name='metadata'>
<xsl:with-param name='name' select='"mimetype"' />
<xsl:with-param name='content' select='"application/atom+xml"' />
</xsl:call-template>
<title>
<xsl:choose>
<xsl:when test='atom:title and not(atom:title="") and count(atom:entry) &gt; 1'>
<xsl:value-of select='atom:title'/>
</xsl:when>
<xsl:when test='atom:entry'>
<xsl:value-of select='atom:entry/atom:title'/>
</xsl:when>
<xsl:otherwise>StreamBurner</xsl:otherwise>
</xsl:choose>
</title>
<!-- TODO media='print' -->
<link rel='stylesheet' type='text/css' media='screen' href='css/stylesheet.css'/>
<link rel='icon' type='image/svg+xml' href='/graphic/xmpp.svg'/>
<!-- whether language code is of direction right-to-left -->
<xsl:if test='$rtl'>
<link id='semitic' href='css/stylesheet-rtl.css' rel='stylesheet' type='text/css' />
</xsl:if>
<script type='text/javascript' src='/script/marked.min.js'/>
<script type='text/javascript' src='/script/postprocess.js'/>
<base>
<xsl:attribute name='href'>
<xsl:value-of select="atom:link[@rel='alternate']/@href" />
</xsl:attribute>
</base>
</head>
<body>
<div id='actions'>
<a id='follow' title='Subscribe the latest updates and news.'
onclick='window.open(location.href.replace(/^https?:/, "feed:"), "_self")'>
<!-- xsl:attribute name="href">
feed:<xsl:value-of select="atom:link[@rel='self']/@href" />
</xsl:attribute -->
Follow
</a>
<a id='subtome' title='Subscribe via SubToMe.'>
<xsl:attribute name='href'>
javascript:location.href='https://www.subtome.com/#/subscribe?feeds='+location.href;
</xsl:attribute>
<xsl:attribute name='onclick'>
(
function(btn){
var z=document.createElement('script');
document.subtomeBtn=btn;
z.src='https://www.subtome.com/load.js';document.body.appendChild(z);
}
)(this);
return false;
</xsl:attribute>
SubToMe
</a>
<a href='https://xmpp.org/about/technology-overview/'
title='Of the benefits of XMPP.'>
XMPP
</a>
<a href='https://join.jabber.network/#syndication@conference.movim.eu?join'
title='Syndictaion and PubSub.'>
Groupchat
</a>
<a href='https://aboutfeeds.com/'
title='Of the benefits of syndication feed.'
id='aboutfeeds'>
Help
</a>
</div>
<div id='feed'>
<div id='header'>
<!-- feed title -->
<h1 id='title'>
<xsl:choose>
<xsl:when test='atom:title and not(atom:title="") and count(atom:entry) &gt; 1'>
<xsl:value-of select='atom:title'/>
</xsl:when>
<xsl:when test='atom:entry'>
<xsl:value-of select='atom:entry/atom:title'/>
</xsl:when>
<xsl:otherwise>
No title
</xsl:otherwise>
</xsl:choose>
</h1>
<!-- feed subtitle -->
<h2 id='subtitle'>
<xsl:choose>
<xsl:when test='atom:title and not(atom:title="") and count(atom:entry) &gt; 1'>
<xsl:value-of select='atom:subtitle'/>
</xsl:when>
<xsl:when test='atom:entry'>
<xsl:attribute name='class'><xsl:text>date</xsl:text></xsl:attribute>
<xsl:value-of select='atom:entry/atom:updated'/>
</xsl:when>
<xsl:when test='atom:entry'>
<xsl:attribute name='class'><xsl:text>date</xsl:text></xsl:attribute>
<xsl:value-of select='atom:entry/atom:published'/>
</xsl:when>
<xsl:otherwise>
Rivista XMPP Journal Publisher
</xsl:otherwise>
</xsl:choose>
</h2>
</div>
<xsl:if test='count(atom:entry) &gt; 1'>
<div id='menu'>
<h3>Latest Posts</h3>
<!-- xsl:for-each select='atom:entry[position() &lt;21]' -->
<ol>
<xsl:for-each select='atom:entry[not(position() &gt; 20)]'>
<li>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:text>#rivista-</xsl:text>
<xsl:value-of select='position()'/>
</xsl:attribute>
<xsl:choose>
<xsl:when test='string-length(atom:title) &gt; 0'>
<xsl:value-of select='atom:title'/>
</xsl:when>
<xsl:otherwise>
*** No Title ***
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</li>
</xsl:for-each>
</ol>
</div>
</xsl:if>
<div id='articles'>
<!-- feed entry -->
<xsl:choose>
<xsl:when test='atom:entry'>
<ul>
<xsl:for-each select='atom:entry[not(position() >20)]'>
<li>
<div class='entry'>
<!-- entry title -->
<h3 class='title'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:choose>
<xsl:when test='atom:link[@rel="self"]'>
<xsl:value-of select='atom:link[@rel="self"]/@href'/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select='atom:link/@href'/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name='id'>
<xsl:text>rivista-</xsl:text>
<xsl:value-of select='position()'/>
</xsl:attribute>
<xsl:choose>
<xsl:when test='string-length(atom:title) &gt; 0'>
<xsl:value-of select='atom:title'/>
</xsl:when>
<xsl:otherwise>
*** No Title ***
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</h3>
<!-- geographic location -->
<xsl:choose>
<xsl:when test='geo:lat and geo:long'>
<xsl:variable name='lat' select='geo:lat'/>
<xsl:variable name='lng' select='geo:long'/>
<span class='geolocation'>
<a href='geo:{$lat},{$lng}'>📍</a>
</span>
</xsl:when>
<xsl:when test='geo:Point'>
<xsl:variable name='lat' select='geo:Point/geo:lat'/>
<xsl:variable name='lng' select='geo:Point/geo:long'/>
<span class='geolocation'>
<a href='geo:{$lat},{$lng}'>📍</a>
</span>
</xsl:when>
<xsl:when test='georss:point'>
<xsl:variable name='lat' select='substring-before(georss:point, " ")'/>
<xsl:variable name='lng' select='substring-after(georss:point, " ")'/>
<xsl:variable name='name' select='georss:featurename'/>
<span class='geolocation'>
<a href='geo:{$lat},{$lng}' title='{$name}'>📍</a>
</span>
</xsl:when>
</xsl:choose>
<!-- entry date -->
<xsl:element name='h4'>
<xsl:choose>
<xsl:when test='atom:updated'>
<xsl:attribute name='class'>
<xsl:text>updated</xsl:text>
</xsl:attribute>
<xsl:value-of select='atom:updated'/>
</xsl:when>
<xsl:when test='atom:published'>
<xsl:attribute name='class'>
<xsl:text>published</xsl:text>
</xsl:attribute>
<xsl:value-of select='atom:published'/>
</xsl:when>
<xsl:otherwise>
<h4 class='warning atom1 published'></h4>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
<!-- entry author -->
<xsl:if test='atom:author'>
<h4 class='author'>
<xsl:text>By </xsl:text>
<xsl:choose>
<xsl:when test='atom:author/atom:email'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:text>mailto:</xsl:text>
<xsl:value-of select='atom:author/atom:email'/>
</xsl:attribute>
<xsl:attribute name='title'>
<xsl:text>Send an Email to </xsl:text>
<xsl:value-of select='atom:author/atom:email'/>
</xsl:attribute>
<xsl:value-of select='atom:author/atom:name'/>
</xsl:element>
</xsl:when>
<xsl:when test='atom:author/atom:uri'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='atom:author/atom:uri'/>
</xsl:attribute>
<xsl:attribute name='title'>
<xsl:value-of select='atom:author/atom:summary'/>
</xsl:attribute>
<xsl:value-of select='atom:author/atom:name'/>
</xsl:element>
</xsl:when>
<xsl:when test='atom:author/atom:name'>
<xsl:value-of select='atom:author/atom:name'/>
</xsl:when>
<xsl:when test='atom:uri'>
<xsl:value-of select='atom:uri'/>
</xsl:when>
</xsl:choose>
</h4>
</xsl:if>
<h5 class='related'>
<xsl:if test='atom:link[@rel="alternate" and @type="x-scheme-handler/xmpp"]'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='atom:link[@rel="alternate" and @type="x-scheme-handler/xmpp"]/@href'/>
</xsl:attribute>
<xsl:attribute name='class'>
<xsl:text>rivista-jabber</xsl:text>
</xsl:attribute>
💡️ Source
</xsl:element>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='atom:link[@rel="alternate" and @type="x-scheme-handler/xmpp"]/@href'/>
</xsl:attribute>
(XMPP)
</xsl:element>
</xsl:if>
<xsl:if test='atom:link[@rel="contact"]'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='atom:link[@rel="contact"]/@href'/>
</xsl:attribute>
<xsl:attribute name='class'>
<xsl:text>contact-uri</xsl:text>
</xsl:attribute>
🪪️ Contact
</xsl:element>
</xsl:if>
<xsl:if test='atom:link[@rel="replies"]'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='atom:link[@rel="replies"]/@href'/>
</xsl:attribute>
<xsl:attribute name='class'>
<xsl:text>rivista-replies</xsl:text>
</xsl:attribute>
💬 Discussion
</xsl:element>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='atom:link[@rel="replies"]/@href'/>
</xsl:attribute>
(XMPP)
</xsl:element>
</xsl:if>
<xsl:if test='atom:link[@rel="alternate" and @type="text/html"]'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='atom:link[@rel="alternate" and @type="text/html"]/@href'/>
</xsl:attribute>
📜 HTML
</xsl:element>
</xsl:if>
<xsl:if test='atom:link[@rel="related" and @type="text/html"]'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='atom:link[@rel="related" and @type="text/html"]/@href'/>
</xsl:attribute>
📜 HTML (Related)
</xsl:element>
</xsl:if>
</h5>
<!-- entry content -->
<xsl:if test='atom:content or atom:summary'>
<div class='content'>
<xsl:choose>
<xsl:when test='atom:summary[contains(@type,"text")]'>
<xsl:attribute name='type'>
<xsl:value-of select='atom:summary/@type'/>
</xsl:attribute>
<xsl:value-of select='atom:summary'/>
</xsl:when>
<xsl:when test='atom:summary[contains(@type,"html")]'>
<xsl:attribute name='type'>
<xsl:value-of select='atom:summary/@type'/>
</xsl:attribute>
<xsl:value-of select='atom:summary' disable-output-escaping='yes'/>
</xsl:when>
<xsl:when test='atom:summary[contains(@type,"base64")]'>
<!-- TODO add xsl:template to handle inline media -->
</xsl:when>
<xsl:when test='atom:content[contains(@type,"text")]'>
<xsl:attribute name='type'>
<xsl:value-of select='atom:content/@type'/>
</xsl:attribute>
<xsl:value-of select='atom:content'/>
</xsl:when>
<xsl:when test='atom:content[contains(@type,"html")]'>
<xsl:attribute name='type'>
<xsl:value-of select='atom:content/@type'/>
</xsl:attribute>
<xsl:value-of select='atom:content' disable-output-escaping='yes'/>
</xsl:when>
<xsl:when test='atom:content[contains(@type,"base64")]'>
<!-- TODO add xsl:template to handle inline media -->
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test='atom:summary and not(atom:summary="")'>
<xsl:value-of select='atom:summary' disable-output-escaping='yes'/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select='atom:content' disable-output-escaping='yes'/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:if>
<!-- entry tags -->
<xsl:if test='atom:category/@term'>
<h4>Tags</h4>
<span class='tags'>
<xsl:for-each select='atom:category'>
<xsl:element name='div'>
<xsl:value-of select='@term'/>
</xsl:element>
</xsl:for-each>
</span>
</xsl:if>
<!-- entry enclosure -->
<xsl:if test='atom:link[@rel="enclosure"]'>
<h4>Media</h4>
<span class='enclosures' title='Right-click and Save link as…'>
<xsl:for-each select='atom:link[@rel="enclosure"]'>
<div class='enclosure' title='Right-click and Save link as…'>
<xsl:element name='span'>
<xsl:attribute name='icon'>
<xsl:value-of select='substring-before(@type,"/")'/>
</xsl:attribute>
</xsl:element>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='@href'/>
</xsl:attribute>
<xsl:attribute name='download'/>
<xsl:call-template name='extract-filename'>
<xsl:with-param name='url' select='@href' />
</xsl:call-template>
</xsl:element>
<xsl:element name='span'>
<xsl:attribute name='class'>
<xsl:value-of select='substring-before(@type,"/")'/>
</xsl:attribute>
</xsl:element>
<xsl:if test='@length &gt; 0'>
<xsl:call-template name='transform-filesize'>
<xsl:with-param name='length' select='@length' />
</xsl:call-template>
</xsl:if>
<br/>
</div>
</xsl:for-each>
</span>
</xsl:if>
</div>
<!-- entry id -->
<xsl:if test='not(atom:id)'>
<div class='warning atom1 id'>No entry ID</div>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:when>
<xsl:otherwise>
<ul>
<li>
<div class='entry'>
<h3 class='title'>
<a href='javascript:alert("Please check that the mother PubSub node is populated with content.")'>
No content
</a>
</h3>
<h4>This entry is empty</h4>
<div class='content'>Please check that the mother PubSub node is populated with content.</div>
</div>
</li>
</ul>
</xsl:otherwise>
</xsl:choose>
</div>
</div>
<div id='references'>
<a href='https://joinjabber.org/'
title='An Inclusive Space On The Jabber Network.'>
JoinJabber
</a>
<a href='https://libervia.org/'
title='The Universal Communication Ecosystem.'>
Libervia
</a>
<a href='https://join.movim.eu/'
title='The Social Platform Shaped For Your Community.'>
Movim
</a>
<a href='https://git.xmpp-it.net/sch/Rivista'
title='A Journal Publisher And Browser For XMPP.'>
Rivista
</a>
<a href='https://git.xmpp-it.net/sch/Blasta'
title='A Social Bookmark Manager For XMPP.'>
Blasta
</a>
<a href='https://github.com/SeveFP/Reeder'
title='An XMPP-Based Feed Reader.'>
Reeder
</a>
<a href='https://modernxmpp.org/'
title='A Project To Improve The Quality Of User-To-User Messaging Applications That Use XMPP.'>
Modern
</a>
<a href='https://xmpp.org/'
title='The Universal Messaging Standard.'>
XMPP
</a>
<a href='https://xmpp.org/extensions/xep-0060.html'
title='XEP-0060: Publish-Subscribe.'>
PubSub
</a>
</div>
<!-- note -->
<p id='note'>
This an Atom document which can also be viewed with
a Syndication Feed Reader (also referred to as News Reader
or RSS Reader) which provides automated news updates and
notifications on desktop and mobile.
<span id="selection-link">Click here</span> for a
selection of software and pick the ones that would fit
to you best!
</p>
<p id='small'>
<i>
This ASF (Atom Syndication Format)
document is conveyed as an XHTML document.
This document was produced by an
XSLT <a href="xsl/atom.xsl">stylesheet</a>.
XSLT is a powerful technology which transforms XML
documents into HTML, JSON, PDF, Text XHTML, and
(modified) XML documents;
<a href="https://www.w3.org/Style/XSL/">Learn more</a>
about The Extensible Stylesheet Language Family (XSL).
</i>
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

25
xsl/extract-filename.xsl Normal file
View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2016 - 2017 Schimon Jehuda. Released under MIT license
Feeds rendered using this XSLT stylesheet, or it's derivatives, must
include https://schimon.i2p/ in attribute name='generator' of
element <meta/> inside of html element </head>
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- extract filename from given url string -->
<xsl:template name='extract-filename'>
<xsl:param name='url'/>
<xsl:choose>
<xsl:when test='contains($url,"/")'>
<xsl:call-template name='extract-filename'>
<xsl:with-param name='url' select='substring-after($url,"/")'/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select='$url'/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

26
xsl/metadata.xsl Normal file
View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2016 - 2017 Schimon Jehuda. Released under MIT license
Feeds rendered using this XSLT stylesheet, or it's derivatives, must
include https://schimon.i2p/ in attribute name='generator' of
element <meta/> inside of html element </head>
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- set page metadata -->
<xsl:template name='metadata'>
<xsl:param name='name'/>
<xsl:param name='content'/>
<xsl:if test='$content and not($content="")'>
<xsl:element name='meta'>
<xsl:attribute name='name'>
<xsl:value-of select='$name'/>
</xsl:attribute>
<xsl:attribute name='content'>
<xsl:value-of select='$content'/>
</xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

20
xsl/opml.xsl Normal file
View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2016 - 2024 Schimon Jehuda. Released under MIT license
Feeds rendered using this XSLT stylesheet, or it's derivatives, must
include https://schimon.i2p/ in attribute name='generator' of
element <meta/> inside of html element </head>
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding = 'UTF-8'
indent = 'yes'
media-type = 'text/x-opml'
method = 'html'
version = '4.01' />
<!-- Outline Processor Markup Language 1.0 -->
<xsl:include href='opml_as_xhtml.xsl'/>
<!-- set page metadata -->
<xsl:include href='metadata.xsl'/>
</xsl:stylesheet>

234
xsl/opml_as_xhtml.xsl Normal file
View file

@ -0,0 +1,234 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2016 - 2024 Schimon Jehuda. Released under MIT license
Feeds rendered using this XSLT stylesheet, or it's derivatives, must
include https://schimon.i2p/ in attribute name='generator' of
element <meta/> inside of html element </head>
-->
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:xml='http://www.w3.org/XML/1998/namespace'>
<xsl:template match='/opml'>
<!-- index right-to-left language codes -->
<!-- TODO http://www.w3.org/TR/xpath/#function-lang -->
<xsl:variable name='rtl'
select='lang[
contains(self::node(),"ar") or
contains(self::node(),"fa") or
contains(self::node(),"he") or
contains(self::node(),"ji") or
contains(self::node(),"ku") or
contains(self::node(),"ur") or
contains(self::node(),"yi")]'/>
<html>
<head>
<xsl:call-template name='metadata'>
<xsl:with-param name='name' select='"description"' />
<xsl:with-param name='content' select='subtitle' />
</xsl:call-template>
<xsl:call-template name='metadata'>
<xsl:with-param name='name' select='"generator"' />
<xsl:with-param name='content' select='StreamBurner' />
</xsl:call-template>
<xsl:call-template name='metadata'>
<xsl:with-param name='name' select='"mimetype"' />
<xsl:with-param name='content' select='"text/x-opml"' />
</xsl:call-template>
<title>
<xsl:choose>
<xsl:when test='//head/title and not(//head/title="")'>
<xsl:value-of select='//head/title'/>
</xsl:when>
<xsl:otherwise>StreamBurner</xsl:otherwise>
</xsl:choose>
</title>
<!-- TODO media='print' -->
<link rel='stylesheet' type='text/css' media='screen' href='css/stylesheet.css'/>
<link rel='icon' type='image/svg+xml' href='/graphic/xmpp.svg'/>
<!-- whether language code is of direction right-to-left -->
<xsl:if test='$rtl'>
<link id='semitic' href='css/stylesheet-rtl.css' rel='stylesheet' type='text/css' />
</xsl:if>
<script type='text/javascript' src='/script/postprocess.js'/>
</head>
<body>
<div id='actions'>
<a href='https://xmpp.org/about/technology-overview/'
title='Of the benefits of XMPP.'>
XMPP
</a>
<a href='https://join.jabber.network/#syndication@conference.movim.eu?join'
title='Syndictaion and PubSub.'>
Groupchat
</a>
<a href='https://aboutfeeds.com/'
title='Of the benefits of syndication feed.'
id='aboutfeeds'>
Help
</a>
</div>
<div id='feed'>
<div id='header'>
<!-- feed title -->
<h1 id='title'>
<xsl:choose>
<xsl:when test='//head/title and not(//head/title="") and count(//outline) &gt; 1'>
<xsl:value-of select='//head/title'/>
</xsl:when>
<xsl:otherwise>
StreamBurner OPML Collection
</xsl:otherwise>
</xsl:choose>
</h1>
<!-- feed subtitle -->
<h2 id='subtitle'>
<xsl:choose>
<xsl:when test='//head/description and not(//head/description="") and count(//outline) &gt; 1'>
<xsl:value-of select='//head/description'/>
</xsl:when>
<xsl:otherwise>
Outline Processor Markup Language
</xsl:otherwise>
</xsl:choose>
</h2>
</div>
<xsl:if test='count(//outline) &gt; 1'>
<div id='menu'>
<h3>Subscriptions</h3>
<!-- xsl:for-each select='outline[position() &lt;21]' -->
<ol>
<xsl:for-each select='//outline[not(position() &gt; 20)]'>
<li>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:text>#rivista-</xsl:text>
<xsl:value-of select='position()'/>
</xsl:attribute>
<xsl:choose>
<xsl:when test='string-length(@text) &gt; 0'>
<xsl:value-of select='@text'/>
</xsl:when>
<xsl:otherwise>
*** No Title ***
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</li>
</xsl:for-each>
</ol>
</div>
</xsl:if>
<div id='articles'>
<!-- opml outline -->
<xsl:choose>
<xsl:when test='//outline'>
<ul>
<xsl:for-each select='//outline[not(position() &gt; 20)]'>
<li>
<div class='entry'>
<!-- outline title -->
<h3 class='title'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='@xmlUrl'/>
</xsl:attribute>
<xsl:attribute name='id'>
<xsl:text>rivista-</xsl:text>
<xsl:value-of select='position()'/>
</xsl:attribute>
<xsl:choose>
<xsl:when test='string-length(@text) &gt; 0'>
<xsl:value-of select='@text'/>
</xsl:when>
<xsl:otherwise>
*** No Title ***
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</h3>
<!-- entry content -->
<h4>
<xsl:value-of select='@text'/>
</h4>
<p class='content'>
<xsl:value-of select='@xmlUrl'/>
</p>
</div>
</li>
</xsl:for-each>
</ul>
</xsl:when>
<xsl:otherwise>
<div class='notice no-entry'></div>
</xsl:otherwise>
</xsl:choose>
</div>
</div>
<div id='references'>
<a href='https://joinjabber.org/'
title='An Inclusive Space On The Jabber Network.'>
JoinJabber
</a>
<a href='https://libervia.org/'
title='The Universal Communication Ecosystem.'>
Libervia
</a>
<a href='https://join.movim.eu/'
title='The Social Platform Shaped For Your Community.'>
Movim
</a>
<a href='https://git.xmpp-it.net/sch/Rivista'
title='A Journal Publisher And Browser For XMPP.'>
Rivista
</a>
<a href='https://git.xmpp-it.net/sch/Blasta'
title='A Social Bookmark Manager For XMPP.'>
Blasta
</a>
<a href='https://github.com/SeveFP/Reeder'
title='An XMPP-Based Feed Reader.'>
Reeder
</a>
<a href='https://modernxmpp.org/'
title='A Project To Improve The Quality Of User-To-User Messaging Applications That Use XMPP.'>
Modern
</a>
<a href='https://xmpp.org/'
title='The Universal Messaging Standard.'>
XMPP
</a>
<a href='https://xmpp.org/extensions/xep-0060.html'
title='XEP-0060: Publish-Subscribe.'>
PubSub
</a>
</div>
<!-- note -->
<p id='note'>
This is an OPML document which includes a collection of
subscriptions, and it can be imported to
a Syndication Feed Reader (also referred to as News Reader
or RSS Reader) which provides automated news updates and
notifications on desktop and mobile.
<span id="selection-link">Click here</span> for a
selection of software and pick the ones that would fit
to you best!
</p>
<p id='small'>
<i>
This OPML (Outline Processor Markup Language)
document is conveyed as an XHTML document.
This document was produced by an
XSLT <a href="xsl/opml.xsl">stylesheet</a>.
XSLT is a powerful technology which transforms XML
documents into HTML, JSON, PDF, Text XHTML, and
(modified) XML documents;
<a href="https://www.w3.org/Style/XSL/">Learn more</a>
about The Extensible Stylesheet Language Family (XSL).
</i>
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

306
xsl/rdf_as_xhtml.xsl Normal file
View file

@ -0,0 +1,306 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2016 - 2024 Schimon Jehuda. Released under MIT license
Feeds rendered using this XSLT stylesheet, or it's derivatives, must
include https://schimon.i2p/ in attribute name='generator' of
element <meta/> inside of html element </head>
-->
<xsl:stylesheet version="1.0"
xmlns="http://purl.org/rss/1.0/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:atom10="http://www.w3.org/2005/Atom"
xmlns:c="http://s.opencalais.com/1/pred/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:dbo="http://dbpedia.org/ontology/"
xmlns:dbp="http://dbpedia.org/property/"
xmlns:enc="http://purl.oclc.org/net/rss_2.0/enc#"
xmlns:fh="http://purl.org/syndication/history/1.0"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:foo="http://purl.org/rss/1.0/"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns:georss="http://www.georss.org/georss"
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:prov="http://www.w3.org/ns/prov#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:sioc="http://rdfs.org/sioc/ns#"
xmlns:sioct="http://rdfs.org/sioc/types#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match='/rdf:RDF'>
<!-- index right-to-left language codes -->
<xsl:variable name='rtl'
select='channel/language[
contains(text(),"ar") or
contains(text(),"fa") or
contains(text(),"he") or
contains(text(),"ji") or
contains(text(),"ku") or
contains(text(),"ur") or
contains(text(),"yi")]'/>
<html>
<head>
<xsl:call-template name='metadata'>
<xsl:with-param name='name' select='"description"' />
<xsl:with-param name='content' select='foo:channel/foo:description' />
</xsl:call-template>
<xsl:call-template name='metadata'>
<xsl:with-param name='name' select='"generator"' />
<xsl:with-param name='content' select='StreamBurner' />
</xsl:call-template>
<xsl:call-template name='metadata'>
<xsl:with-param name='name' select='"mimetype"' />
<xsl:with-param name='content' select='"application/rdf+xml"' />
</xsl:call-template>
<title>
<xsl:choose>
<xsl:when test='foo:channel/foo:title and not(foo:channel/foo:title="")'>
<xsl:value-of select='foo:channel/foo:title'/>
</xsl:when>
<xsl:otherwise>StreamBurner News Reader</xsl:otherwise>
</xsl:choose>
</title>
<!-- TODO media='print' -->
<link href='css/stylesheet.css' rel='stylesheet' type='text/css' media='screen'/>
<!-- whether language code is of direction right-to-left -->
<xsl:if test='$rtl'>
<link id='semitic' href='css/stylesheet-rtl.css' rel='stylesheet' type='text/css' />
</xsl:if>
<base>
<xsl:attribute name='href'>
<xsl:value-of select='channel/link'/>
</xsl:attribute>
</base>
</head>
<body>
<div id='feed'>
<div id='header'>
<!-- feed title -->
<h1 id='title'>
<xsl:choose>
<xsl:when test='foo:channel/foo:title and not(foo:channel/foo:title="")'>
<xsl:value-of select='foo:channel/foo:title'/>
</xsl:when>
<xsl:otherwise>
No title
</xsl:otherwise>
</xsl:choose>
</h1>
<!-- feed subtitle -->
<h2 id='subtitle'>
<xsl:choose>
<xsl:when test='foo:channel/itunes:subtitle'>
<xsl:value-of select='foo:channel/itunes:subtitle'/>
</xsl:when>
<xsl:when test='foo:channel/foo:description'>
<xsl:value-of select='foo:channel/foo:description'/>
</xsl:when>
</xsl:choose>
</h2>
</div>
<xsl:choose>
<xsl:when test='foo:item'>
<div id='menu'>
<h3>Latest Posts</h3>
<ol id='toc'>
<xsl:for-each select='foo:item[not(position() >20)]'>
<li>
<xsl:choose>
<xsl:when test='itunes:subtitle'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:text>#newspaper-oujs-</xsl:text>
<xsl:value-of select='position()'/>
</xsl:attribute>
<xsl:value-of select='itunes:subtitle'/>
</xsl:element>
</xsl:when>
<xsl:when test='foo:title'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:text>#newspaper-oujs-</xsl:text>
<xsl:value-of select='position()'/>
</xsl:attribute>
<xsl:value-of select='foo:title'/>
</xsl:element>
</xsl:when>
</xsl:choose>
</li>
</xsl:for-each>
</ol>
</div>
</xsl:when>
</xsl:choose>
<div id='articles'>
<!-- feed entry -->
<xsl:choose>
<xsl:when test='foo:item'>
<ul>
<xsl:for-each select='foo:item[not(position() >20)]'>
<li>
<div class='entry'>
<!-- entry title -->
<xsl:choose>
<xsl:when test='itunes:subtitle'>
<h3 class='title'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='foo:link'/>
</xsl:attribute>
<xsl:attribute name='title'>
<xsl:value-of select='itunes:subtitle'/>
</xsl:attribute>
<xsl:attribute name='id'>
<xsl:text>newspaper-oujs-</xsl:text>
<xsl:value-of select='position()'/>
</xsl:attribute>
<xsl:value-of select='itunes:subtitle'/>
</xsl:element>
</h3>
</xsl:when>
<xsl:when test='foo:title'>
<h3 class='title'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='foo:link'/>
</xsl:attribute>
<xsl:attribute name='title'>
<xsl:value-of select='foo:title'/>
</xsl:attribute>
<xsl:attribute name='id'>
<xsl:text>newspaper-oujs-</xsl:text>
<xsl:value-of select='position()'/>
</xsl:attribute>
<xsl:value-of select='foo:title'/>
</xsl:element>
</h3>
</xsl:when>
<xsl:otherwise>
<h3 class='warning rss title'></h3>
</xsl:otherwise>
</xsl:choose>
<!-- geographic location -->
<xsl:choose>
<xsl:when test='geo:lat and geo:long'>
<xsl:variable name='lat' select='geo:lat'/>
<xsl:variable name='lng' select='geo:long'/>
<span class='geolocation'>
<a href='geo:{$lat},{$lng}'>📍</a>
</span>
</xsl:when>
<xsl:when test='geo:Point'>
<xsl:variable name='lat' select='geo:Point/geo:lat'/>
<xsl:variable name='lng' select='geo:Point/geo:long'/>
<span class='geolocation'>
<a href='geo:{$lat},{$lng}'>📍</a>
</span>
</xsl:when>
<xsl:when test='georss:point'>
<xsl:variable name='lat' select='substring-before(georss:point, " ")'/>
<xsl:variable name='lng' select='substring-after(georss:point, " ")'/>
<xsl:variable name='name' select='georss:featurename'/>
<span class='geolocation'>
<a href='geo:{$lat},{$lng}' title='{$name}'>📍</a>
</span>
</xsl:when>
</xsl:choose>
<!-- div class='posted' -->
<!-- entry author -->
<!-- span class='author'>
<xsl:choose>
<xsl:when test='itunes:author'>
<xsl:value-of select='itunes:author'/>
</xsl:when>
<xsl:when test='author'>
<xsl:value-of select='author'/>
</xsl:when>
</xsl:choose>
</span-->
<!-- entry date -->
<xsl:if test='dc:date'>
<div class='published'>
<xsl:value-of select='dc:date'/>
</div>
</xsl:if>
<!-- /div -->
<!-- entry content -->
<xsl:choose>
<!-- complete text post -->
<xsl:when test='content:encoded'>
<div class='content'>
<xsl:value-of select='content:encoded' disable-output-escaping='yes'/>
</div>
</xsl:when>
<!-- description of post -->
<xsl:when test='foo:description'>
<div class='content'>
<xsl:value-of select='foo:description' disable-output-escaping='yes'/>
</div>
</xsl:when>
<!-- itunes text post -->
<xsl:when test='itunes:summary'>
<div class='content'>
<xsl:value-of select='itunes:summary' disable-output-escaping='yes'/>
</div>
</xsl:when>
<xsl:otherwise>
<div class='warning rss description'></div>
</xsl:otherwise>
</xsl:choose>
<!-- entry enclosure -->
<xsl:if test='enc:enclosure'>
<div class='enclosure' title='Right-click and Save link as…'>
<xsl:for-each select='enc:enclosure'>
<xsl:element name='span'>
<xsl:attribute name='icon'>
<xsl:value-of select='substring-before(@enc:type,"/")'/>
</xsl:attribute>
</xsl:element>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='@rdf:resource'/>
</xsl:attribute>
<xsl:attribute name='download'/>
<xsl:call-template name='extract-filename'>
<xsl:with-param name='url' select='@rdf:resource' />
</xsl:call-template>
</xsl:element>
<xsl:element name='span'>
<xsl:attribute name='class'>
<xsl:value-of select='substring-before(@enc:type,"/")'/>
</xsl:attribute>
</xsl:element>
<xsl:if test='@enc:length &gt; 0'>
<xsl:call-template name='transform-filesize'>
<xsl:with-param name='length' select='@enc:length' />
</xsl:call-template>
</xsl:if>
<xsl:element name='br'/>
</xsl:for-each>
</div>
</xsl:if>
</div>
</li>
</xsl:for-each>
</ul>
</xsl:when>
<xsl:otherwise>
<div class='notice no-entry'></div>
</xsl:otherwise>
</xsl:choose>
</div>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

333
xsl/rss_as_xhtml.xsl Normal file
View file

@ -0,0 +1,333 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2016 - 2024 Schimon Jehuda. Released under MIT license
Feeds rendered using this XSLT stylesheet, or it's derivatives, must
include https://schimon.i2p/ in attribute name='generator' of
element <meta/> inside of html element </head>
-->
<xsl:stylesheet version="1.0"
xmlns="http://purl.org/rss/1.0/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:atom10="http://www.w3.org/2005/Atom"
xmlns:c="http://s.opencalais.com/1/pred/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:dbo="http://dbpedia.org/ontology/"
xmlns:dbp="http://dbpedia.org/property/"
xmlns:enc="http://purl.oclc.org/net/rss_2.0/enc#"
xmlns:fh="http://purl.org/syndication/history/1.0"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:foo="http://purl.org/rss/1.0/"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns:georss="http://www.georss.org/georss"
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:prov="http://www.w3.org/ns/prov#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:sioc="http://rdfs.org/sioc/ns#"
xmlns:sioct="http://rdfs.org/sioc/types#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match='/rss'>
<!-- index right-to-left language codes -->
<xsl:variable name='rtl'
select='channel/language[
contains(text(),"ar") or
contains(text(),"fa") or
contains(text(),"he") or
contains(text(),"ji") or
contains(text(),"ku") or
contains(text(),"ur") or
contains(text(),"yi")]'/>
<html>
<head>
<xsl:call-template name='metadata'>
<xsl:with-param name='name' select='"description"' />
<xsl:with-param name='content' select='channel/description' />
</xsl:call-template>
<xsl:call-template name='metadata'>
<xsl:with-param name='name' select='"generator"' />
<xsl:with-param name='content' select='StreamBurner' />
</xsl:call-template>
<xsl:call-template name='metadata'>
<xsl:with-param name='name' select='"mimetype"' />
<xsl:with-param name='content' select='"application/rss+xml"' />
</xsl:call-template>
<title>
<xsl:choose>
<xsl:when test='channel/title and not(channel/title="")'>
<xsl:value-of select='channel/title'/>
</xsl:when>
<xsl:otherwise>StreamBurner News Reader</xsl:otherwise>
</xsl:choose>
</title>
<!-- TODO media='print' -->
<link href='css/stylesheet.css' rel='stylesheet' type='text/css' media='screen'/>
<!-- whether language code is of direction right-to-left -->
<xsl:if test='$rtl'>
<link id='semitic' href='css/stylesheet-rtl.css' rel='stylesheet' type='text/css' />
</xsl:if>
<base>
<xsl:attribute name='href'>
<xsl:value-of select='channel/link'/>
</xsl:attribute>
</base>
</head>
<body>
<div id='feed'>
<div id='header'>
<!-- feed title -->
<h1 id='title'>
<xsl:choose>
<xsl:when test='channel/title and not(channel/title="")'>
<xsl:value-of select='channel/title'/>
</xsl:when>
<xsl:otherwise>
No title
</xsl:otherwise>
</xsl:choose>
</h1>
<!-- feed subtitle -->
<h2 id='subtitle'>
<xsl:choose>
<xsl:when test='channel/itunes:subtitle'>
<xsl:value-of select='channel/itunes:subtitle'/>
</xsl:when>
<xsl:when test='channel/description'>
<xsl:value-of select='channel/description'/>
</xsl:when>
</xsl:choose>
</h2>
</div>
<xsl:choose>
<xsl:when test='channel/item'>
<div id='menu'>
<h3>Latest Posts</h3>
<ol id='toc'>
<xsl:for-each select='channel/item[not(position() >20)]'>
<li>
<xsl:choose>
<xsl:when test='itunes:subtitle'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:text>#newspaper-oujs-</xsl:text>
<xsl:value-of select='position()'/>
</xsl:attribute>
<xsl:value-of select='itunes:subtitle'/>
</xsl:element>
</xsl:when>
<xsl:when test='title'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:text>#newspaper-oujs-</xsl:text>
<xsl:value-of select='position()'/>
</xsl:attribute>
<xsl:value-of select='title'/>
</xsl:element>
</xsl:when>
</xsl:choose>
</li>
</xsl:for-each>
</ol>
</div>
</xsl:when>
</xsl:choose>
<div id='articles'>
<!-- feed entry -->
<xsl:choose>
<xsl:when test='channel/item'>
<ul>
<xsl:for-each select='channel/item[not(position() >20)]'>
<li>
<div class='entry'>
<!-- entry title -->
<xsl:choose>
<xsl:when test='itunes:subtitle'>
<h3 class='title'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='link'/>
</xsl:attribute>
<xsl:attribute name='title'>
<xsl:value-of select='itunes:subtitle'/>
</xsl:attribute>
<xsl:attribute name='id'>
<xsl:text>newspaper-oujs-</xsl:text>
<xsl:value-of select='position()'/>
</xsl:attribute>
<xsl:value-of select='itunes:subtitle'/>
</xsl:element>
</h3>
</xsl:when>
<xsl:when test='title'>
<h3 class='title'>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='link'/>
</xsl:attribute>
<xsl:attribute name='title'>
<xsl:value-of select='title'/>
</xsl:attribute>
<xsl:attribute name='id'>
<xsl:text>newspaper-oujs-</xsl:text>
<xsl:value-of select='position()'/>
</xsl:attribute>
<xsl:value-of select='title'/>
</xsl:element>
</h3>
</xsl:when>
<xsl:otherwise>
<h3 class='warning rss2 title'></h3>
</xsl:otherwise>
</xsl:choose>
<!-- geographic location -->
<xsl:choose>
<xsl:when test='geo:lat and geo:long'>
<xsl:variable name='lat' select='geo:lat'/>
<xsl:variable name='lng' select='geo:long'/>
<span class='geolocation'>
<a href='geo:{$lat},{$lng}'>📍</a>
</span>
</xsl:when>
<xsl:when test='geo:Point'>
<xsl:variable name='lat' select='geo:Point/geo:lat'/>
<xsl:variable name='lng' select='geo:Point/geo:long'/>
<span class='geolocation'>
<a href='geo:{$lat},{$lng}'>📍</a>
</span>
</xsl:when>
<xsl:when test='georss:point'>
<xsl:variable name='lat' select='substring-before(georss:point, " ")'/>
<xsl:variable name='lng' select='substring-after(georss:point, " ")'/>
<xsl:variable name='name' select='georss:featurename'/>
<span class='geolocation'>
<a href='geo:{$lat},{$lng}' title='{$name}'>📍</a>
</span>
</xsl:when>
</xsl:choose>
<!-- div class='posted' -->
<!-- entry author -->
<!-- span class='author'>
<xsl:choose>
<xsl:when test='itunes:author'>
<xsl:value-of select='itunes:author'/>
</xsl:when>
<xsl:when test='author'>
<xsl:value-of select='author'/>
</xsl:when>
</xsl:choose>
</span-->
<!-- entry date -->
<xsl:if test='pubDate'>
<div class='published'>
<xsl:value-of select='pubDate'/>
</div>
</xsl:if>
<!-- /div -->
<!-- entry content -->
<xsl:choose>
<!-- complete text post -->
<xsl:when test='content:encoded'>
<div class='content'>
<xsl:value-of select='content:encoded' disable-output-escaping='yes'/>
</div>
</xsl:when>
<!-- description of post -->
<xsl:when test='description'>
<div class='content'>
<xsl:value-of select='description' disable-output-escaping='yes'/>
</div>
</xsl:when>
<!-- itunes text post -->
<xsl:when test='itunes:summary'>
<div class='content'>
<xsl:value-of select='itunes:summary' disable-output-escaping='yes'/>
</div>
</xsl:when>
<xsl:otherwise>
<div class='warning rss2 description'></div>
</xsl:otherwise>
</xsl:choose>
<!-- entry enclosure -->
<xsl:if test='enclosure or media:content'>
<div class='enclosure' title='Right-click and Save link as…'>
<xsl:for-each select='enclosure'>
<xsl:element name='span'>
<xsl:attribute name='icon'>
<xsl:value-of select='substring-before(@type,"/")'/>
</xsl:attribute>
</xsl:element>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='@url'/>
</xsl:attribute>
<xsl:attribute name='download'/>
<xsl:call-template name='extract-filename'>
<xsl:with-param name='url' select='@url' />
</xsl:call-template>
</xsl:element>
<xsl:element name='span'>
<xsl:attribute name='class'>
<xsl:value-of select='substring-before(@type,"/")'/>
</xsl:attribute>
</xsl:element>
<xsl:if test='@length &gt; 0'>
<xsl:call-template name='transform-filesize'>
<xsl:with-param name='length' select='@length' />
</xsl:call-template>
</xsl:if>
<xsl:element name='br'/>
</xsl:for-each>
<xsl:for-each select='media:content'>
<xsl:element name='span'>
<xsl:attribute name='icon'>
<xsl:value-of select='@medium'/>
</xsl:attribute>
</xsl:element>
<xsl:element name='a'>
<xsl:attribute name='href'>
<xsl:value-of select='@url'/>
</xsl:attribute>
<xsl:attribute name='download'/>
<xsl:call-template name='extract-filename'>
<xsl:with-param name='url' select='@url' />
</xsl:call-template>
</xsl:element>
<xsl:element name='span'>
<xsl:attribute name='class'>
<xsl:value-of select='@medium'/>
</xsl:attribute>
</xsl:element>
<xsl:if test='@fileSize &gt; 0'>
<xsl:call-template name='transform-filesize'>
<xsl:with-param name='length' select='@fileSize' />
</xsl:call-template>
</xsl:if>
<xsl:element name='br'/>
</xsl:for-each>
</div>
</xsl:if>
</div>
</li>
</xsl:for-each>
</ul>
</xsl:when>
<xsl:otherwise>
<div class='notice no-entry'></div>
</xsl:otherwise>
</xsl:choose>
</div>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

37
xsl/stylesheet.xsl Normal file
View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2016 - 2017 Schimon Jehuda. Released under MIT license
Feeds rendered using this XSLT stylesheet, or it's derivatives, must
include https://schimon.i2p/ in attribute name='generator' of
element <meta/> inside of html element </head>
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding = 'UTF-8'
indent = 'yes'
media-type = 'application/xml'
method = 'html'
omit-xml-decleration='no'
version = '4.01' />
<!-- Atom Syndication Format 1.0 -->
<xsl:include href='atom_as_xhtml.xsl'/>
<!-- RDF 1.1 -->
<xsl:include href='rdf_as_xhtml.xsl'/>
<!-- RSS 2.0 -->
<xsl:include href='rss_as_xhtml.xsl'/>
<!-- extract filename from given url string -->
<xsl:include href='extract-filename.xsl'/>
<!-- set page metadata -->
<xsl:include href='metadata.xsl'/>
<!-- transform filesize from given length string -->
<xsl:include href='transform-filesize.xsl'/>
</xsl:stylesheet>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2016 - 2017 Schimon Jehuda. Released under MIT license
Feeds rendered using this XSLT stylesheet, or it's derivatives, must
include https://schimon.i2p/ in attribute name='generator' of
element <meta/> inside of html element </head>
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- transform filesize from given length string -->
<xsl:template name='transform-filesize'>
<xsl:param name='length'/>
<!-- TODO consider xsl:decimal-format and xsl:number -->
<xsl:choose>
<!-- TODO consider removal of Byte -->
<xsl:when test='$length &lt; 2'>
<xsl:value-of select='$length'/>
Byte
</xsl:when>
<xsl:when test='floor($length div 1024) &lt; 1'>
<xsl:value-of select='$length'/>
Bytes
</xsl:when>
<xsl:when test='floor($length div (1024 * 1024)) &lt; 1'>
<xsl:value-of select='floor($length div 1024)'/>.<xsl:value-of select='substring($length mod 1024,0,2)'/>
KiB
</xsl:when>
<xsl:when test='floor($length div (1024 * 1024 * 1024)) &lt; 1'>
<xsl:value-of select='floor($length div (1024 * 1024))'/>.<xsl:value-of select='substring($length mod (1024 * 1024),0,2)'/>
MiB
</xsl:when>
<xsl:otherwise>
<!-- P2P links -->
<xsl:value-of select='floor($length div (1024 * 1024 * 1024))'/>.<xsl:value-of select='substring($length mod (1024 * 1024 * 1024),0,2)'/>
GiB
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>