-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple.html
77 lines (76 loc) · 3.18 KB
/
simple.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
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>
<script>
requirejs.config({
packages: [
],
paths: {
}
});
function transpile() {
require(["onelang"], one => {
(async function() {
try {
resultCode.value = await one.OneLang.transpile(sourceCode.value, sourceLang.value, targetLang.value);
} catch (err) {
resultCode.value = err;
}
})();
});
}
</script>
<style>
table, textarea { width:100%; height:100% }
td { width:50% }
textarea { font-family: "Courier New", Courier, monospace; font-size:15px }
</style>
</head>
<body>
<p><b>Note: </b>this is highly simplified example for development purposes. For a more pleasent user experience, please visit the <a href="https://ide.onelang.io">OneLang WebIDE</a>.</p>
<table>
<tr>
<td>
<label for="sourceLang">Source language:</label>
<select id="sourceLang">
<option value="typescript">TypeScript</option>
<option value="csharp">C#</option>
<option value="ruby">Ruby</option>
<option value="php">PHP</option>
</select>
<input type="button" value="Transpile!" onclick="transpile()">
</td>
<td>
<label for="targetLang">Target language:</label>
<select id="targetLang">
<option value="cpp">C++</option>
<option value="csharp" selected>C#</option>
<option value="go">Go</option>
<option value="java">Java</option>
<option value="javascript">JavaScript</option>
<option value="perl">Perl</option>
<option value="php">PHP</option>
<option value="python">Python</option>
<option value="ruby">Ruby</option>
<option value="swift">Swift</option>
<option value="typescript">TypeScript</option>
</select>
<input type="button" value="Transpile!" onclick="transpile()">
</td>
</tr>
<tr style="height:100%;">
<td>
<textarea id="sourceCode">console.log("hello world!");</textarea>
</td>
<td>
<textarea id="resultCode"></textarea>
</td>
</tr>
</table>
<script>
transpile();
</script>
</body>
</html>