| 776 |
lars |
1 |
<!doctype html>
|
|
|
2 |
<title>CodeMirror: Html Embedded Scripts mode</title>
|
|
|
3 |
<meta charset="utf-8" />
|
|
|
4 |
<link rel=stylesheet href="../../doc/docs.css">
|
|
|
5 |
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
|
6 |
<script src="../../lib/codemirror.js"></script>
|
|
|
7 |
<script src="../xml/xml.js"></script>
|
|
|
8 |
<script src="../javascript/javascript.js"></script>
|
|
|
9 |
<script src="../css/css.js"></script>
|
|
|
10 |
<script src="../htmlmixed/htmlmixed.js"></script>
|
|
|
11 |
<script src="../../addon/mode/multiplex.js"></script>
|
|
|
12 |
<script src="htmlembedded.js"></script>
|
|
|
13 |
<style type="text/css">
|
|
|
14 |
.CodeMirror {
|
|
|
15 |
border-top: 1px solid black;
|
|
|
16 |
border-bottom: 1px solid black;
|
|
|
17 |
}
|
|
|
18 |
</style>
|
|
|
19 |
<div id=nav>
|
|
|
20 |
<a href="http://codemirror.net">
|
|
|
21 |
<h1>CodeMirror</h1>
|
|
|
22 |
<img id=logo src="../../doc/logo.png">
|
|
|
23 |
</a>
|
|
|
24 |
<ul>
|
|
|
25 |
<li>
|
|
|
26 |
<a href="../../index.html">Home</a>
|
|
|
27 |
<li>
|
|
|
28 |
<a href="../../doc/manual.html">Manual</a>
|
|
|
29 |
<li>
|
|
|
30 |
<a href="https://github.com/codemirror/codemirror">Code</a>
|
|
|
31 |
</ul>
|
|
|
32 |
<ul>
|
|
|
33 |
<li>
|
|
|
34 |
<a href="../index.html">Language modes</a>
|
|
|
35 |
<li>
|
|
|
36 |
<a class=active href="#">Html Embedded Scripts</a>
|
|
|
37 |
</ul>
|
|
|
38 |
</div>
|
|
|
39 |
<article>
|
|
|
40 |
<h2>Html Embedded Scripts mode</h2>
|
|
|
41 |
<form>
|
|
|
42 |
<textarea id="code" name="code">
|
|
|
43 |
<%
|
|
|
44 |
function hello(who) {
|
|
|
45 |
return "Hello " + who;
|
|
|
46 |
}
|
|
|
47 |
%> This is an example of EJS (embedded javascript)
|
|
|
48 |
<p>The program says
|
|
|
49 |
<%= hello("world") %>.</p>
|
|
|
50 |
<script>
|
|
|
51 |
alert("And here is some normal JS code"); // also colored
|
|
|
52 |
</script>
|
|
|
53 |
</textarea>
|
|
|
54 |
</form>
|
|
|
55 |
<script>
|
|
|
56 |
var editor = CodeMirror.fromTextArea(document.getElementById("code"),
|
|
|
57 |
{
|
|
|
58 |
lineNumbers: true,
|
|
|
59 |
mode: "application/x-ejs",
|
|
|
60 |
indentUnit: 4,
|
|
|
61 |
indentWithTabs: true
|
|
|
62 |
});
|
|
|
63 |
</script>
|
|
|
64 |
<p>Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on JavaScript, CSS and XML.
|
|
|
65 |
<br />Other dependancies include those of the scriping language chosen.</p>
|
|
|
66 |
<p>
|
|
|
67 |
<strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET), <code>application/x-ejs</code> (Embedded Javascript), <code>application/x-jsp</code> (JavaServer Pages)</p>
|
|
|
68 |
</article>
|