From 34967594302dd0a7e1db83c79bd04f1165ee7270 Mon Sep 17 00:00:00 2001 From: scuti Date: Sat, 12 Oct 2024 09:17:04 -0700 Subject: [PATCH] changed interpolation to format string --- scripts/allmaps.py | 9 +++++++-- templates/map.html | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/allmaps.py b/scripts/allmaps.py index f727d84..9213484 100644 --- a/scripts/allmaps.py +++ b/scripts/allmaps.py @@ -1,13 +1,13 @@ import sqlite3 as sql import subprocess +# get all maps in database def getmaps(database): output = [] con = sql.connect(database) with con: cursor = con.cursor() try: - # get all maps in database cursor.execute("select distinct mapid from Cts_times;") output = cursor.fetchall() except sql.Error: @@ -47,7 +47,12 @@ def main(): filename = ("./output/maps/%s.html" % map_name) with open(filename, 'w+') as fout: title = map_name - fout.write(template % (title, map_name, table)) + fout.write(template.format( + title=title, + map_name=map_name, + table=table) + ) + # fout.write(template % (title, map_name, table)) pass if __name__ == "__main__": diff --git a/templates/map.html b/templates/map.html index cee67a2..ee4189c 100644 --- a/templates/map.html +++ b/templates/map.html @@ -4,7 +4,7 @@ - %s - Leaderboards - Minimal Working Example + {title} - Leaderboards - Minimal Working Example @@ -12,10 +12,10 @@ -

%s

+

{map_name}

-%s +{table}