-
Notifications
You must be signed in to change notification settings - Fork 43
/
index.html
58 lines (55 loc) · 1.29 KB
/
index.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
<!doctype HTML>
<html>
<head>
<title>edn playground</title>
<link rel="stylesheet" href="http://codemirror.net/lib/codemirror.css">
<script src="http://codemirror.net/lib/codemirror.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://codemirror.net/mode/clojure/clojure.js"></script>
<style>
body {
margin: 0; padding: 0;
font-family: helvetica;
}
.CodeMirror {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
}
#parse {
margin: 1em;
}
#output {
border-top: 1px solid #ddd;
padding: 1em;
}
h3 {
padding-left: 10px;
}
a {
display: inline-block;
padding: 10px;
float: right;
}
</style>
</head>
<body>
<a href="http://github.com/shaunxcode/jsedn">jsedn github</a>
<h3>EDN</h3>
<textarea id="source">[:hello {:this :is :some #{valid edn}} as-of #inst "2013"]</textarea>
<button id="parse">parse to JSON</button>
<h3>JSON</h3>
<pre id="output"></pre>
<script src="jsedn.js"></script>
<script>
var source = CodeMirror.fromTextArea(document.getElementById("source"), {lineNumbers: true});
var $output = $("#output");
$("#parse").click(function(){
try {
$("#output").text(JSON.stringify(jsedn.toJS(jsedn.parse(source.getValue())), null, 2));
} catch (e) {
alert(e);
}
})
</script>
</body>
</html>