From 4c6310343d2e8961df69f770a822c077c152d2a5 Mon Sep 17 00:00:00 2001 From: scuti Date: Sat, 12 Oct 2024 09:06:07 -0700 Subject: [PATCH] added and revised templates --- README.md | 5 +++-- scripts/allmaps.py | 4 ++-- templates/map.html | 24 ++++++++++++++++++++++++ templates/overview.html | 22 ++++++++++++++++++++++ 4 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 templates/map.html create mode 100644 templates/overview.html diff --git a/README.md b/README.md index e906b8f..3f51425 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,9 @@ The program queries the database `db/cts.db` (`./src/dbquery.c`, function `stati - Requests a player's ranks for all maps leaderboards s/he is present on. ## Usage: Static Page Generation + + python scripts/allmaps.py + The CGI program is still invoked in static generation. The files `allmaps.py`, `output/leaderboard.css`, `template.html`, `template_map.html` help produce the output. Before executing `allmaps.py`, copy and modify the templates. @@ -37,8 +40,6 @@ Before executing `allmaps.py`, copy and modify the templates. `allmaps.py` outputs an html file for all distinct maps in the database. The leaderboards for each map (equivalent to `?map=[map name]`) are in `output/maps/`. - python allmaps.py - ## Game Versions Used Under: * Xonotic 0.8.1 * Xonotic 0.8.2 diff --git a/scripts/allmaps.py b/scripts/allmaps.py index 025c5fb..f727d84 100644 --- a/scripts/allmaps.py +++ b/scripts/allmaps.py @@ -32,11 +32,11 @@ def renderindex(template): def main(): template = "" - with open("template.html", 'r') as fin: + with open("templates/overview.html", 'r') as fin: template = fin.read() renderindex(template) maps = getmaps("db/cts.db") - with open("template_map.html", 'r') as fin: + with open("templates/map.html", 'r') as fin: template = fin.read() # for each map generate an html file. for game_map in maps: diff --git a/templates/map.html b/templates/map.html new file mode 100644 index 0000000..cee67a2 --- /dev/null +++ b/templates/map.html @@ -0,0 +1,24 @@ + + + + + + + %s - Leaderboards - Minimal Working Example + + + + + + + +

%s

+ + +%s + + + + diff --git a/templates/overview.html b/templates/overview.html new file mode 100644 index 0000000..b1e86ec --- /dev/null +++ b/templates/overview.html @@ -0,0 +1,22 @@ + + + + + + CTS Leaderboards - Minimal Working Example + + + + + + + + + +%s + + + +