You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.4 KiB

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