diff options
-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): |