Add Nunjucks highlighting (#3341)

This commit is contained in:
Simen Bekkhus
2016-11-29 19:14:25 +01:00
committed by Brandon Black
parent 12f9295dd7
commit 0e9109c3fc
2 changed files with 52 additions and 1 deletions

View File

@@ -1659,13 +1659,16 @@ HTML+Django:
tm_scope: text.html.django
group: HTML
extensions:
- ".mustache"
- ".jinja"
- ".mustache"
- ".njk"
aliases:
- django
- html+django/jinja
- html+jinja
- htmldjango
- njk
- nunjucks
ace_mode: django
codemirror_mode: django
codemirror_mime_type: text/x-django

View File

@@ -0,0 +1,48 @@
{% from "forms.html" import label as description %}
{% macro field(name, value='', type='text') %}
<div class="field">
<input type="{{ type }}" name="{{ name }}"
value="{{ value | escape }}" />
</div>
{% endmacro %}
<html>
<head>
{% extends "head.html" %}
</head>
<body>
{% if horse %}
Chuck Norris once kicked a horse in the chin. Its descendants are known today as Giraffes.
{% elif optimus %}
Chuck Norris once urinated in a semi truck's gas tank as a joke....that truck is now known as Optimus Prime.
{% else %}
Chuck Norris threw a grenade and killed 50 people, then the grenade exploded.
{% endif %}
{% block left %}
This is the left side!
{% endblock %}
{% block right %}
This is the right side!
{% endblock %}
{{ description('Username') }}
{{ field('user') }}
{{ field('pass', type='password') }}
<h1>Posts</h1>
<ul>
{% for item in items %}
<li>{{ item.title }}</li>
{% else %}
<li>This would display if the 'item' collection were empty</li>
{% endfor %}
</ul>
{# Don't escape foo #}
{{ foo | safe }}
</body>
</html>