diff --git a/allmaps.py b/allmaps.py index 4a6db62..01d9e09 100644 --- a/allmaps.py +++ b/allmaps.py @@ -24,14 +24,9 @@ def getcontent(query=None): def renderindex(template): # no env variable table = getcontent() - title = "XDF Leaderboards - Xonotie" filename = "./output/index.html" - header = '''

Xonotic DeFrag Server Leaderboards

-

Server Name: /v/ Xonotie 0.8.2 - Pacific / US West
- Stats: http://stats.xonotic.org/server/6459

- ''' with open(filename, 'w+') as fout: - fout.write(template % (title, header + table)) + fout.write(template % (table)) fout.close pass @@ -41,19 +36,18 @@ def main(): with open("template.html", 'r') as fin: template = fin.read() renderindex(template) - title_text = "%s - XDF Leaderboards - Xonotie" maps = getmaps("db/cts.db") + with open("template_map.html", 'r') as fin: + template = fin.read() for game_map in maps: # game_map is a tuple obj. map_name = game_map[0] query = {"QUERY_STRING" : ("map=%s" % map_name)} table = getcontent(query) - header = "

%s

" % map_name - filename = ("./output/%s.html" % map_name) + filename = ("./output/maps/%s.html" % map_name) with open(filename, 'w+') as fout: - title = title_text % map_name - fout.write(template % (title, header + table)) - fout.close() + title = map_name + fout.write(template % (title, map_name, table)) pass if __name__ == "__main__": diff --git a/output/leaderboard.css b/output/leaderboard.css new file mode 100644 index 0000000..2200d3d --- /dev/null +++ b/output/leaderboard.css @@ -0,0 +1,17 @@ +.footer { + margin:auto; +} +table, th, td { + border: 1px solid grey; + border-collapse: collapse; +} +table { + width:100%; +} +th, td { + width:auto; + text-align:center; + word-wrap: break-word; + margin: 1em 1em 1em 1em; +} + diff --git a/template.html b/template.html new file mode 100644 index 0000000..e2b7ba8 --- /dev/null +++ b/template.html @@ -0,0 +1,18 @@ + + + + + + CTS Leaderboards - Add your title here + + + +
+%s + + + +
+ diff --git a/template_map.html b/template_map.html new file mode 100644 index 0000000..bb88e95 --- /dev/null +++ b/template_map.html @@ -0,0 +1,20 @@ + + + + + + %s - CTS Leaderboards - Add your title here + + + +
+

%s

+ +%s + + + +
+