www/top2html.py: juist aantal kolommen voor lege regels
This commit is contained in:
@@ -25,6 +25,7 @@ sys.stdout.buffer.write('''<div>
|
||||
<table>
|
||||
'''.format(html.escape(title)).encode('utf-8'))
|
||||
|
||||
cols=0
|
||||
with open(sys.argv[1], 'rt', encoding='utf-8') as fp:
|
||||
lineno = 0
|
||||
mx = 0
|
||||
@@ -40,6 +41,7 @@ with open(sys.argv[1], 'rt', encoding='utf-8') as fp:
|
||||
v = int(aa[0])
|
||||
if lineno == 0:
|
||||
mx = v
|
||||
cols=len(aa)
|
||||
p = 100 / mx * v
|
||||
sys.stdout.buffer.write('<tr><td><div style="width:{:.0f}%"></div><td>{}</tr>\n'.format(p, '<td>'.join(aa[1:])).encode('utf-8'))
|
||||
lineno += 1
|
||||
@@ -47,7 +49,7 @@ with open(sys.argv[1], 'rt', encoding='utf-8') as fp:
|
||||
break
|
||||
while lineno < 20:
|
||||
lineno += 1
|
||||
sys.stdout.buffer.write(b'<tr><td><div style="width:0%"></div><td> </tr>\n')
|
||||
sys.stdout.buffer.write(b'<tr><td><div style="width:0%"></div>' + b'<td> ' * (cols - 1) + b'</tr>\n')
|
||||
|
||||
|
||||
sys.stdout.buffer.write(b'</table>\n</div>\n\n')
|
||||
|
||||
Reference in New Issue
Block a user