urlquote/unquote for link rewriting

pull/6/head
Michael Murtaugh 4 years ago
parent 399e49a58e
commit d4fc79c742

@ -7,6 +7,8 @@ import html5lib
from functions import Colors
import argparse
from xml.etree import ElementTree as ET
from urllib.parse import quote as urlquote, unquote as urlunquote
p = argparse.ArgumentParser(description="Dump wiki files to html",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
@ -37,9 +39,11 @@ def filenameforpage(p):
return f
def filenameforlink(href):
href = urlunquote(href)
if href.startswith("/sandbox/itchwiki/index.php/"):
href = href[len("/sandbox/itchwiki/index.php/"):]
return href.replace(' ','_').replace('/', SLASH) + '.html'
href = href.replace(' ','_').replace('/', SLASH) + '.html'
href = urlquote(href)
return href
def rewritelinks (html):

Loading…
Cancel
Save