From 7e6cc51c489c6a115c93bee79f5db4d002a55d32 Mon Sep 17 00:00:00 2001 From: joshinils Date: Sat, 5 Sep 2020 20:50:55 +0200 Subject: [PATCH] write out guide.html anyway --- .gitignore | 1 + app.py | 19 ++++++++++++++++++- static/style.css | 5 +++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 00ca414..b6d68c0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ __pycache__ .venv/ .vscode +guide.html diff --git a/app.py b/app.py index 23df662..ba5a5c4 100644 --- a/app.py +++ b/app.py @@ -1,7 +1,7 @@ from flask import Flask from flask import render_template import xml.etree.ElementTree as ET - +import jinja2 from models.programme import Programme from models.channelName import ChannelName from models.tvGuide import TvGuide @@ -45,6 +45,23 @@ app = Flask(__name__) +templateLoader = jinja2.FileSystemLoader(searchpath="./templates/") +templateEnv = jinja2.Environment(loader=templateLoader) +TEMPLATE_FILE = "hello.html" +template = templateEnv.get_template(TEMPLATE_FILE) + + +def url_for(where, filename): + return "/" + where + "/" + filename + + +guideHtmlString = template.render(guide=guide, url_for=url_for) + +f = open("guide.html", "w") +f.write(guideHtmlString) +f.close() + + @app.route('/') def index(): return render_template('hello.html', guide=guide) diff --git a/static/style.css b/static/style.css index 3d4c83c..7c18b68 100644 --- a/static/style.css +++ b/static/style.css @@ -37,7 +37,7 @@ body { hyphens: auto; /**/ float: left; - margin: 5px 10px 0px 10px; + padding: 5px 10px 0px 10px; } .channelHead { @@ -58,7 +58,8 @@ body { } .programme.prominent { - margin-top: 10px; + padding-top: 5px; + padding-bottom: 5px; } .programme.nonprominent {