mirror of https://github.com/dirtbags/moth.git
Allow for generated puzzles
This commit is contained in:
parent
5936814305
commit
ab842bab4d
10
mkpuzzles.py
10
mkpuzzles.py
|
@ -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':
|
||||||
|
|
2
puzzles
2
puzzles
|
@ -1 +1 @@
|
||||||
Subproject commit 1a217387a47583773b529cf1dea42fbf6f24cbc9
|
Subproject commit 2c4f955d275b03891cd84f17a80dd397780272c6
|
Loading…
Reference in New Issue