Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,28 @@
</html>
'''

report_temp = '''
<html>
<head>
<title>Will it scale report</title>
</head>
<body>
<table>
<thead>
<tr>
<th>name</th>
<th>description</th>
</tr>
</thead>
<tbody>
{linkers}
</tbody>
</table>
</body>
</html>
'''
case_data = []

def parse_data(csvfile):
data = []
fp = open(csvfile)
Expand All @@ -47,12 +69,26 @@ def process(base):
open(htmlfile, 'w').write(html)
print('Created %s' % (htmlfile))

case_data.append((base, title, htmlfile))

def for_each_file(dirname, subdirs, filenames):
for f in filenames:
if f.endswith('.csv'):
process(f)

def generate_report_index(case_data, outfile='report.html'):
case_data.sort(key=lambda x: x[0])
hyperlinks = "".join([
f" <tr>\n"
f" <td>{name}</td>\n"
f" <td><a href=\"{htmlfile}\">{title}</a></td>\n"
f" </tr>\n"
for name, title, htmlfile in case_data
])
html = report_temp.format(linkers=hyperlinks)
with open(outfile, 'w', encoding='utf-8') as f:
f.write(html)
print(f"Created {outfile}")

if __name__ == '__main__':

Expand All @@ -65,3 +101,6 @@ def for_each_file(dirname, subdirs, filenames):
process(tmp[0])
except:
sys.exit(1)

# Generate the report html
generate_report_index(case_data)