mirror of https://github.com/dirtbags/moth.git
bye bye sandia
This commit is contained in:
parent
78a0fa1f1b
commit
2a3970d5e3
|
@ -31,10 +31,10 @@ def write_kv_pairs(ziphandle, filename, kv):
|
||||||
filehandle.write("%s %s\n" % (key, kv[key]))
|
filehandle.write("%s %s\n" % (key, kv[key]))
|
||||||
filehandle.seek(0)
|
filehandle.seek(0)
|
||||||
ziphandle.writestr(filename, filehandle.read())
|
ziphandle.writestr(filename, filehandle.read())
|
||||||
|
|
||||||
def escape(s):
|
def escape(s):
|
||||||
return s.replace('&', '&').replace('<', '<').replace('>', '>')
|
return s.replace('&', '&').replace('<', '<').replace('>', '>')
|
||||||
|
|
||||||
def generate_html(ziphandle, puzzle, puzzledir, category, points, authors, files):
|
def generate_html(ziphandle, puzzle, puzzledir, category, points, authors, files):
|
||||||
html_content = io.StringIO()
|
html_content = io.StringIO()
|
||||||
file_content = io.StringIO()
|
file_content = io.StringIO()
|
||||||
|
@ -50,7 +50,7 @@ def generate_html(ziphandle, puzzle, puzzledir, category, points, authors, files
|
||||||
''' </ul>
|
''' </ul>
|
||||||
</section>
|
</section>
|
||||||
''')
|
''')
|
||||||
|
|
||||||
html_content.write(
|
html_content.write(
|
||||||
'''<!DOCTYPE html>
|
'''<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
@ -77,7 +77,7 @@ def generate_html(ziphandle, puzzle, puzzledir, category, points, authors, files
|
||||||
<section id="sponsors">
|
<section id="sponsors">
|
||||||
<img src="../../images/lanl.png" alt="Los Alamos National Laboratory">
|
<img src="../../images/lanl.png" alt="Los Alamos National Laboratory">
|
||||||
<img src="../../images/doe.png" alt="US Department Of Energy">
|
<img src="../../images/doe.png" alt="US Department Of Energy">
|
||||||
<img src="../../images/sandia.png" alt="Sandia National Laboratories">
|
<img src="../../images/inl.png" alt="Idaho National Laboratory">
|
||||||
</section>
|
</section>
|
||||||
</body>
|
</body>
|
||||||
</html>'''.format(category=category, points=points, body=puzzle.html_body(), file_content=file_content.getvalue(), authors=', '.join(authors)))
|
</html>'''.format(category=category, points=points, body=puzzle.html_body(), file_content=file_content.getvalue(), authors=', '.join(authors)))
|
||||||
|
@ -118,7 +118,7 @@ def build_category(categorydir, outdir):
|
||||||
hashmap = hashlib.sha1(category_seed)
|
hashmap = hashlib.sha1(category_seed)
|
||||||
hashmap.update(str(puzzle.points).encode('utf-8'))
|
hashmap.update(str(puzzle.points).encode('utf-8'))
|
||||||
puzzlehash = hashmap.hexdigest()
|
puzzlehash = hashmap.hexdigest()
|
||||||
|
|
||||||
mapping[puzzle.points] = puzzlehash
|
mapping[puzzle.points] = puzzlehash
|
||||||
answers[puzzle.points] = puzzle.answers
|
answers[puzzle.points] = puzzle.answers
|
||||||
summary[puzzle.points] = puzzle.summary
|
summary[puzzle.points] = puzzle.summary
|
||||||
|
@ -149,9 +149,9 @@ def build_category(categorydir, outdir):
|
||||||
zf.close()
|
zf.close()
|
||||||
|
|
||||||
shutil.move(zipfileraw.name, zipfilename)
|
shutil.move(zipfileraw.name, zipfilename)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(description='Build a category package')
|
parser = argparse.ArgumentParser(description='Build a category package')
|
||||||
parser.add_argument('categorydirs', nargs='+', help='Directory of category source')
|
parser.add_argument('categorydirs', nargs='+', help='Directory of category source')
|
||||||
parser.add_argument('outdir', help='Output directory')
|
parser.add_argument('outdir', help='Output directory')
|
||||||
|
|
|
@ -43,7 +43,7 @@ function koth.page(title, body)
|
||||||
print('<section id="sponsors">')
|
print('<section id="sponsors">')
|
||||||
print('<img src="../images/lanl.png" alt="Los Alamos National Laboratory">')
|
print('<img src="../images/lanl.png" alt="Los Alamos National Laboratory">')
|
||||||
print('<img src="../images/doe.png" alt="US Department Of Energy">')
|
print('<img src="../images/doe.png" alt="US Department Of Energy">')
|
||||||
print('<img src="../images/sandia.png" alt="Sandia National Laboratories">')
|
print('<img src="../images/inl.png" alt="Idaho National Laboratory">')
|
||||||
print('</section>')
|
print('</section>')
|
||||||
print("</body></html>")
|
print("</body></html>")
|
||||||
os.exit(0)
|
os.exit(0)
|
||||||
|
|
|
@ -90,7 +90,7 @@ window.addEventListener("load", init);
|
||||||
<section id="sponsors">
|
<section id="sponsors">
|
||||||
<img src="images/lanl.png" alt="Los Alamos National Laboratory">
|
<img src="images/lanl.png" alt="Los Alamos National Laboratory">
|
||||||
<img src="images/doe.png" alt="US Department Of Energy">
|
<img src="images/doe.png" alt="US Department Of Energy">
|
||||||
<img src="images/sandia.png" alt="Sandia National Laboratories">
|
<img src="images/inl.png" alt="Idaho National Laboratory">
|
||||||
</section>
|
</section>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 9.6 KiB |
|
@ -69,7 +69,7 @@
|
||||||
<section id="sponsors">
|
<section id="sponsors">
|
||||||
<img src="images/lanl.png" alt="Los Alamos National Laboratory">
|
<img src="images/lanl.png" alt="Los Alamos National Laboratory">
|
||||||
<img src="images/doe.png" alt="US Department Of Energy">
|
<img src="images/doe.png" alt="US Department Of Energy">
|
||||||
<img src="images/sandia.png" alt="Sandia National Laboratories">
|
<img src="images/inl.png" alt="Idaho National Laboratory">
|
||||||
</section>
|
</section>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
<section id="sponsors">
|
<section id="sponsors">
|
||||||
<img src="images/lanl.png" alt="Los Alamos National Laboratory">
|
<img src="images/lanl.png" alt="Los Alamos National Laboratory">
|
||||||
<img src="images/doe.png" alt="US Department Of Energy">
|
<img src="images/doe.png" alt="US Department Of Energy">
|
||||||
<img src="images/sandia.png" alt="Sandia National Laboratories">
|
<img src="images/inl.png" alt="Idaho National Laboratory">
|
||||||
</section>
|
</section>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -116,7 +116,7 @@
|
||||||
<section id="sponsors">
|
<section id="sponsors">
|
||||||
<img src="images/lanl.png" alt="Los Alamos National Laboratory">
|
<img src="images/lanl.png" alt="Los Alamos National Laboratory">
|
||||||
<img src="images/doe.png" alt="US Department Of Energy">
|
<img src="images/doe.png" alt="US Department Of Energy">
|
||||||
<img src="images/sandia.png" alt="Sandia National Laboratories">
|
<img src="images/inl.png" alt="Idaho National Laboratory">
|
||||||
</section>
|
</section>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue