2 import posixpath # this must be posixpath, since we want /'s not \'s
5 from six.moves import range
8 def feat_result(result):
9 """Percentage result string"""
10 return '{}/{}'.format(result[0], result[1])
13 def escape_filename(key):
14 """Avoid reserved characters in filenames."""
15 return re.sub(r'[<>:"|?*#]', '_', key)
18 def escape_pathname(key):
19 """ Remove / and \\ from names """
20 return re.sub(r'[/\\]', '_', key)
23 def normalize_href(href):
24 """Force backward slashes in URLs."""
25 return href.replace('\\', '/')
28 <?xml version="1.0" encoding="UTF-8"?>
29 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
30 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
31 <html xmlns="http://www.w3.org/1999/xhtml">
33 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
34 <title>Result summary</title>
35 <link rel="stylesheet" href="index.css" type="text/css" />
38 <h1>Feature readiness</h1>
45 ## Create an additional column for each summary
46 % for _ in range(len(results.results)):
52 % for res in results.results:
53 <th class="head"><b>${res.name}</b><br />\
54 (<a href="${normalize_href(posixpath.join(escape_pathname(res.name), 'index.html'))}">info</a>)</th>
57 % for feature in results.features:
59 ## Add the left most column, the feature name
65 ## add the feature totals
66 % for res in results.results:
67 <td class="${results.feat_status[res.name][feature]}">
68 <b>${feat_result(results.feat_fractions[res.name][feature])}</b>