Added html template files
This commit is contained in:
parent
7bfa64ca81
commit
f09c05fd1a
18
allmaps.py
18
allmaps.py
@ -24,14 +24,9 @@ def getcontent(query=None):
|
|||||||
def renderindex(template):
|
def renderindex(template):
|
||||||
# no env variable
|
# no env variable
|
||||||
table = getcontent()
|
table = getcontent()
|
||||||
title = "XDF Leaderboards - Xonotie"
|
|
||||||
filename = "./output/index.html"
|
filename = "./output/index.html"
|
||||||
header = '''<h3>Xonotic DeFrag Server Leaderboards</h3>
|
|
||||||
<p><b>Server Name: </b>/v/ Xonotie 0.8.2 - Pacific / US West<br>
|
|
||||||
<b>Stats: </b><a href="http://stats.xonotic.org/server/6459">http://stats.xonotic.org/server/6459</a></p>
|
|
||||||
'''
|
|
||||||
with open(filename, 'w+') as fout:
|
with open(filename, 'w+') as fout:
|
||||||
fout.write(template % (title, header + table))
|
fout.write(template % (table))
|
||||||
fout.close
|
fout.close
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -41,19 +36,18 @@ def main():
|
|||||||
with open("template.html", 'r') as fin:
|
with open("template.html", 'r') as fin:
|
||||||
template = fin.read()
|
template = fin.read()
|
||||||
renderindex(template)
|
renderindex(template)
|
||||||
title_text = "%s - XDF Leaderboards - Xonotie"
|
|
||||||
maps = getmaps("db/cts.db")
|
maps = getmaps("db/cts.db")
|
||||||
|
with open("template_map.html", 'r') as fin:
|
||||||
|
template = fin.read()
|
||||||
for game_map in maps:
|
for game_map in maps:
|
||||||
# game_map is a tuple obj.
|
# game_map is a tuple obj.
|
||||||
map_name = game_map[0]
|
map_name = game_map[0]
|
||||||
query = {"QUERY_STRING" : ("map=%s" % map_name)}
|
query = {"QUERY_STRING" : ("map=%s" % map_name)}
|
||||||
table = getcontent(query)
|
table = getcontent(query)
|
||||||
header = "<h3>%s</h3>" % map_name
|
filename = ("./output/maps/%s.html" % map_name)
|
||||||
filename = ("./output/%s.html" % map_name)
|
|
||||||
with open(filename, 'w+') as fout:
|
with open(filename, 'w+') as fout:
|
||||||
title = title_text % map_name
|
title = map_name
|
||||||
fout.write(template % (title, header + table))
|
fout.write(template % (title, map_name, table))
|
||||||
fout.close()
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
17
output/leaderboard.css
Normal file
17
output/leaderboard.css
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
18
template.html
Normal file
18
template.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>CTS Leaderboards - Add your title here</title>
|
||||||
|
<link href="./leaderboard.css" rel="stylesheet" type="text/css" media="all">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<div class = "content">
|
||||||
|
%s
|
||||||
|
|
||||||
|
<div class = "footer">
|
||||||
|
<center><p> Page generated using <a href="https://git.teknik.io/scuti/xdfcgi">xdfcgi</a> by scuti.</p></center>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</html>
|
20
template_map.html
Normal file
20
template_map.html
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>%s - CTS Leaderboards - Add your title here</title>
|
||||||
|
<link href="../leaderboard.css" rel="stylesheet" type="text/css" media="all">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<div class = "content">
|
||||||
|
<h3>%s</h3>
|
||||||
|
|
||||||
|
%s
|
||||||
|
|
||||||
|
<div class = "footer">
|
||||||
|
<center><p> Page generated using <a href="https://git.teknik.io/scuti/xdfcgi">xdfcgi</a> by scuti.</p></center>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user