diff --git a/dumpwiki.py b/dumpwiki.py index 1a97ef0..4635c2d 100644 --- a/dumpwiki.py +++ b/dumpwiki.py @@ -36,6 +36,12 @@ def filenameforpage(p): f = p.name.replace(' ','_').replace('/', SLASH) + '.html' 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): t = html5lib.parseFragment(html, treebuilder = "etree", namespaceHTMLElements = False) for a in t.findall(".//*[@href]"):