summaryrefslogtreecommitdiff
path: root/templates/feature.mako
blob: 9abd5bc3113881248827d60f2579a66dae2676c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<%!
  import posixpath  # this must be posixpath, since we want /'s not \'s
  import re

  from six.moves import range


  def feat_result(result):
      """Percentage result string"""
      return '{}/{}'.format(result[0], result[1])


  def escape_filename(key):
      """Avoid reserved characters in filenames."""
      return re.sub(r'[<>:"|?*#]', '_', key)


  def escape_pathname(key):
      """ Remove / and \\ from names """
      return re.sub(r'[/\\]', '_', key)


  def normalize_href(href):
      """Force backward slashes in URLs."""
      return href.replace('\\', '/')
%>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Result summary</title>
    <link rel="stylesheet" href="index.css" type="text/css" />
  </head>
  <body>
    <h1>Feature readiness</h1>
    <table>
      <colgroup>
        ## Name Column
        <col />

        ## Status columns
        ## Create an additional column for each summary
        % for _ in range(len(results.results)):
        <col />
        % endfor
      </colgroup>
      <tr>
        <th/>
        % for res in results.results:
          <th class="head"><b>${res.name}</b><br />\
          (<a href="${normalize_href(posixpath.join(escape_pathname(res.name), 'index.html'))}">info</a>)</th>
        % endfor
      </tr>
      % for feature in results.features:
        <tr>
        ## Add the left most column, the feature name
        <td>
          <div class="group">
            <b>${feature}</b>
          </div>
        </td>
        ## add the feature totals
        % for res in results.results:
          <td class="${results.feat_status[res.name][feature]}">
            <b>${feat_result(results.feat_fractions[res.name][feature])}</b>
          </td>
        % endfor
        </tr>
      % endfor
    </table>
  </body>
</html>