aboutsummaryrefslogtreecommitdiff
path: root/mensa/frontends/html.py
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-09-18 00:37:18 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-09-18 00:37:18 +0200
commit971f633eaadec381bda398f024bab42fa1311bd0 (patch)
tree134c0665343ea52d123af247be2300972575fb77 /mensa/frontends/html.py
parent3d4cb8555196a08347e373b6e542f80159155261 (diff)
downloadmensa-971f633eaadec381bda398f024bab42fa1311bd0.tar.gz
mensa-971f633eaadec381bda398f024bab42fa1311bd0.tar.bz2
mensa-971f633eaadec381bda398f024bab42fa1311bd0.zip
added templating, Version 0.4.1
You can now use templating by creating a file containing "$$TEXT$$" somewhere. $$TEXT$$ will be replaced with the menu.
Diffstat (limited to 'mensa/frontends/html.py')
-rw-r--r--mensa/frontends/html.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/mensa/frontends/html.py b/mensa/frontends/html.py
index f3bf065..58f373c 100644
--- a/mensa/frontends/html.py
+++ b/mensa/frontends/html.py
@@ -29,8 +29,15 @@ class HTMLRenderer(IPlugin) :
self.options = options
r = "\n".join([self.format_restaurant(restaurant, food) for restaurant, food in foods ])
-
- print(r)
+ if options.get("template") :
+ f = open(options["template"], "r")
+ template = f.read()
+ f.close()
+ print(template.replace("$$TEXT$$", r))
+ else :
+ print(r)
+
+
def register_renderer(self) :
base.register_renderer(base.Renderer("html", "HTML Renderer", self))