Rename project to Rivista;

CSS: Improve position of elements;
JS: Improve handling of content in erroneous cases;
JS: Render post as HTML when XSLT does not render correctly;
JS: Handle posts which were tagged as Text instead of HTML and vice versa;
XSLT: Adapt to be viewed on browsers with a lack of support;
XSLT: Add Support for link elements of attribute "rel";
Python: Add elements author and link of attribute "rel".
This commit is contained in:
Schimon Jehudah, Adv. 2024-07-13 22:16:25 +03:00
parent 040d532fb9
commit cb4507bb78
8 changed files with 510 additions and 322 deletions

View file

@ -2,7 +2,8 @@ window.onload = async function(){
let locationHref = new URL(location.href);
let node = locationHref.searchParams.get('node')
let pubsub = locationHref.searchParams.get('pubsub')
// Fix button follow
// Set button follow
let follow = document.querySelector('#follow');
if (follow) {
//let feedUrl = location.href.replace(/^https?:/, 'feed:');
@ -14,6 +15,7 @@ window.onload = async function(){
// Fix button subtome
document.querySelector('#subtome').href='https://www.subtome.com/#/subscribe?feeds=' + feedUrl;
}
// Convert ISO8601 To UTC
for (let element of document.querySelectorAll(
'#articles > ul > li > div > h4.published,' +
@ -22,11 +24,62 @@ window.onload = async function(){
let timeStamp = new Date(element.textContent);
element.textContent = timeStamp.toUTCString();
}
// Parse Markdown
for (let element of document.querySelectorAll('#articles div[type="text"]')) {
let markDown = element.textContent
element.innerHTML = marked.parse(markDown);
element.innerHTML = marked.parse(element.textContent);
}
// NOTE Report this issue to Movim. See node "deltachat" of pubsub "news.movim.eu".
for (let element of document.querySelectorAll('#articles div[type="html"]')) {
if (!element.children.length) {
element.innerHTML = marked.parse(element.textContent);
}
}
/*
NOTE
The reason for the following code to parse HTML inside an software which
already parses HTML, is that some people who influence the so called Gecko
HTML Engine product (mostly people from the advertisement industry with whom
I shamefully used to work with) have intentions to eliminate standards and
technologies such as Syndication (Atom/RDF/RSS), XSLT and many other
technologies that actually empower people and their privacy.
Recently, some changes were made to the XSLT parser of Gecko which result in
noncompliance with the XSLT standard.
The XSLT feature that was removed is "disable-output-escaping" which upon the
value "yes" the XSLT engine should transform and treat a subject string into
HTML, yet the Gecko HTML Engine ignores this XSLT direction.
This change was probably made in order to:
* Frustrate new XSLT developers; or
* Influence new XSLT developers to think that XSLT has a limited set of
features and believing of some sort of inability to parse HTML from a
retrieved HTML string; and
* Consequently cause developers to abstain from using the XSLT technology.
Do not use HTML browsers or use Ladybird, Pale Moon or browsers that are
powered by KHTML (WebKit) instead of anti-privacy software such as Chromium
and Gecko.
*/
// Parse HTML
//if (navigator.userAgent.includes(') Gecko/')) {
// for (let element of document.querySelectorAll('#articles div[type="html"]')) {
// element.innerHTML = element.textContent;
// }
//}
for (let element of document.querySelectorAll('#articles div[type="html"]')) {
if (!element.children.length) {
element.innerHTML = element.textContent;
}
}
// Build a journal list
if (node) {
itemsList = await openJson(node)
@ -79,8 +132,11 @@ window.onload = async function(){
document.querySelector('#articles').appendChild(elementDiv);
}
}
// Convert URI xmpp: to URI http: links.
for (let xmppLink of document.querySelectorAll('#articles > ul a[href^="xmpp:"], ol a[href^="xmpp:"]')) {
for (let xmppLink of document.querySelectorAll(
'#articles > ul > li > div > h3 > a[href^="xmpp:"],' +
'#journal > ol > li > a[href^="xmpp:"]')) {
xmppUri = new URL(xmppLink);
let parameters = xmppUri.search.split(';');
try {
@ -98,6 +154,7 @@ window.onload = async function(){
console.warn(err)
}
}
// Display a selection of suggested software.
const selection = {
'akregator' : {
@ -144,14 +201,14 @@ window.onload = async function(){
elementH1.textContent = 'Get A News Reader';
elementDiv.appendChild(elementH1);
let elementH2 = document.createElement('h2');
elementH2.textContent = 'Install Feed Reader Apps For Desktop And Mobile';
elementH2.textContent = 'Install A Feed Reader For Desktop And Mobile';
elementDiv.appendChild(elementH2);
const brands = Object.keys(selection);
let elementDivSel = document.createElement('div');
elementDivSel.id = 'selection';
for (let i = 0; i < brands.length; i++) {
let brand = brands[i];
elementSpan = document.createElement('span');
let elementSpan = document.createElement('span');
let elementA = document.createElement('a');
elementA.href = selection[brand].url;
elementA.textContent = selection[brand].name;
@ -162,20 +219,24 @@ window.onload = async function(){
elementDivSel.appendChild(elementSpan);
elementDiv.appendChild(elementDivSel);
}
let elementP = document.createElement('p');
elementP.textContent = '' +
'This is a selection of desktop applications, mobile apps and online ' +
'services for you to choose from. This selection includes news ' +
'readers, podcast managers, torrent clients, chat bots, HTML browsers ' +
'and plugins which support syndication feeds.';
elementDiv.appendChild(elementP);
let elementDivReturn = document.createElement('div');
elementDivReturn.id = 'return';
elementDivReturn.textContent = 'Return To PubSub...';
elementDivReturn.addEventListener ('click', function() {
let elementP1 = document.createElement('p');
elementP1.textContent = '' +
'This is a selection of desktop, mobile and HTML (sometimes referred to ' +
'as "online") News Readers for you to choose from.';
elementDiv.appendChild(elementP1);
let elementP2 = document.createElement('p');
elementP2.textContent = '' +
'This selection includes: Podcast Managers, Torrent ' +
'Clients, Chat Bots, HTML Browsers and Plugins which support ' +
'syndication feeds.';
elementDiv.appendChild(elementP2);
let elementSpan = document.createElement('span');
elementSpan.id = 'return';
elementSpan.textContent = 'Return To PubSub';
elementSpan.addEventListener ('click', function() {
document.querySelector('#selection-page').remove();
});
elementDiv.appendChild(elementDivReturn);
elementDiv.appendChild(elementSpan);
document.body.appendChild(elementDiv);
});
}