本站源代码
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.

55 lines
1.7KB

  1. <!doctype html>
  2. <title>CodeMirror: Jinja2 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="jinja2.js"></script>
  8. <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  9. <div id=nav>
  10. <a href="https://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="#">Jinja2</a>
  19. </ul>
  20. </div>
  21. <article>
  22. <h2>Jinja2 mode</h2>
  23. <form><textarea id="code" name="code">
  24. {# this is a comment #}
  25. {%- for item in li -%}
  26. &lt;li&gt;{{ item.label }}&lt;/li&gt;
  27. {% endfor -%}
  28. {{ item.sand == true and item.keyword == false ? 1 : 0 }}
  29. {{ app.get(55, 1.2, true) }}
  30. {% if app.get(&#39;_route&#39;) == (&#39;_home&#39;) %}home{% endif %}
  31. {% if app.session.flashbag.has(&#39;message&#39;) %}
  32. {% for message in app.session.flashbag.get(&#39;message&#39;) %}
  33. {{ message.content }}
  34. {% endfor %}
  35. {% endif %}
  36. {{ path(&#39;_home&#39;, {&#39;section&#39;: app.request.get(&#39;section&#39;)}) }}
  37. {{ path(&#39;_home&#39;, {
  38. &#39;section&#39;: app.request.get(&#39;section&#39;),
  39. &#39;boolean&#39;: true,
  40. &#39;number&#39;: 55.33
  41. })
  42. }}
  43. {% include (&#39;test.incl.html.twig&#39;) %}
  44. </textarea></form>
  45. <script>
  46. var editor =
  47. CodeMirror.fromTextArea(document.getElementById("code"), {mode:
  48. {name: "jinja2", htmlMode: true}});
  49. </script>
  50. </article>
上海开阖软件有限公司 沪ICP备12045867号-1