/usr/lib/nodejs/highlight/django.js is in node-highlight 7.4+ds-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | module.exports = function(hljs) {
function allowsDjangoSyntax(mode, parent) {
return (
parent == undefined || // default mode
(!mode.className && parent.className == 'tag') || // tag_internal
mode.className == 'value' // value
);
}
function copy(mode, parent) {
var result = {};
for (var key in mode) {
if (key != 'contains') {
result[key] = mode[key];
}
var contains = [];
for (var i = 0; mode.contains && i < mode.contains.length; i++) {
contains.push(copy(mode.contains[i], mode));
}
if (allowsDjangoSyntax(mode, parent)) {
contains = DJANGO_CONTAINS.concat(contains);
}
if (contains.length) {
result.contains = contains;
}
}
return result;
}
var FILTER = {
className: 'filter',
begin: '\\|[A-Za-z]+\\:?',
keywords:
'truncatewords removetags linebreaksbr yesno get_digit timesince random striptags ' +
'filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands ' +
'title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode ' +
'timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort ' +
'dictsortreversed default_if_none pluralize lower join center default ' +
'truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first ' +
'escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize ' +
'localtime utc timezone',
contains: [
{className: 'argument', begin: '"', end: '"'}
]
};
var DJANGO_CONTAINS = [
{
className: 'template_comment',
begin: '{%\\s*comment\\s*%}', end: '{%\\s*endcomment\\s*%}'
},
{
className: 'template_comment',
begin: '{#', end: '#}'
},
{
className: 'template_tag',
begin: '{%', end: '%}',
keywords:
'comment endcomment load templatetag ifchanged endifchanged if endif firstof for ' +
'endfor in ifnotequal endifnotequal widthratio extends include spaceless ' +
'endspaceless regroup by as ifequal endifequal ssi now with cycle url filter ' +
'endfilter debug block endblock else autoescape endautoescape csrf_token empty elif ' +
'endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix ' +
'plural get_current_language language get_available_languages ' +
'get_current_language_bidi get_language_info get_language_info_list localize ' +
'endlocalize localtime endlocaltime timezone endtimezone get_current_timezone ' +
'verbatim',
contains: [FILTER]
},
{
className: 'variable',
begin: '{{', end: '}}',
contains: [FILTER]
}
];
var result = copy(hljs.LANGUAGES.xml);
result.case_insensitive = true;
return result;
};
|