diff options
Diffstat (limited to 'tools/extract.py')
-rwxr-xr-x | tools/extract.py | 9 |
1 files changed, 7 insertions, 2 deletions
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): |