|
|
@ -16,6 +16,7 @@ p.add_argument("--host", metavar='', default="hub.xpub.nl/sandbox", help='wiki
|
|
|
|
p.add_argument("--path", metavar='', default="/itchwiki/", help="Wiki path. Should end with /")
|
|
|
|
p.add_argument("--path", metavar='', default="/itchwiki/", help="Wiki path. Should end with /")
|
|
|
|
p.add_argument("--output", default="/var/www/html/archive", help="Output path for pages")
|
|
|
|
p.add_argument("--output", default="/var/www/html/archive", help="Output path for pages")
|
|
|
|
p.add_argument("--one", default=False, action="store_true", help="Output one page from each category only")
|
|
|
|
p.add_argument("--one", default=False, action="store_true", help="Output one page from each category only")
|
|
|
|
|
|
|
|
p.add_argument("--local", default=False, action="store_true", help="When creating a local archives. Add full URL to images")
|
|
|
|
|
|
|
|
|
|
|
|
args = p.parse_args()
|
|
|
|
args = p.parse_args()
|
|
|
|
|
|
|
|
|
|
|
@ -58,6 +59,11 @@ def rewritelinks (html):
|
|
|
|
if href.startswith("/sandbox/itchwiki/index.php/"):
|
|
|
|
if href.startswith("/sandbox/itchwiki/index.php/"):
|
|
|
|
new_href = filenameforlink(href)
|
|
|
|
new_href = filenameforlink(href)
|
|
|
|
a.attrib['href'] = new_href
|
|
|
|
a.attrib['href'] = new_href
|
|
|
|
|
|
|
|
if args.local is True:
|
|
|
|
|
|
|
|
for img in t.findall(".//img[@src]"):
|
|
|
|
|
|
|
|
src = img.attrib.get("src")
|
|
|
|
|
|
|
|
if not src.startswith('http'):
|
|
|
|
|
|
|
|
img.attrib['src'] = 'https://hub.xpub.nl' + src
|
|
|
|
html = ET.tostring(t, method="html", encoding="unicode")
|
|
|
|
html = ET.tostring(t, method="html", encoding="unicode")
|
|
|
|
return html
|
|
|
|
return html
|
|
|
|
|
|
|
|
|
|
|
|