template.html 3.38 KB
Newer Older
dugupeiwen's avatar
dugupeiwen committed
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<html>

<head>

<style>

.annotation_table {
    color: #000000;
    font-family: monospace;
    margin: 5px;
    width: 100%;
}

/* override JupyterLab style */
.annotation_table td {
    text-align: left;
    background-color: transparent; 
    padding: 1px;
}

.annotation_table code
{
    background-color: transparent; 
    white-space: normal;
}

/* End override JupyterLab style */

tr:hover {
    background-color: rgba(92, 200, 249, 0.25);
}

td.object_tag summary ,
td.lifted_tag summary{
    font-weight: bold;
    display: list-item;
}

span.lifted_tag {
    color: #00cc33;
}

span.object_tag {
    color: #cc3300;
}


td.lifted_tag {
    background-color: #cdf7d8;
}

td.object_tag {
    background-color: #ffd3d3;
}

code.ir_code {
    color: grey;
    font-style: italic;
}

.metadata {
    border-bottom: medium solid black;
    display: inline-block;
    padding: 5px;
    width: 100%;
}

.annotations {
padding: 5px;
}

.hidden {
display: none;
}

.buttons {
padding: 10px;
cursor: pointer;
}

</style>

</head>

<body>

    {% for func_key in func_data.keys() %}

        {% set loop1 = loop %}

        <div class="metadata">
        Function name: {{func_data[func_key]['funcname']}}<br />
        in file: {{func_data[func_key]['filename']}}<br />
        with signature: {{func_key[1]|e}}
        </div>

        <div class="annotations">

        <table class="annotation_table tex2jax_ignore">
            {%- for num, line in func_data[func_key]['python_lines'] -%}
                {%- if func_data[func_key]['ir_lines'][num] %}
                    <tr><td class="{{func_data[func_key]['python_tags'][num]}}">
                        <details>
                            <summary>
                                <code>
                                {{num}}:
                                {{func_data[func_key]['python_indent'][num]}}{{line|e}}
                                </code>
                            </summary>
                            <table class="annotation_table">
                                <tbody>
                                    {%- for ir_line, ir_line_type in func_data[func_key]['ir_lines'][num] %}
                                        <tr class="ir_code func{{loop1.index0}}_ir">
                                            <td><code>&nbsp;
                                            {{- func_data[func_key]['python_indent'][num]}}
                                            {{func_data[func_key]['ir_indent'][num][loop.index0]}}{{ir_line|e -}}
                                            <span class="object_tag">{{ir_line_type}}</span>
                                            </code>
                                            </td>
                                        </tr>
                                    {%- endfor -%}
                                </tbody>
                            </table>
                            </details>
                    </td></tr>
                {% else -%}
                    <tr><td style=" padding-left: 22px;" class="{{func_data[func_key]['python_tags'][num]}}">
                        <code>
                            {{num}}:
                            {{func_data[func_key]['python_indent'][num]}}{{line|e}}
                        </code>
                    </td></tr>
                {%- endif -%}
            {%- endfor -%}
        </table>
        </div>

        <br /><br /><br />

    {% endfor %}

</body>

</html>