2 import posixpath # this must be posixpath, since we want /'s not \'s
5 def feat_result(result):
6 """Percentage result string"""
7 return '{}/{}'.format(result[0], result[1])
10 def escape_filename(key):
11 """Avoid reserved characters in filenames."""
12 return re.sub(r'[<>:"|?*#]', '_', key)
15 def escape_pathname(key):
16 """ Remove / and \\ from names """
17 return re.sub(r'[/\\]', '_', key)
20 def normalize_href(href):
21 """Force backward slashes in URLs."""
22 return href.replace('\\', '/')
28 <meta charset="UTF-8">
29 <title>Result summary</title>
30 <link rel="stylesheet" href="index.css">
33 <h1>Feature readiness</h1>
40 ## Create an additional column for each summary
41 % for _ in range(len(results.results)):
47 % for res in results.results:
48 <th class="head"><b>${res.name}</b><br>\
49 (<a href="${normalize_href(posixpath.join(escape_pathname(res.name), 'index.html'))}">info</a>)</th>
52 % for feature in results.features:
54 ## Add the left most column, the feature name
60 ## add the feature totals
61 % for res in results.results:
62 <td class="${results.feat_status[res.name][feature]}">
63 <b>${feat_result(results.feat_fractions[res.name][feature])}</b>