From e18e5b3d2559f5f0395ffe79416cdca3abc89310 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 14 Feb 2021 16:01:15 +0000 Subject: Start restructuring for Pelican --- tools/extract.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/extract.py b/tools/extract.py index dc401fd..8035b20 100755 --- a/tools/extract.py +++ b/tools/extract.py @@ -4,6 +4,7 @@ import fnmatch import hashlib import json import os +import shutil import sqlite3 import time import urllib.parse @@ -64,6 +65,10 @@ class Row(sqlite3.Row): def __getattr__(self, name): return self[name] +for dn in ("wiki", "pelican/content"): + if not os.path.exists(dn): + os.makedirs(dn) + db = sqlite3.connect("trac.db") db.row_factory = Row @@ -71,10 +76,10 @@ for row in db.execute(wiki_query): if keep(row.name): slug = urllib.parse.quote(row.name, "") print(slug, row.version) - with open("tracwiki/{}.trac".format(slug), "w") as f: + with open("wiki/{}.trac".format(slug), "w") as f: f.write(row.text) md = trac2md.WikiToMD(row.text) - with open("markdown/{}.md".format(slug), "w") as f: + with open("pelican/content/{}.md".format(slug), "w") as f: f.write(md) for row in db.execute(attachment_query): -- cgit v1.2.3