#!/usr/bin/env python

import sys, json

file = sys.argv[1]
subject = file.split('.')[0]

data = {
    "subject": subject, 
    "cards": {}
}

fc = [line.split(':') for line in open(file, 'r').read().splitlines()]
js = open(subject + ".json", 'w')

for line in fc:
    data["cards"][line[0]] = line[1]

js.write(json.dumps(data))

js.close()




@@ -14,16 +14,132 @@
 v python
+%0A'''%0AFile: fc2json.py%0AAuthor: Kristoffer Dalby%0ADescription: Tiny script for converting flashcard format to json.%0A'''
 %0A%0Aimport

Use a real JS construct, WTF knows why this works in chromium.