diff options
Diffstat (limited to 'make_site.py')
-rwxr-xr-x | make_site.py | 45 |
1 files changed, 5 insertions, 40 deletions
diff --git a/make_site.py b/make_site.py index 33978447..624be179 100755 --- a/make_site.py +++ b/make_site.py @@ -18,49 +18,14 @@ from pathlib import Path, PurePath sys.path.insert(0, ".") sys.path.insert(0, "inc/") -from inc.site import gen_site -from inc.fileproc import copy_files +from inc.site import SiteGenerator -env = jinja2.Environment(loader=jinja2.FileSystemLoader(str(PurePath(__file__).parent)), - extensions=["jinja2.ext.i18n"], - lstrip_blocks=True, - trim_blocks=True, - undefined=jinja2.StrictUndefined, - autoescape=False) -env.newstyle_gettext = True - -if len(sys.argv) >= 2 and sys.argv[1] == "-vv": - DEBUG=1 -elif len(sys.argv) >= 2 and sys.argv[1] == "-vvv": - DEBUG=2 -elif len(sys.argv) >= 2 and sys.argv[1] == "-vvvv": - DEBUG=3 -else: - DEBUG=0 def main(): - x = gen_site(DEBUG) - conf = x.load_config("www.yml") - x.gen_abstract(conf, "newsposts", "abstract", "page", 1000) - x.gen_newspost_content(conf, "newsposts", "content", "page", "en") - x.gen_rss("inc", conf, env) - if DEBUG: - print("generating html from jinja2 templates...") - x.run("template", conf, env) - if DEBUG >= 2: - print(Path.cwd()) - _ = Path("rendered") - for child in _.iterdir(): - print(child) - if DEBUG >= 2: - print(Path.cwd()) - if DEBUG: - print("generating html from jinja2 news templates...") - x.run("news", conf, env) - if DEBUG: - print("copying directories...") - x.copy_trees("static") - x.copy_trees("dist") + x = SiteGenerator() + x.gen_abstract("newsposts", "abstract", "page", 1000) + x.gen_newspost_content("newsposts", "content", "page", "en") + x.run() if __name__ == "__main__": main() |