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.

73 lines
2.0 KiB

2 months ago
  1. <!doctype html>
  2. <title>CodeMirror: Django template mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel="stylesheet" href="../../lib/codemirror.css">
  6. <link rel="stylesheet" href="../../theme/mdn-like.css">
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="../../addon/mode/overlay.js"></script>
  9. <script src="../xml/xml.js"></script>
  10. <script src="../htmlmixed/htmlmixed.js"></script>
  11. <script src="django.js"></script>
  12. <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  13. <div id=nav>
  14. <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
  15. <ul>
  16. <li><a href="../../index.html">Home</a>
  17. <li><a href="../../doc/manual.html">Manual</a>
  18. <li><a href="https://github.com/codemirror/codemirror5">Code</a>
  19. </ul>
  20. <ul>
  21. <li><a href="../index.html">Language modes</a>
  22. <li><a class=active href="#">Django</a>
  23. </ul>
  24. </div>
  25. <article>
  26. <h2>Django template mode</h2>
  27. <form><textarea id="code" name="code">
  28. <!doctype html>
  29. <html>
  30. <head>
  31. <title>My Django web application</title>
  32. </head>
  33. <body>
  34. <h1>
  35. {{ page.title|capfirst }}
  36. </h1>
  37. <ul class="my-list">
  38. {# traverse a list of items and produce links to their views. #}
  39. {% for item in items %}
  40. <li>
  41. <a href="{% url 'item_view' item.name|slugify %}">
  42. {{ item.name }}
  43. </a>
  44. </li>
  45. {% empty %}
  46. <li>You have no items in your list.</li>
  47. {% endfor %}
  48. </ul>
  49. {% comment "this is a forgotten footer" %}
  50. <footer></footer>
  51. {% endcomment %}
  52. </body>
  53. </html>
  54. </textarea></form>
  55. <script>
  56. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  57. lineNumbers: true,
  58. mode: "django",
  59. indentUnit: 2,
  60. indentWithTabs: true,
  61. theme: "mdn-like"
  62. });
  63. </script>
  64. <p>Mode for HTML with embedded Django template markup.</p>
  65. <p><strong>MIME types defined:</strong> <code>text/x-django</code></p>
  66. </article>