diff --git a/LogBot/index.html.j2 b/LogBot/index.html.j2 deleted file mode 100644 index a243627..0000000 --- a/LogBot/index.html.j2 +++ /dev/null @@ -1,17 +0,0 @@ - - - - - {{ title }} - (Generator: LogBot) - - - -

{{ title }}

- {% for num, msg in db.items() %} -
-

[{{ num }}]

-

{{ msg }}

-
- {% endfor %} - - diff --git a/LogBot/logbot.py b/LogBot/logbot.py index 92ce607..d8dfaf1 100644 --- a/LogBot/logbot.py +++ b/LogBot/logbot.py @@ -102,10 +102,11 @@ class Logbot(Bot): def _write_log(self, message): """Write new log to the file system.""" + template = jinja2.Template(open("template.html").read()) room_name = self._parse_room_name(message.room) log_path = os.path.join(self.output, room_name, "index.html") with open(log_path, "w") as out: - html = self.template.render( + html = template.render( title=self.db[message.room]["title"], db=self.db[message.room]["messages"], ) diff --git a/LogBot/template.html b/LogBot/template.html new file mode 100644 index 0000000..0b74587 --- /dev/null +++ b/LogBot/template.html @@ -0,0 +1,20 @@ + + + + + {{ title }} - (Generator: LogBot) + + + +

{{ title }}

+ + {% for num, msg in db.items() %} + +
+

[{{ num }}]

+

{{ msg }}

+
+ + {% endfor %} + +