index.html 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!doctype html>
  2. <title>CodeMirror: Twig 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="twig.js"></script>
  8. <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  9. <div id=nav>
  10. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  11. <ul>
  12. <li><a href="../../index.html">Home</a>
  13. <li><a href="../../doc/manual.html">Manual</a>
  14. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  15. </ul>
  16. <ul>
  17. <li><a href="../index.html">Language modes</a>
  18. <li><a class=active href="#">Twig</a>
  19. </ul>
  20. </div>
  21. <article>
  22. <h2>Twig mode</h2>
  23. <form><textarea id="code" name="code">
  24. {% extends "layout.twig" %}
  25. {% block title %}CodeMirror: Twig mode{% endblock %}
  26. {# this is a comment #}
  27. {% block content %}
  28. {% for foo in bar if foo.baz is divisible by(3) %}
  29. Hello {{ foo.world }}
  30. {% else %}
  31. {% set msg = "Result not found" %}
  32. {% include "empty.twig" with { message: msg } %}
  33. {% endfor %}
  34. {% endblock %}
  35. </textarea></form>
  36. <script>
  37. var editor =
  38. CodeMirror.fromTextArea(document.getElementById("code"), {mode:
  39. {name: "twig", htmlMode: true}});
  40. </script>
  41. </article>