disabeling links to wiki File pages

pull/8/head
Castro0o 4 years ago
parent fa837a3791
commit 27cc21a58a

@ -53,6 +53,14 @@ def filenameforlink(href):
def rewritelinks (html):
t = html5lib.parseFragment(html, treebuilder = "etree", namespaceHTMLElements = False)
# remove links to wiki File: pages
for a in t.findall(".//a[@class='image']"): # select img wrapping a
href = a.attrib.get('href')
if a.findall(".//img") and 'File:' in href: # ensure a has child: img
a.attrib['href'] = 'javascript:void(0);' # disable href
print('a wrapping img:', ET.tostring(a))
for a in t.findall(".//*[@href]"):
linkclass = a.attrib.get("class", "")
href = a.attrib.get("href")

@ -11,4 +11,6 @@ a, a:visited{
a:hover {
text-decoration: none;
color: blue;
}
}
a.image {cursor: default!important;} /* KEEP THIS: it is important to avoid images to seeming like links */
Loading…
Cancel
Save