summaryrefslogtreecommitdiff
path: root/template.py
diff options
context:
space:
mode:
Diffstat (limited to 'template.py')
-rwxr-xr-xtemplate.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/template.py b/template.py
index a055a33e..d7be569f 100755
--- a/template.py
+++ b/template.py
@@ -1,4 +1,6 @@
#!/usr/bin/env python3
+# coding: utf-8
+#
# This file is in the public domain.
#
# This script runs the jinja2 templating engine on an input template-file
@@ -34,7 +36,7 @@ langs_full = {"en": "English",
"ru": "Ру́сский язы́к",
"pt": "Português"}
-for in_file in glob.glob("*.j2"):
+for in_file in glob.glob("template/*.j2"):
name, ext = re.match(r"(.*)\.([^.]+)$", in_file.rstrip(".j2")).groups()
tmpl = env.get_template(in_file)
@@ -42,7 +44,7 @@ for in_file in glob.glob("*.j2"):
"""
Return URL for the current page in another locale.
"""
- return "../" + other_locale + "/" + in_file.rstrip(".j2")
+ return "../" + other_locale + "/" + in_file.replace('template/', '').rstrip(".j2")
def url_localized(filename):
return "../" + locale + "/" + filename
@@ -70,7 +72,6 @@ for in_file in glob.glob("*.j2"):
env.install_gettext_translations(tr, newstyle=True)
-
content = tmpl.render(
docshost="docs.taler.net",
lang=locale,
@@ -80,7 +81,7 @@ for in_file in glob.glob("*.j2"):
url_localized=url_localized,
svg_localized=svg_localized,
filename=name + "." + ext)
- out_name = "./" + locale + "/" + in_file.rstrip(".j2")
- os.makedirs("./" + locale, exist_ok=True)
- with codecs.open(out_name, "w", "utf-8") as f:
+ out_name = "./rendered/" + locale + "/" + in_file.replace('template/', '').rstrip(".j2")
+ os.makedirs("./rendered/" + locale, exist_ok=True)
+ with codecs.open(out_name, "w", encoding='utf-8') as f:
f.write(content)