From ad34af72ffb106c7ef8eb8430f53f4e487f7bff5 Mon Sep 17 00:00:00 2001 From: "Schimon Jehudah, Adv." Date: Wed, 31 Jul 2024 19:21:33 +0300 Subject: [PATCH] Add support for contents of Libervia (XEP-0277); Various of visual improvements. --- css/stylesheet.css | 9 +++++++-- pubsub_to_atom.py | 14 +++++++++++--- script/postprocess.js | 2 +- xsl/atom_as_xhtml.xsl | 35 ++++++++++++++++++++++++----------- xsl/opml_as_xhtml.xsl | 35 ++++++++++++++++++++++++----------- 5 files changed, 67 insertions(+), 28 deletions(-) diff --git a/css/stylesheet.css b/css/stylesheet.css index 00c8049..0fd3c56 100644 --- a/css/stylesheet.css +++ b/css/stylesheet.css @@ -191,6 +191,7 @@ h3.title > a { #articles div.entry span.tags { display: inline-flex; /* display: ruby; */ + flex-wrap: wrap; } #articles div.entry span.tags > div { @@ -271,16 +272,20 @@ h3.title > a { margin:3px; } -#note { +#note, #small { line-height: 30px; margin: auto; margin-top: 0.67em; - max-width: 70%; + max-width: 80%; padding: 10px; text-align: center; user-select: none; } +#small { + font-size: 80%; +} + @media (max-width: 1550px) { #articles { display: unset; diff --git a/pubsub_to_atom.py b/pubsub_to_atom.py index 064a46f..a8645e1 100644 --- a/pubsub_to_atom.py +++ b/pubsub_to_atom.py @@ -16,8 +16,6 @@ try: except: import tomli as tomllib -app = FastAPI() - class XmppInstance(ClientXMPP): def __init__(self, jid, password): super().__init__(jid, password) @@ -27,6 +25,8 @@ class XmppInstance(ClientXMPP): xmpp = None +app = FastAPI() + # Mount static graphic, script and stylesheet directories app.mount("/css", StaticFiles(directory="css"), name="css") app.mount("/data", StaticFiles(directory="data"), name="data") @@ -38,6 +38,7 @@ app.mount("/xsl", StaticFiles(directory="xsl"), name="xsl") async def favicon(): return FileResponse('favicon.ico') +@app.route('/') @app.get('/opml') async def view_pubsub_nodes(request: Request): global xmpp @@ -305,7 +306,14 @@ def generate_atom(iq, link): content_type_text = 'html' if 'html' in content_type else 'text' ET.SubElement(e_entry, 'content', {'type': content_type_text}).text = content_text else: - ET.SubElement(e_entry, 'content').text = 'No content.' + summary = item_payload.find(namespace + 'summary') + summary_text = summary.text + if summary_text: + summary_type = summary.attrib['type'] if 'type' in summary.attrib else 'html' + summary_type_text = 'html' if 'html' in summary_type else 'text' + ET.SubElement(e_entry, 'content', {'type': summary_type_text}).text = summary_text + else: + ET.SubElement(e_entry, 'content').text = 'No content.' published = item_payload.find(namespace + 'published') published_text = None if published == None else published.text ET.SubElement(e_entry, 'published').text = published_text diff --git a/script/postprocess.js b/script/postprocess.js index 45b4660..cdd5789 100644 --- a/script/postprocess.js +++ b/script/postprocess.js @@ -199,7 +199,7 @@ window.onload = async function(){ let elementDiv = document.createElement('div'); elementDiv.id = 'selection-page'; let elementH1 = document.createElement('h1'); - elementH1.textContent = 'Get A News Reader'; + elementH1.textContent = 'Select A News Reader'; elementDiv.appendChild(elementH1); let elementH2 = document.createElement('h2'); elementH2.textContent = 'Install A Feed Reader For Desktop And Mobile'; diff --git a/xsl/atom_as_xhtml.xsl b/xsl/atom_as_xhtml.xsl index e9232cf..e5fa93f 100644 --- a/xsl/atom_as_xhtml.xsl +++ b/xsl/atom_as_xhtml.xsl @@ -390,7 +390,7 @@ xmlns:atom='http://www.w3.org/2005/Atom'> -

Enclosures

+

Media

@@ -467,8 +467,12 @@ xmlns:atom='http://www.w3.org/2005/Atom'> title='A Journal Publisher And Browser For XMPP.'> Rivista + + Blasta + + title='An XMPP-Based Feed Reader.'> Reeder

+ 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. + Click here for a + selection of software and pick the ones that would fit + to you best! +

+

- This is an Atom document which is conveyed as an XHTML - document; - This document 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. - Click here for a - selection of software and pick the ones that would fit - to you best! + This ASF (Atom Syndication Format) + document is conveyed as an XHTML document. + This document was produced by an + XSLT stylesheet. + XSLT is a powerful technology which transforms XML + documents into HTML, JSON, PDF, Text XHTML, and + (modified) XML documents; + Learn more + about The Extensible Stylesheet Language Family (XSL).

diff --git a/xsl/opml_as_xhtml.xsl b/xsl/opml_as_xhtml.xsl index a0ac35e..f8bc108 100644 --- a/xsl/opml_as_xhtml.xsl +++ b/xsl/opml_as_xhtml.xsl @@ -183,8 +183,12 @@ xmlns:xml='http://www.w3.org/XML/1998/namespace'> title='A Journal Publisher And Browser For XMPP.'> Rivista + + Blasta + + title='An XMPP-Based Feed Reader.'> Reeder

+ 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. + Click here for a + selection of software and pick the ones that would fit + to you best! +

+

- This is an OPML document which is conveyed as an XHTML - document; - This document includes a collection of subscriptions, - and it can be imported to a Syndication Feed Reader - (also referred to as News Reader or RSS Reader) reader - which provides automated news updates and notifications - on desktop and mobile. - Click here for a - selection of software and pick the ones that would fit - to you best! + This OPML (Outline Processor Markup Language) + document is conveyed as an XHTML document. + This document was produced by an + XSLT stylesheet. + XSLT is a powerful technology which transforms XML + documents into HTML, JSON, PDF, Text XHTML, and + (modified) XML documents; + Learn more + about The Extensible Stylesheet Language Family (XSL).