From 9c8e26b42646bf22da4ce31e1de3fdc5c19457b9 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Wed, 26 Feb 2020 10:45:18 +0100 Subject: [PATCH] ignore bogus links when assembling article footnotes --- screenless/bureau/publications/article.html | 4 +--- screenless/bureau/publications/publications.py | 15 +++++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/screenless/bureau/publications/article.html b/screenless/bureau/publications/article.html index 1ce6d9a..e30a20e 100644 --- a/screenless/bureau/publications/article.html +++ b/screenless/bureau/publications/article.html @@ -25,9 +25,7 @@ text-decoration: none; color: inherit; } - a::after { - counter-increment: sidenote-counter; - content: counter(sidenote-counter); + .footlink { font-size: 7pt; vertical-align: super; } diff --git a/screenless/bureau/publications/publications.py b/screenless/bureau/publications/publications.py index ed42e67..85395fd 100644 --- a/screenless/bureau/publications/publications.py +++ b/screenless/bureau/publications/publications.py @@ -9,9 +9,9 @@ import string import threading import urllib.request, urllib.parse, urllib.error -import barcode import bleach import feedparser +import kode256 import lxml.html import PIL from readability import readability @@ -165,7 +165,13 @@ class Publications(Bureau): continue # skip bogus links tmpcode = self._make_shorturl(link.attrib["href"]) - svg = self.bc_svg("PBr." + tmpcode, height=7.0) + footlink = html.makeelement("span") + footlink.attrib["class"] = "footlink" + footlink.text = str(notecount) + link.append(footlink) + + svg = kode256.svg("PBr." + tmpcode) + #svg = self.bc_svg("PBr." + tmpcode, height=7.0) footnote = html.makeelement("div") footnote.attrib["class"] = "footnote" @@ -276,8 +282,9 @@ class Publications(Bureau): entry.source = feed.feed.title entry.dbhash = self._make_shorturl(entry.link) - entry.svg = self.bc_svg("PBr." + entry.dbhash, width=0.24, - height=7.0) + entry.svg = kode256.svg("PBr." + entry.dbhash) + #entry.svg = self.bc_svg("PBr." + entry.dbhash, width=0.24, + # height=7.0) encoded_svg = b64encode(entry.svg.encode()).decode() encoded_data = "data:image/svg+xml;charset=utf-8;base64," + encoded_svg entry.svg = '' % encoded_data