From d0c10e7a18909984011a279b8d6ca95a20d57b6a Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Thu, 3 Jun 2021 01:03:44 +0000 Subject: Undo URL quoting of directory names in Markdown output --- extract.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'extract.py') diff --git a/extract.py b/extract.py index 1168290..ff1862a 100755 --- a/extract.py +++ b/extract.py @@ -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): -- cgit v1.2.3