index.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <!doctype html>
  2. <title>CodeMirror: Handlebars 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="../../addon/mode/simple.js"></script>
  8. <script src="../../addon/mode/multiplex.js"></script>
  9. <script src="../xml/xml.js"></script>
  10. <script src="handlebars.js"></script>
  11. <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  12. <div id=nav>
  13. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  14. <ul>
  15. <li><a href="../../index.html">Home</a>
  16. <li><a href="../../doc/manual.html">Manual</a>
  17. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  18. </ul>
  19. <ul>
  20. <li><a href="../index.html">Language modes</a>
  21. <li><a class=active href="#">HTML mixed</a>
  22. </ul>
  23. </div>
  24. <article>
  25. <h2>Handlebars</h2>
  26. <form><textarea id="code" name="code">
  27. {{> breadcrumbs}}
  28. {{!--
  29. You can use the t function to get
  30. content translated to the current locale, es:
  31. {{t 'article_list'}}
  32. --}}
  33. <h1>{{t 'article_list'}}</h1>
  34. {{! one line comment }}
  35. {{#each articles}}
  36. {{~title}}
  37. <p>{{excerpt body size=120 ellipsis=true}}</p>
  38. {{#with author}}
  39. written by {{first_name}} {{last_name}}
  40. from category: {{../category.title}}
  41. {{#if @../last}}foobar!{{/if}}
  42. {{/with~}}
  43. {{#if promoted.latest}}Read this one! {{else}} This is ok! {{/if}}
  44. {{#if @last}}<hr>{{/if}}
  45. {{/each}}
  46. {{#form new_comment}}
  47. <input type="text" name="body">
  48. {{/form}}
  49. </textarea></form>
  50. <script>
  51. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  52. lineNumbers: true,
  53. matchBrackets: true,
  54. mode: {name: "handlebars", base: "text/html"}
  55. });
  56. </script>
  57. <p>Handlebars syntax highlighting for CodeMirror.</p>
  58. <p><strong>MIME types defined:</strong> <code>text/x-handlebars-template</code></p>
  59. <p>Supported options: <code>base</code> to set the mode to
  60. wrap. For example, use</p>
  61. <pre>mode: {name: "handlebars", base: "text/html"}</pre>
  62. <p>to highlight an HTML template.</p>
  63. </article>