added and revised templates

This commit is contained in:
scuti 2024-10-12 09:06:07 -07:00
parent 7bf2881145
commit 4c6310343d
4 changed files with 51 additions and 4 deletions

View File

@ -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. - Requests a player's ranks for all maps leaderboards s/he is present on.
## Usage: Static Page Generation ## 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. 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. 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/`. `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: ## Game Versions Used Under:
* Xonotic 0.8.1 * Xonotic 0.8.1
* Xonotic 0.8.2 * Xonotic 0.8.2

View File

@ -32,11 +32,11 @@ def renderindex(template):
def main(): def main():
template = "" template = ""
with open("template.html", 'r') as fin: with open("templates/overview.html", 'r') as fin:
template = fin.read() template = fin.read()
renderindex(template) renderindex(template)
maps = getmaps("db/cts.db") maps = getmaps("db/cts.db")
with open("template_map.html", 'r') as fin: with open("templates/map.html", 'r') as fin:
template = fin.read() template = fin.read()
# for each map generate an html file. # for each map generate an html file.
for game_map in maps: for game_map in maps:

24
templates/map.html Normal file
View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- %s = map name -->
<title>%s - Leaderboards - Minimal Working Example</title>
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<!-- <link href="../style.css" rel="stylesheet" type="text/css" media="all"> -->
<link href="../leaderboard.css" rel="stylesheet" type="text/css" media="all">
</head>
<body>
<!-- map name -->
<h1>%s</h1>
<!-- code generated table goes here -->
%s
<footer>
<p>Page generated using <a href="https://notabug.org/scuti/xdfcgi">xdfcgi</a> by <a href="https://scuti.neocities.org/">scuti</a></p>
</footer>
</body>
</html>

22
templates/overview.html Normal file
View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CTS Leaderboards - Minimal Working Example</title>
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<!-- <link href="./style.css" rel="stylesheet" type="text/css" media="all"> -->
<link href="./leaderboard.css" rel="stylesheet" type="text/css" media="all">
</head>
<body>
<!-- code generated table goes here -->
%s
<footer>
<p>Page generated using <a href="https://notabug.org/scuti/xdfcgi">xdfcgi</a> by <a href="https://scuti.neocities.org/">scuti</a></p>
</footer>
</body>
</html>