mirror of https://github.com/dirtbags/moth.git
Puzzle.randword, don't escape HTML, change mono font
This commit is contained in:
parent
1f1f41a696
commit
eaf7ac0974
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,6 +0,0 @@
|
|||
@font-face {
|
||||
font-family: 'Dosis';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Dosis Regular'), local('Dosis-Regular'), url(Dosis-Regular.ttf) format('truetype');
|
||||
}
|
Binary file not shown.
Binary file not shown.
|
@ -17,10 +17,10 @@
|
|||
src: local('Lato Italic'), local('Lato-Italic'), url(Lato-Italic.ttf) format('truetype');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Dosis';
|
||||
font-family: 'Inconsolata';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Dosis Regular'), local('Dosis-Regular'), url(Dosis-Regular.ttf) format('truetype');
|
||||
src: local('Inconsolata Regular'), local('Inconsolata-Regular'), url(Inconsolata-Regular.ttf) format('truetype');
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@ body {
|
|||
}
|
||||
|
||||
pre, tt {
|
||||
font-family: 'Dosis', monospace;
|
||||
font-family: Inconsolata, monospace;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ except ImportError:
|
|||
NOT_FOUND = (404, 'Not Found', 'Nothing matches the given URI')
|
||||
INTERNAL_SERVER_ERROR = (500, 'Internal Server Error', 'Server got itself in trouble')
|
||||
|
||||
sys.dont_write_bytecode = True
|
||||
|
||||
# XXX: This will eventually cause a problem. Do something more clever here.
|
||||
seed = 1
|
||||
|
||||
|
@ -48,7 +50,7 @@ def mdpage(body):
|
|||
title = "Result"
|
||||
title = title.lstrip("#")
|
||||
title = title.strip()
|
||||
return page(title, mistune.markdown(body))
|
||||
return page(title, mistune.markdown(body, escape=False))
|
||||
|
||||
|
||||
class ThreadingServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
|
||||
|
@ -162,6 +164,7 @@ you are a fool.
|
|||
body.write("</ul>")
|
||||
body.write("<h2>Author</h2><p>{}</p>".format(puzzle.author))
|
||||
body.write("<h2>Summary</h2><p>{}</p>".format(puzzle.summary))
|
||||
if puzzle.logs:
|
||||
body.write("<h2>Debug Log</h2>")
|
||||
body.write('<ul class="log">')
|
||||
for l in puzzle.logs:
|
||||
|
|
|
@ -146,6 +146,11 @@ class Puzzle:
|
|||
name = self.random_hash()
|
||||
self.files[name] = PuzzleFile(stream, name, visible)
|
||||
|
||||
def randword(self):
|
||||
"""Return a randomly-chosen word"""
|
||||
|
||||
return self.rand.choice(ANSWER_WORDS)
|
||||
|
||||
def make_answer(self, word_count, sep=' '):
|
||||
"""Generate and return a new answer. It's automatically added to the puzzle answer list.
|
||||
:param int word_count: The number of words to include in the answer.
|
||||
|
@ -153,7 +158,8 @@ class Puzzle:
|
|||
:returns: The answer string
|
||||
"""
|
||||
|
||||
answer = sep.join(self.rand.sample(ANSWER_WORDS, word_count))
|
||||
words = [self.randword() for i in range(word_count)]
|
||||
answer = sep.join(words)
|
||||
self.answers.append(answer)
|
||||
return answer
|
||||
|
||||
|
@ -162,7 +168,7 @@ class Puzzle:
|
|||
|
||||
def html_body(self):
|
||||
"""Format and return the markdown for the puzzle body."""
|
||||
return mistune.markdown(self.get_body())
|
||||
return mistune.markdown(self.get_body(), escape=False)
|
||||
|
||||
def hashes(self):
|
||||
"Return a list of answer hashes"
|
||||
|
|
Loading…
Reference in New Issue