summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2021-02-14 16:01:15 +0000
committerRob Austein <sra@hactrn.net>2021-02-14 16:01:15 +0000
commite18e5b3d2559f5f0395ffe79416cdca3abc89310 (patch)
tree340bdc43c4bfa7bcc3c048eea4db848cabe470de /tools
parentad1cc0517983e599897929b4c94463bf2af78f7c (diff)
Start restructuring for Pelican
Diffstat (limited to 'tools')
-rwxr-xr-xtools/extract.py9
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):