mirror of https://github.com/dirtbags/moth.git
Merge branch 'parse_spaces' of https://github.com/3ch01c/moth
This commit is contained in:
commit
6d509fe516
|
@ -12,6 +12,7 @@ import os
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import shlex
|
||||||
|
|
||||||
messageChars = b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
messageChars = b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
|
|
||||||
|
@ -112,7 +113,7 @@ class Puzzle:
|
||||||
elif key == 'name':
|
elif key == 'name':
|
||||||
pass
|
pass
|
||||||
elif key == 'file':
|
elif key == 'file':
|
||||||
parts = val.split()
|
parts = shlex.split(val)
|
||||||
name = parts[0]
|
name = parts[0]
|
||||||
hidden = False
|
hidden = False
|
||||||
stream = open(name, 'rb')
|
stream = open(name, 'rb')
|
||||||
|
@ -264,10 +265,10 @@ class Puzzle:
|
||||||
def html_body(self):
|
def html_body(self):
|
||||||
"""Format and return the markdown for the puzzle body."""
|
"""Format and return the markdown for the puzzle body."""
|
||||||
return mistune.markdown(self.get_body(), escape=False)
|
return mistune.markdown(self.get_body(), escape=False)
|
||||||
|
|
||||||
def package(self, answers=False):
|
def package(self, answers=False):
|
||||||
"""Return a dict packaging of the puzzle."""
|
"""Return a dict packaging of the puzzle."""
|
||||||
|
|
||||||
files = [fn for fn,f in self.files.items() if f.visible]
|
files = [fn for fn,f in self.files.items() if f.visible]
|
||||||
return {
|
return {
|
||||||
'authors': self.authors,
|
'authors': self.authors,
|
||||||
|
|
|
@ -59,6 +59,9 @@ def build_category(categorydir, outdir):
|
||||||
mothball = package(categoryname, categorydir, category_seed)
|
mothball = package(categoryname, categorydir, category_seed)
|
||||||
shutil.copyfileobj(mothball, zipfileraw)
|
shutil.copyfileobj(mothball, zipfileraw)
|
||||||
zipfileraw.close()
|
zipfileraw.close()
|
||||||
|
zipfiledir = os.path.dirname(zipfilename)
|
||||||
|
if not os.path.exists(zipfiledir):
|
||||||
|
os.makedirs(zipfiledir)
|
||||||
shutil.move(zipfileraw.name, zipfilename)
|
shutil.move(zipfileraw.name, zipfilename)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ Being in this list is voluntary. Add your name when you contribute code.
|
||||||
* Paul Ferrell
|
* Paul Ferrell
|
||||||
* Shannon Steinfadt
|
* Shannon Steinfadt
|
||||||
* John Donaldson
|
* John Donaldson
|
||||||
|
* 3ch01c
|
||||||
|
|
||||||
Word List
|
Word List
|
||||||
---------
|
---------
|
||||||
|
|
Loading…
Reference in New Issue