| 1 |
<!doctype html> |
| 2 |
|
| 3 |
<title>CodeMirror: Twig mode</title> |
| 4 |
<meta charset="utf-8"/> |
| 5 |
<link rel=stylesheet href="../../doc/docs.css"> |
| 6 |
|
| 7 |
<link rel="stylesheet" href="../../lib/codemirror.css"> |
| 8 |
<script src="../../lib/codemirror.js"></script> |
| 9 |
<script src="twig.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"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> |
| 13 |
|
| 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="#">Twig</a> |
| 22 |
</ul> |
| 23 |
</div> |
| 24 |
|
| 25 |
<article> |
| 26 |
<h2>Twig mode</h2> |
| 27 |
<form><textarea id="code" name="code"> |
| 28 |
{% extends "layout.twig" %} |
| 29 |
{% block title %}CodeMirror: Twig mode{% endblock %} |
| 30 |
{# this is a comment #} |
| 31 |
{% block content %} |
| 32 |
{% for foo in bar if foo.baz is divisible by(3) %} |
| 33 |
Hello {{ foo.world }} |
| 34 |
{% else %} |
| 35 |
{% set msg = "Result not found" %} |
| 36 |
{% include "empty.twig" with { message: msg } %} |
| 37 |
{% endfor %} |
| 38 |
{% endblock %} |
| 39 |
</textarea></form> |
| 40 |
<script> |
| 41 |
var editor = |
| 42 |
CodeMirror.fromTextArea(document.getElementById("code"), {mode: |
| 43 |
{name: "twig", htmlMode: true}}); |
| 44 |
</script> |
| 45 |
</article> |