-
Notifications
You must be signed in to change notification settings - Fork 7
/
editor.html
111 lines (92 loc) · 3.21 KB
/
editor.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<!--# include file="/templates/header.html" -->
<style>
.version {
padding-top: 10px;
color: #888;
}
.version2 {
padding-top: 0px;
color: #888;
}
.CodeMirror {
margin-top: 0px;
}
</style>
<title>Online Egison Editor</title>
</head>
<body>
<!--# include file="/templates/navbar.html" -->
<div class="container manual">
<div class="row">
<div class="col-md-12" id="top" role="complementary">
<h1>Online Egison Editor</h1>
</div>
</div>
<div class="row">
<div class="col-md-12" role="main">
<p>
You can write and run Egison programs. Enjoy Egison programming!
</p>
<div class="version">Egison mode</div>
<textarea id="egison-program" name="code"></textarea>
<button id="run-egison" class="btn btn-lg btn-primary" data-loading-text="Loading..." role="button">Run</button>
<pre id="egison-result"></pre>
<div class="version">Haskell mode (unable to execute)</div>
<textarea id="haskell-program" name="code"></textarea>
<div class="version">Ruby mode (unable to execute)</div>
<textarea id="ruby-program" name="code"></textarea>
<div class="version">Egison mode with line numbers</div>
<textarea id="egison-program2" name="code"></textarea>
</div>
</div><!--/row-->
</div><!-- /.container -->
<!--# include file="/templates/footer.html" -->
<script src="/vendors/codemirror/mode/haskell/haskell.js"></script>
<script src="/vendors/codemirror/mode/ruby/ruby.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("egison-program"), {
matchBrackets: true,
lineNumbers: false,
lineWrapping: true,
viewportMargin: Infinity
});
$(document).ready(function(){
$('.btn').button()
$('#run-egison').click(function() {
$('#run-egison').prop("disabled", true);
$('#run-egison').html("Running...");
$.post("/api/eval", { program: editor.getValue() }, function(data) {
data.output = data.output.replace(/</g, "<");
data.output = data.output.replace(/>/g, ">");
$('#egison-result').html(data.output);
$('#run-egison').html("Run");
$('#run-egison').prop("disabled", false);
}, "json");
});
});
var editor2 = CodeMirror.fromTextArea(document.getElementById("haskell-program"), {
matchBrackets: true,
lineNumbers: true,
lineWrapping: true,
viewportMargin: Infinity,
mode: "haskell"
});
var editor3 = CodeMirror.fromTextArea(document.getElementById("ruby-program"), {
matchBrackets: true,
lineNumbers: true,
lineWrapping: true,
viewportMargin: Infinity,
mode: "ruby"
});
var editor = CodeMirror.fromTextArea(document.getElementById("egison-program2"), {
matchBrackets: true,
lineNumbers: true,
lineWrapping: true,
viewportMargin: Infinity
});
</script>
</body>
</html>