From 44e77785785b769061aca9a4c22a1cd817d589db Mon Sep 17 00:00:00 2001 From: "Schimon Jehudah, Adv." Date: Sun, 14 Jul 2024 14:14:34 +0300 Subject: [PATCH] Improve the presentation of related links. --- pubsub_to_atom.py | 33 +++++++++++++++++---------------- script/postprocess.js | 1 + xsl/atom_as_xhtml.xsl | 20 +++++++++++++++++++- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/pubsub_to_atom.py b/pubsub_to_atom.py index d2261be..064a46f 100644 --- a/pubsub_to_atom.py +++ b/pubsub_to_atom.py @@ -107,22 +107,23 @@ async def view_node_items(request: Request): link = form_an_item_link(pubsub, node, item_id) xml_atom = generate_atom(iq, link) iq = await get_node_items(pubsub, node) - if iq: - generate_json(iq) - else: - operator = get_configuration('settings')['operator'] - json_data = [{'title' : 'Error retrieving node items.', - 'link' : ('javascript:alert("Rivista has experienced an error ' - 'while attempting to retrieve the list of items for ' - 'Node {} of PubSub {}.")') - .format(node, pubsub)}, - {'title' : 'Contact the operator.', - 'link' : ('xmpp:{}?message;subject=Rivista;body=Greetings! ' - 'I am contacting you to inform you that there is an error listing ' - 'node items for Node {} on PubSub {}.').format(operator, node, pubsub)}] - filename = 'data/{}.json'.format(node) - with open(filename, 'w', encoding='utf-8') as f: - json.dump(json_data, f, ensure_ascii=False, indent=4) + if not '/' in node: + if iq: + generate_json(iq) + else: + operator = get_configuration('settings')['operator'] + json_data = [{'title' : 'Error retrieving node items.', + 'link' : ('javascript:alert("Rivista has experienced an error ' + 'while attempting to retrieve the list of items for ' + 'Node {} of PubSub {}.")') + .format(node, pubsub)}, + {'title' : 'Contact the operator.', + 'link' : ('xmpp:{}?message;subject=Rivista;body=Greetings! ' + 'I am contacting you to inform you that there is an error listing ' + 'node items for Node {} on PubSub {}.').format(operator, node, pubsub)}] + filename = 'data/{}.json'.format(node) + with open(filename, 'w', encoding='utf-8') as f: + json.dump(json_data, f, ensure_ascii=False, indent=4) else: text = 'Please ensure that the PubSub node and item are valid and accessible.' xml_atom = error_message(text) diff --git a/script/postprocess.js b/script/postprocess.js index 24667fe..45b4660 100644 --- a/script/postprocess.js +++ b/script/postprocess.js @@ -136,6 +136,7 @@ window.onload = async function(){ // Convert URI xmpp: to URI http: links. for (let xmppLink of document.querySelectorAll( '#articles h3 > a[href^="xmpp:"][id^="rivista-"],' + + '#articles h5.related > a[class^="rivista-"],' + '#journal > ol > li > a[href^="xmpp:"]')) { xmppUri = new URL(xmppLink); let parameters = xmppUri.search.split(';'); diff --git a/xsl/atom_as_xhtml.xsl b/xsl/atom_as_xhtml.xsl index b9dc056..e9232cf 100644 --- a/xsl/atom_as_xhtml.xsl +++ b/xsl/atom_as_xhtml.xsl @@ -284,7 +284,16 @@ xmlns:atom='http://www.w3.org/2005/Atom'> - 💡️ XMPP + + rivista-jabber + + 💡️ Source + + + + + + (XMPP) @@ -292,8 +301,17 @@ xmlns:atom='http://www.w3.org/2005/Atom'> + + rivista-replies + 💬 Discussion + + + + + (XMPP) +