ignore bogus links when assembling article footnotes

workspace
Brendan Howell 4 years ago
parent f854e5e12a
commit 9c8e26b426

@ -25,9 +25,7 @@
text-decoration: none; text-decoration: none;
color: inherit; color: inherit;
} }
a::after { .footlink {
counter-increment: sidenote-counter;
content: counter(sidenote-counter);
font-size: 7pt; font-size: 7pt;
vertical-align: super; vertical-align: super;
} }

@ -9,9 +9,9 @@ import string
import threading import threading
import urllib.request, urllib.parse, urllib.error import urllib.request, urllib.parse, urllib.error
import barcode
import bleach import bleach
import feedparser import feedparser
import kode256
import lxml.html import lxml.html
import PIL import PIL
from readability import readability from readability import readability
@ -165,7 +165,13 @@ class Publications(Bureau):
continue # skip bogus links continue # skip bogus links
tmpcode = self._make_shorturl(link.attrib["href"]) 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 = html.makeelement("div")
footnote.attrib["class"] = "footnote" footnote.attrib["class"] = "footnote"
@ -276,8 +282,9 @@ class Publications(Bureau):
entry.source = feed.feed.title entry.source = feed.feed.title
entry.dbhash = self._make_shorturl(entry.link) entry.dbhash = self._make_shorturl(entry.link)
entry.svg = self.bc_svg("PBr." + entry.dbhash, width=0.24, entry.svg = kode256.svg("PBr." + entry.dbhash)
height=7.0) #entry.svg = self.bc_svg("PBr." + entry.dbhash, width=0.24,
# height=7.0)
encoded_svg = b64encode(entry.svg.encode()).decode() encoded_svg = b64encode(entry.svg.encode()).decode()
encoded_data = "data:image/svg+xml;charset=utf-8;base64," + encoded_svg encoded_data = "data:image/svg+xml;charset=utf-8;base64," + encoded_svg
entry.svg = '<img src="%s"/>' % encoded_data entry.svg = '<img src="%s"/>' % encoded_data

Loading…
Cancel
Save