index.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  14. <div id=nav>
  15. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  16. <ul>
  17. <li><a href="../../index.html">Home</a>
  18. <li><a href="../../doc/manual.html">Manual</a>
  19. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  20. </ul>
  21. <ul>
  22. <li><a href="../index.html">Language modes</a>
  23. <li><a class=active href="#">Html Embedded Scripts</a>
  24. </ul>
  25. </div>
  26. <article>
  27. <h2>Html Embedded Scripts mode</h2>
  28. <form><textarea id="code" name="code">
  29. <%
  30. function hello(who) {
  31. return "Hello " + who;
  32. }
  33. %>
  34. This is an example of EJS (embedded javascript)
  35. <p>The program says <%= hello("world") %>.</p>
  36. <script>
  37. alert("And here is some normal JS code"); // also colored
  38. </script>
  39. </textarea></form>
  40. <script>
  41. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  42. lineNumbers: true,
  43. mode: "application/x-ejs",
  44. indentUnit: 4,
  45. indentWithTabs: true
  46. });
  47. </script>
  48. <p>Mode for html embedded scripts like JSP and ASP.NET. Depends on multiplex and HtmlMixed which in turn depends on
  49. JavaScript, CSS and XML.<br />Other dependencies include those of the scripting language chosen.</p>
  50. <p><strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET),
  51. <code>application/x-ejs</code> (Embedded Javascript), <code>application/x-jsp</code> (JavaServer Pages)
  52. and <code>application/x-erb</code></p>
  53. </article>