writing html content to file

pull/7/head
Castro0o 5 years ago
parent 25092cb9dd
commit c0ad1dd621

@ -34,6 +34,7 @@ with open('login.txt', 'r') as login: # read login user & pwd
SLASH = "\u2044" SLASH = "\u2044"
HYPHEN = "\u2010"
def filenameforpage(p): def filenameforpage(p):
@ -44,7 +45,7 @@ def filenameforlink(href):
href = urlunquote(href) href = urlunquote(href)
if href.startswith("/sandbox/itchwiki/index.php/"): if href.startswith("/sandbox/itchwiki/index.php/"):
href = href[len("/sandbox/itchwiki/index.php/"):] href = href[len("/sandbox/itchwiki/index.php/"):]
href = href.replace(' ','_').replace('/', SLASH) + '.html' href = href.replace(' ','_').replace('/', SLASH).replace('', HYPHEN) + '.html'
href = urlquote(href) href = urlquote(href)
return href return href
@ -101,7 +102,7 @@ for cat in publish.members():
html = template.render(page=p, body=htmlsrc, staticpath='0') html = template.render(page=p, body=htmlsrc, staticpath='0')
with open(os.path.join(args.output, filenameforpage(p)), 'w') as f: with open(os.path.join(args.output, filenameforpage(p)), 'w') as f:
pass f.write(html)
# print(html, file=f) # print(html, file=f)
if args.one: if args.one:
break break

Loading…
Cancel
Save