From 0e9109c3fcdacb17b27581710c7b435086b70485 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 29 Nov 2016 19:14:25 +0100 Subject: [PATCH] Add Nunjucks highlighting (#3341) --- lib/linguist/languages.yml | 5 +++- samples/HTML+Django/nunjucks.njk | 48 ++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 samples/HTML+Django/nunjucks.njk diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 35d9d208..da4aa889 100755 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -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 diff --git a/samples/HTML+Django/nunjucks.njk b/samples/HTML+Django/nunjucks.njk new file mode 100644 index 00000000..3370de57 --- /dev/null +++ b/samples/HTML+Django/nunjucks.njk @@ -0,0 +1,48 @@ +{% from "forms.html" import label as description %} + + +{% macro field(name, value='', type='text') %} +
+ +
+{% endmacro %} + + + + {% extends "head.html" %} + + +{% 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') }} + +

Posts

+ + +{# Don't escape foo #} +{{ foo | safe }} + +