ignore bogus links when assembling article footnotes

workspace
Brendan Howell 5 years ago
parent f854e5e12a
commit 9c8e26b426

@ -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;
}

@ -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 = '<img src="%s"/>' % encoded_data

Loading…
Cancel
Save