-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.jinja2
104 lines (100 loc) · 3.01 KB
/
template.jinja2
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Rule-based Transliterator Tester</title>
<meta name="description" content="Rule-based Transliterator Tester" />
<link rel="stylesheet" href="rbt_webapp/static/styles.css" />
</head>
<body onkeydown="handleKeypress(event)">
<h1>Rule-based Transliterator Tester</h1>
<form
action=""
id="rbt-webapp"
method="post"
enctype="multipart/form-data"
>
<div id="rules-container">
<div class="container">
<label>
Load rule file:
<input type="file" name="rulefile" onchange="this.form.submit()" />
</label>
<button
onclick="event.preventDefault(); download('ruleset.rbt', rulebox.value)"
type="button"
>
Save rule file
</button>
</div>
<textarea id="rulebox" name="rules" wrap="off">{{ rules }}</textarea>
<label>
Register with ID:
<input type="text" id="rulesetid" name="rulesetid" />
<button type="button" onclick="registerRuleset();">Register</button>
<input type="checkbox" id="regreverse"/>
Reverse?
</label>
<label>
Load existing ruleset:
<select onchange="setRules();" id="ruleset-select" name="rulesetname">
<option></option>
{% for rbt in rbts %}
<option {{ "selected" if rbt == rulesetname }}>{{ rbt }}</option>
{% endfor %}
</select>
</label>
</div>
<div id="testdata">
<label>
Load test data:
<input type="file" name="testdata" onchange="this.form.submit()" />
</label>
<div class="container">
<label>
<input type="checkbox" name="reverse" {{"checked" if reverse}}/>
Reverse?
</label>
<input type="submit" value="Test" />
</div>
<table>
<thead>
<tr>
<th>Test data</th>
<th>Expected</th>
<th>Output</th>
</tr>
</thead>
<tbody id="test-table">
{% for teststring, expected, output in testdata %}
<tr>
<td>
<input
type="text"
value="{{ teststring }}"
name="teststrings"
/>
</td>
<td>
<input type="text" value="{{ expected }}" name="expecteds" />
</td>
<td class="{{'different' if expected != output }}">
{{ output }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<button id="addrow" onclick="event.preventDefault(); addRow()">
+
</button>
</div>
</form>
<script src="rbt_webapp/static/scripts.js"></script>
{% if error %}
<script>
alert("Rule error:\n{{error}}");
</script>
{% endif %}
</body>
</html>