aboutsummaryrefslogtreecommitdiff
path: root/template.py
diff options
context:
space:
mode:
Diffstat (limited to 'template.py')
-rwxr-xr-xtemplate.py59
1 files changed, 12 insertions, 47 deletions
diff --git a/template.py b/template.py
index 87dbcb3c..5cae5bdc 100755
--- a/template.py
+++ b/template.py
@@ -191,12 +191,19 @@ def copy_static(locale, indict):
191 print(locale + "/" + key + " ...to... " + locale + "/" + value) 191 print(locale + "/" + key + " ...to... " + locale + "/" + value)
192 192
193 193
194# fileop(in, out, "copy") 194# TODO: Move the lists elsewhere?
195
196meetingnotes = [
197 { "year": "2013", "date": "2013-12-27" },
198 { "year": "2014", "date": "2014-12-28" },
199 { "year": "2015", "date": "2015-12-29" },
200 { "year": "2016", "date": "2016-12-28" },
201 { "year": "2017", "date": "2017-12-27" },
202 { "year": "2018", "date": "2018-12-27" },
203]
195 204
196# At this moment in time, constructing this list dynamically would be 205# At this moment in time, constructing this list dynamically would be
197# too much pointless code. In fact all of what we use in jinja is 206# too much pointless code.
198# no real use of jinja yet and furthermore we would be better off
199# just using static html + css + some awk and other base tools.
200newsposts = [ 207newsposts = [
201 { 208 {
202 "page": "2019-0.11.8.html", 209 "page": "2019-0.11.8.html",
@@ -718,6 +725,7 @@ def generate_site(root):
718 content = tmpl.render(lang=locale, 725 content = tmpl.render(lang=locale,
719 lang_full=langs_full[locale], 726 lang_full=langs_full[locale],
720 url=url, 727 url=url,
728 meetingnotesdata=meetingnotes,
721 newsdata=newsposts, 729 newsdata=newsposts,
722 videosdata=videoslist, 730 videosdata=videoslist,
723 self_localized=self_localized, 731 self_localized=self_localized,
@@ -764,46 +772,3 @@ def main():
764 772
765if __name__ == "__main__": 773if __name__ == "__main__":
766 main() 774 main()
767
768# for in_file in glob.glob("news/*.j2"):
769# name, ext = re.match(r"(.*)\.([^.]+)$", in_file.rstrip(".j2")).groups()
770# tmpl = env.get_template(in_file)
771
772# def self_localized(other_locale):
773# """
774# Return URL for the current page in another locale.
775# """
776# return "../" + other_locale + "/" + in_file.replace('news/',
777# '').rstrip(".j2")
778
779# def url_localized(filename):
780# return "../" + locale + "/" + filename
781
782# def svg_localized(filename):
783# lf = filename + "." + locale + ".svg"
784# if locale == "en" or not os.path.isfile(lf):
785# return "../" + filename + ".svg"
786# else:
787# return "../" + lf
788
789# def url(x):
790# # TODO: look at the app root environment variable
791# # TODO: check if file exists
792# return "../" + x
793
794# for f in glob.glob("locale/*/"):
795# locale = os.path.basename(f[:-1])
796# content = tmpl.render(lang=locale,
797# lang_full=langs_full[locale],
798# url=url,
799# self_localized=self_localized,
800# url_localized=url_localized,
801# svg_localized=svg_localized,
802# filename=name + "." + ext)
803# out_name = "./rendered/" + locale + "/news/" + in_file.replace('news/', '').rstrip(".j2")
804# outdir = Path("rendered")
805# langdir = outdir / locale / "news"
806# langdir.mkdir(parents=True, exist_ok=True)
807# # os.makedirs("./rendered/" + locale + "/news/", exist_ok=True)
808# with codecs.open(out_name, "w", encoding='utf-8') as f:
809# f.write(content)