diff options
author | t3sserakt <t3ss@posteo.de> | 2021-05-23 20:19:58 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-05-23 20:20:56 +0200 |
commit | 8b45ef2990e77544b06a45038987c5cdba0069bf (patch) | |
tree | bea140884cd53bc614489ffbb2f7516920634253 /make_site.py | |
parent | 8f9c24f116f689a874c813388b0e15678d15c47a (diff) | |
parent | edf64f7471463dc2bb62355f24350ced2dd442f2 (diff) | |
download | www-8b45ef2990e77544b06a45038987c5cdba0069bf.tar.gz www-8b45ef2990e77544b06a45038987c5cdba0069bf.zip |
Merge branch 'stable' of ssh://gnunet.org/www into stable
Diffstat (limited to 'make_site.py')
-rwxr-xr-x | make_site.py | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/make_site.py b/make_site.py deleted file mode 100755 index b27c7cc3..00000000 --- a/make_site.py +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | #!/usr/bin/env python3 | ||
2 | # coding: utf-8 | ||
3 | # | ||
4 | # Copyright (C) 2017, 2018, 2019 GNUnet e.V. | ||
5 | # | ||
6 | # Copying and distribution of this file, with or without modification, | ||
7 | # are permitted in any medium without royalty provided the copyright | ||
8 | # notice and this notice are preserved. This file is offered as-is, | ||
9 | # without any warranty. | ||
10 | # | ||
11 | # ---- | ||
12 | # | ||
13 | # This script runs the jinja2 templating engine on an input template-file | ||
14 | # using the specified locale for gettext translations, and outputs | ||
15 | # the resulting (HTML) output-file. | ||
16 | # | ||
17 | # Note that the gettext files need to be prepared first. This script | ||
18 | # is thus to be invoked via the Makefile. | ||
19 | |||
20 | import jinja2 | ||
21 | import sys | ||
22 | from pathlib import Path, PurePath | ||
23 | from inc.site import gen_site | ||
24 | from inc.fileproc import copy_files | ||
25 | |||
26 | env = jinja2.Environment(loader=jinja2.FileSystemLoader(str(PurePath(__file__).parent)), | ||
27 | extensions=["jinja2.ext.i18n"], | ||
28 | lstrip_blocks=True, | ||
29 | trim_blocks=True, | ||
30 | undefined=jinja2.StrictUndefined, | ||
31 | autoescape=False) | ||
32 | |||
33 | if len(sys.argv) >= 2 and sys.argv[1] == "-vv": | ||
34 | DEBUG=1 | ||
35 | elif len(sys.argv) >= 2 and sys.argv[1] == "-vvv": | ||
36 | DEBUG=2 | ||
37 | elif len(sys.argv) >= 2 and sys.argv[1] == "-vvvv": | ||
38 | DEBUG=3 | ||
39 | else: | ||
40 | DEBUG=0 | ||
41 | |||
42 | def main(): | ||
43 | # rm_rf("rendered") | ||
44 | x = gen_site(DEBUG) | ||
45 | conf = x.load_config("www.yml") | ||
46 | x.gen_abstract(conf, "newsposts", "abstract", "page", 500) | ||
47 | # for lang in conf["langs_full"]: | ||
48 | # x.gen_newspost_content(conf, "newsposts", "content", "page", lang) | ||
49 | x.gen_newspost_content(conf, "newsposts", "content", "page", "en") | ||
50 | x.gen_rss("inc", conf, env) | ||
51 | if DEBUG: | ||
52 | print("generating html from jinja2 templates...") | ||
53 | x.run("template", conf, env) | ||
54 | if DEBUG >= 2: | ||
55 | print(Path.cwd()) | ||
56 | _ = Path("rendered") | ||
57 | for child in _.iterdir(): | ||
58 | print(child) | ||
59 | if DEBUG >= 2: | ||
60 | print(Path.cwd()) | ||
61 | if DEBUG: | ||
62 | print("generating html from jinja2 news templates...") | ||
63 | x.run("news", conf, env) | ||
64 | #for lang in conf["langs_full"]: | ||
65 | # copy_files("static", conf, lang, "staticfiles", "rendered") | ||
66 | if DEBUG: | ||
67 | print("copying directories...") | ||
68 | x.copy_trees("static") | ||
69 | x.copy_trees("dist") | ||
70 | # print("generating rss...") | ||
71 | # x.generate_rss() | ||
72 | # print("generating sitemap...") | ||
73 | # x.generate_sitemap() | ||
74 | |||
75 | if __name__ == "__main__": | ||
76 | main() | ||