diff options
author | ng0 <ng0@n0.is> | 2018-01-01 19:17:28 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2018-01-01 19:17:28 +0000 |
commit | 7ecb1d7847db925a1fe2752c027876d46abc0967 (patch) | |
tree | b91aee84e2ed0613c9e144432061a90702a2c312 | |
parent | 2988944b842314c67d9cc1cc536e3a435a29d916 (diff) |
template
-rwxr-xr-x | template.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/template.py b/template.py index 005239d0..08c9ea0d 100755 --- a/template.py +++ b/template.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # This file is in the public domain. # -# This script runs the jinja2 templating engine on an input template-file +# This script runs the jinga2 templating engine on an input template-file # using the specified locale for gettext translations, and outputs # the resulting (HTML) ouptut-file. # @@ -25,12 +25,7 @@ env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(__file__ undefined=jinja2.StrictUndefined, autoescape=False) -langs_full = {"en": "English", - "fr": "Français", - "it": "Italiano", - "es": "Español", - "de": "Deutsch", - "ru": "Ру́сский язы́к"} +langs_full = {"en": "English", "fr": "Français", "it": "Italiano", "es": "Español", "de": "Deutsch"} for in_file in glob.glob("*.j2"): name, ext = re.match(r"(.*)\.([^.]+)$", in_file.rstrip(".j2")).groups() @@ -47,7 +42,7 @@ for in_file in glob.glob("*.j2"): def svg_localized(filename): lf = filename + "." + locale + ".svg" - if "en" == locale or not os.path.isfile (lf): + if "en" == locale or not os.path.isfile(lf): return "../" + filename + ".svg" else: return "../" + lf @@ -68,7 +63,6 @@ for in_file in glob.glob("*.j2"): env.install_gettext_translations(tr, newstyle=True) - content = tmpl.render( lang=locale, lang_full=langs_full[locale], |