From ab842bab4de8337a9258e7f4864c8bdcc5a76d6d Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Tue, 31 Aug 2010 14:15:21 -0600 Subject: [PATCH] Allow for generated puzzles --- mkpuzzles.py | 10 ++++++++++ puzzles | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mkpuzzles.py b/mkpuzzles.py index 569097f..c1ce50e 100755 --- a/mkpuzzles.py +++ b/mkpuzzles.py @@ -5,6 +5,7 @@ import shutil import optparse import string import markdown +import rfc822 from codecs import open p = optparse.OptionParser() @@ -80,6 +81,15 @@ for cat in os.listdir(opts.puzzles): keys.append((cat, points, key)) elif fn == 'hint': 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': readme = open(path, encoding='utf-8').read() elif fn == 'index.mdwn': diff --git a/puzzles b/puzzles index 1a21738..2c4f955 160000 --- a/puzzles +++ b/puzzles @@ -1 +1 @@ -Subproject commit 1a217387a47583773b529cf1dea42fbf6f24cbc9 +Subproject commit 2c4f955d275b03891cd84f17a80dd397780272c6