Right-align the numeric columns.
The Game.printTable() method now right-aligns the name, rank, and score columns, by giving their cells a different CSS class.
This commit is contained in:
parent
aef04a38e1
commit
31174f58ee
2 changed files with 17 additions and 9 deletions
|
|
@ -39,6 +39,7 @@ tblhead = '<div class="stable">\n'
|
|||
rowstart = '<div class="sentry">\n'
|
||||
rowend = '</div>\n'
|
||||
cell = ' <span class="sdata">{0}</span>\n'
|
||||
rcell = ' <span class="sdatar">{0}</span>\n'
|
||||
hcell = ' <span class="shdata">{0}</span>\n'
|
||||
tblend = '</div>\n'
|
||||
pend = "</body></html>\n"
|
||||
|
|
@ -112,24 +113,25 @@ def printTable(entries, fields, of):
|
|||
clist = []
|
||||
for field in fields:
|
||||
if field == "rank":
|
||||
clist.append("{0}".format(i + 1))
|
||||
clist.append(("{0}".format(i + 1), rcell))
|
||||
elif field in entry:
|
||||
thing = entry[field]
|
||||
if field == "game":
|
||||
clist.append(thing.name)
|
||||
clist.append((thing.name, cell))
|
||||
elif field == "xl" or field == "score": # Numerics
|
||||
clist.append(str(thing))
|
||||
clist.append((str(thing), rcell))
|
||||
elif field == "name":
|
||||
clist.append(playerlink(thing))
|
||||
clist.append((playerlink(thing), cell))
|
||||
elif field == "fate":
|
||||
clist.append(thing)
|
||||
clist.append((thing, cell))
|
||||
elif field == "endt":
|
||||
clist.append(linktoArchive(entry))
|
||||
clist.append((linktoArchive(entry), cell))
|
||||
else:
|
||||
clist.append("{0}".format(thing))
|
||||
clist.append(("{0}".format(thing), cell))
|
||||
else:
|
||||
clist.append("N/A")
|
||||
of.write(maketablerow(clist))
|
||||
clist.append(("N/A", cell))
|
||||
rowstr = rowstart + "".join([ t.format(s) for (s, t) in clist ]) + rowend
|
||||
of.write(rowstr)
|
||||
of.write(tblend)
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue