Allow for generated puzzles

This commit is contained in:
Neale Pickett 2010-08-31 14:15:21 -06:00
parent 5936814305
commit ab842bab4d
2 changed files with 11 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import shutil
import optparse import optparse
import string import string
import markdown import markdown
import rfc822
from codecs import open from codecs import open
p = optparse.OptionParser() p = optparse.OptionParser()
@ -80,6 +81,15 @@ for cat in os.listdir(opts.puzzles):
keys.append((cat, points, key)) keys.append((cat, points, key))
elif fn == 'hint': elif fn == 'hint':
pass pass
elif fn == 'index.exe':
p = os.popen(path)
m = rfc822.Message(p)
for key in m.getallmatchingheaders('Key'):
print key
keys.append((cat, points, key))
readme = m.fp.read()
if m.get('Content-Type', 'text/markdown') == 'text/markdown':
readme = markdown.markdown(readme)
elif fn == 'index.html': elif fn == 'index.html':
readme = open(path, encoding='utf-8').read() readme = open(path, encoding='utf-8').read()
elif fn == 'index.mdwn': elif fn == 'index.mdwn':

@ -1 +1 @@
Subproject commit 1a217387a47583773b529cf1dea42fbf6f24cbc9 Subproject commit 2c4f955d275b03891cd84f17a80dd397780272c6