filenameforhref

pull/6/head
Michael Murtaugh 5 years ago
parent a57bfedd68
commit 426889e00d

@ -36,6 +36,12 @@ def filenameforpage(p):
f = p.name.replace(' ','_').replace('/', SLASH) + '.html' f = p.name.replace(' ','_').replace('/', SLASH) + '.html'
return f return f
def filenameforlink(href):
if href.startswith("/sandbox/itchwiki/index.php/"):
href = href[len("/sandbox/itchwiki/index.php/"):]
return href.replace(' ','_').replace('/', SLASH) + '.html'
return href
def rewritelinks (html): def rewritelinks (html):
t = html5lib.parseFragment(html, treebuilder = "etree", namespaceHTMLElements = False) t = html5lib.parseFragment(html, treebuilder = "etree", namespaceHTMLElements = False)
for a in t.findall(".//*[@href]"): for a in t.findall(".//*[@href]"):

Loading…
Cancel
Save