the static site generator, generate.ignore.py, is done

main
Shoofle 2 years ago
parent d8afa67553
commit d9cadd8f63
  1. 18
      finalized/articles/article.template.html
  2. 21
      finalized/articles/article.zip.template.html
  3. 0
      finalized/articles/auriga.html
  4. 0
      finalized/articles/circle_script.html
  5. 0
      finalized/articles/circle_script_generator.html
  6. 0
      finalized/articles/comic_layout_generator.html
  7. 0
      finalized/articles/distributed_speakers.html
  8. 0
      finalized/articles/dont_write_tests.html
  9. 0
      finalized/articles/dynamic_systems_in_games.html
  10. 0
      finalized/articles/easy_peasy_state_machinesy.html
  11. 0
      finalized/articles/game_diary.html
  12. 0
      finalized/articles/game_log.html
  13. 0
      finalized/articles/identities_and_spaces.html
  14. 15
      finalized/articles/language_for_games.template.html
  15. 16
      finalized/articles/language_for_games.zip.template.html
  16. 0
      finalized/articles/mindjail_engine.html
  17. 0
      finalized/articles/nintendo_summarized.html
  18. 0
      finalized/articles/oauth.html
  19. 0
      finalized/articles/object_oriented_programming.html
  20. 0
      finalized/articles/play_for_x.html
  21. 0
      finalized/articles/shoof_shoof_revolution.html
  22. 0
      finalized/articles/snorlax_evaluation.html
  23. 0
      finalized/articles/something_or_other.html
  24. 0
      finalized/articles/spinning.html
  25. 0
      finalized/articles/splatling.html
  26. 0
      finalized/articles/tamari.html
  27. 0
      finalized/articles/tattoo_elements.html
  28. 0
      finalized/articles/text_editors_with_contenteditable.html
  29. 0
      finalized/articles/time_integration.html
  30. 0
      finalized/articles/vim_indenting.html
  31. 0
      finalized/articles/web_420.0.html
  32. 0
      finalized/static/WHA.epub
  33. 0
      finalized/static/sleepy.html
  34. 9
      finalized/static/templates_old/auriga.template.html
  35. 9
      finalized/static/templates_old/distributed_speakers.template.html
  36. 9
      finalized/static/templates_old/game_log.template.html
  37. 15
      finalized/static/templates_old/language_for_games.template.html
  38. 9
      finalized/static/templates_old/mindjail_engine.template.html
  39. 9
      finalized/static/templates_old/oauth.template.html
  40. 9
      finalized/static/templates_old/play_for_x.template.html
  41. 9
      finalized/static/templates_old/shoof_shoof_revolution.template.html
  42. 9
      finalized/static/templates_old/spinning.template.html
  43. 9
      finalized/static/templates_old/tamari.template.html
  44. 9
      finalized/static/templates_old/text_editors_with_contenteditable.template.html
  45. 48
      generate.py

@ -1,18 +0,0 @@
<!doctype html>
<html>
<head>
{% block head %}
<meta charset="utf-8">
<title>{% block title %}Writings by Shoofle{% endblock %}</title>
<script src="/static/jquery.min.js" type="text/javascript"></script>
<link href="/static/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="/static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet" type="text/css">
<link href="/static/shoofle.css" rel="stylesheet" type="text/css">
{% endblock %}
</head>
<body>
{% block body -%}
{%- include target -%}
{%- endblock %}
</body>
</html>

@ -1,21 +0,0 @@
<!doctype html>
<html>
<head>
{% block head %}
<meta charset="utf-8">
<title>{% block title %}Writings by Shoofle{% endblock %}</title>
<script src="/static/jquery-2.0.3.js" type="text/javascript"></script>
<link href="/static/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="/static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet" type="text/css">
<link href="/static/shoofle.css" rel="stylesheet" type="text/css">
<style type="text/css">
body { transform: scale(0.5); transform-origin: 0% 0% }
</style>
{% endblock %}
</head>
<body>
{% block body -%}
{%- include target -%}
{%- endblock %}
</body>
</html>

@ -1,15 +0,0 @@
{% extends "articles/article.template.html" %}
{% block title -%}
Features for a game-focused programming language or library
{%- endblock %}
{% block body -%}
<p>I like making games but sometimes I spend a lot of time doing stuff that is just annoying. What if a language or environment were designed to make those things easy?</p>
<hr>
{%- include "articles/snorlax_evaluation.article.html" -%}
<hr>
{%- include "articles/time_integration.article.html" -%}
<hr>
{%- include "articles/easy_peasy_state_machinesy.article.html" -%}
{%- endblock %}

@ -1,16 +0,0 @@
{% extends "articles/article.template.html" %}
{% block title -%}
Features for a game-focused programming language or library
{%- endblock %}
{% block body -%}
<style type="text/css"> body { transform: scale(0.5); transform-origin: 0% 0%; } </style>
<p>I like making games but sometimes I spend a lot of time doing stuff that is just annoying. What if a language or environment were designed to make those things easy?</p>
<hr>
{%- include "articles/snorlax_evaluation.article.html" -%}
<hr>
{%- include "articles/time_integration.article.html" -%}
<hr>
{%- include "articles/easy_peasy_state_machinesy.article.html" -%}
{%- endblock %}

@ -1,9 +0,0 @@
{% extends "articles/article.template.html" %}
{% block title -%}
How should this website be laid out?
{%- endblock %}
{% block body -%}
{%- include "articles/auriga.article.html" -%}
{%- endblock %}

@ -1,9 +0,0 @@
{% extends "articles/article.template.html" %}
{% block title -%}
Impromptu Soundsystems would be a good name for a band.
{%- endblock %}
{% block body -%}
{%- include "articles/distributed_speakers.article.html" -%}
{%- endblock %}

@ -1,9 +0,0 @@
{% extends "articles/article.template.html" %}
{% block title -%}
I occasionally play some videogames.
{%- endblock %}
{% block body -%}
{%- include "articles/game_log.article.html" -%}
{%- endblock %}

@ -1,15 +0,0 @@
{% extends "articles/article.template.html" %}
{% block title -%}
Features for a game-focused programming language or library
{%- endblock %}
{% block body -%}
<p>I like making games but sometimes I spend a lot of time doing stuff that is just annoying. What if a language or environment were designed to make those things easy?</p>
<hr>
{%- include "articles/snorlax_evaluation.article.html" -%}
<hr>
{%- include "articles/time_integration.article.html" -%}
<hr>
{%- include "articles/easy_peasy_state_machinesy.article.html" -%}
{%- endblock %}

@ -1,9 +0,0 @@
{% extends "articles/article.template.html" %}
{% block title -%}
The Mindjail Engine!
{%- endblock %}
{% block body -%}
{%- include "articles/mindjail_engine.article.html" -%}
{%- endblock %}

@ -1,9 +0,0 @@
{% extends "articles/article.template.html" %}
{% block title -%}
I have used OAuth, and lived to tell the tale.
{%- endblock %}
{% block body -%}
{%- include "articles/oauth.article.html" -%}
{%- endblock %}

@ -1,9 +0,0 @@
{% extends "articles/article.template.html" %}
{% block title -%}
Play For X
{%- endblock %}
{% block body -%}
{%- include "articles/play_for_x.article.html" -%}
{%- endblock %}

@ -1,9 +0,0 @@
{% extends "articles/article.template.html" %}
{% block title -%}
Javascript DDR Clone
{%- endblock %}
{% block body -%}
{%- include "articles/shoof_shoof_revolution.article.html" -%}
{%- endblock %}

@ -1,9 +0,0 @@
{% extends "articles/article.template.html" %}
{% block title -%}
I spin things around!
{%- endblock %}
{% block body -%}
{%- include "articles/spinning.article.html" -%}
{%- endblock %}

@ -1,9 +0,0 @@
{% extends "articles/article.template.html" %}
{% block title -%}
Tamari Lattices: very pretty.
{%- endblock %}
{% block body -%}
{%- include "articles/tamari.article.html" -%}
{%- endblock %}

@ -1,9 +0,0 @@
{% extends "articles/article.template.html" %}
{% block title -%}
contentEditable: Text Editors Made Easy?
{%- endblock %}
{% block body -%}
{%- include "articles/text_editors_with_contenteditable.article.html" -%}
{%- endblock %}

@ -5,14 +5,12 @@ import shutil
import argparse import argparse
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("destination", help="where to put the rendered site") parser.add_argument("-i", "--input", type=Path, help="source materials")
parser.add_argument("-o", "--output", type=Path, help="where to put the rendered site")
args = parser.parse_args() args = parser.parse_args()
root_folder = Path(__file__).parent source = args.input
source = root_folder / "source" finals = args.output
finals = root_folder / "finalized"
if args.destination:
finals = args.destination()
env = Environment( env = Environment(
loader=FileSystemLoader(source), loader=FileSystemLoader(source),
@ -20,14 +18,36 @@ env = Environment(
# clear out the folder finalized # clear out the folder finalized
shutil.copytree(source, finals)
# walk the source directory and make all the corresponding files into finalized # walk the source directory and make all the corresponding files into finalized
for path_to_file in (source / "articles").glob("*"):
rel_path = path_to_file.relative_to(source)
if ".article.html" in str(path_to_file): article_template = env.get_template("articles/article.template.html")
with open(finals / rel_path, "w") as output:
article_template = env.get_template("articles/article.template.html") for path_to_source in source.glob("**/*"):
output.write(article_template.render(title="Article", target=str(path_to_file.relative_to(source)))) rel_path = path_to_source.relative_to(source)
path_to_output = finals / rel_path
if ".ignore" in str(rel_path):
continue
if path_to_source.is_dir():
pass
elif ".article.html" in str(path_to_source):
path_to_output = path_to_output.parent / path_to_output.name.replace(".article","")
with open(path_to_output, "w") as output_file:
os.makedirs(path_to_output.parent, exist_ok=True)
output_file.write(article_template.render(title="Article", target=str(rel_path)))
elif ".renderme" in str(path_to_source):
path_to_output = path_to_output.parent / path_to_output.name.replace(".renderme","")
with open(path_to_output, "w") as output_file:
os.makedirs(path_to_output.parent, exist_ok=True)
output_file.write(env.get_template(rel_path).render())
elif ".template.html" in str(path_to_source):
pass
else:
os.makedirs(path_to_output.parent, exist_ok=True)
shutil.copy(path_to_source, path_to_output)

Loading…
Cancel
Save