diff options
author | Rob Austein <sra@hactrn.net> | 2021-06-03 01:03:44 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2021-06-03 01:18:24 +0000 |
commit | d0c10e7a18909984011a279b8d6ca95a20d57b6a (patch) | |
tree | eddc293f3a6576c205241a46c789b4bfc1681d47 | |
parent | 8f033beb4527b6e8760b95e4e31068915ebdff05 (diff) |
Undo URL quoting of directory names in Markdown output
-rwxr-xr-x | extract.py | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -49,7 +49,7 @@ def attachment_link(row): fn2 = os.path.splitext(row["filename"])[1] return \ os.path.join("attachments", "wiki", h1[:3], h1, h2 + fn2), \ - os.path.join("pelican", "content", urllib.parse.quote(row.id, ""), row.filename) + os.path.join("pelican", "content", row.id, row.filename) class Filter: @@ -108,12 +108,14 @@ def main(): for row in db.execute(wiki_query): if keep(row.name): - slug = urllib.parse.quote(row.name, "") - #print(slug, row.version) - with open("wiki/{}.trac".format(slug), "w") as f: + with open("wiki/{}.trac".format(urllib.parse.quote(row.name, "")), "w") as f: f.write(row.text) - md = markdown_header(row, first_published) + wiki_to_markdown(row.text, slug) - with open("pelican/content/{}.md".format(slug), "w") as f: + md = markdown_header(row, first_published) + wiki_to_markdown(row.text, row.name) + fn = "pelican/content/{}.md".format(row.name) + dn = os.path.dirname(fn) + if not os.path.exists(dn): + os.makedirs(dn) + with open(fn, "w") as f: f.write(md) for row in db.execute(attachment_query): |