django.js (2790B)
1 /* 2 Language: Django 3 Description: Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. 4 Requires: xml.js 5 Author: Ivan Sagalaev <maniac@softwaremaniacs.org> 6 Contributors: Ilya Baryshev <baryshev@gmail.com> 7 Website: https://www.djangoproject.com 8 Category: template 9 */ 10 11 function django(hljs) { 12 var FILTER = { 13 begin: /\|[A-Za-z]+:?/, 14 keywords: { 15 name: 16 'truncatewords removetags linebreaksbr yesno get_digit timesince random striptags ' + 17 'filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands ' + 18 'title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode ' + 19 'timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort ' + 20 'dictsortreversed default_if_none pluralize lower join center default ' + 21 'truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first ' + 22 'escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize ' + 23 'localtime utc timezone' 24 }, 25 contains: [ 26 hljs.QUOTE_STRING_MODE, 27 hljs.APOS_STRING_MODE 28 ] 29 }; 30 31 return { 32 name: 'Django', 33 aliases: ['jinja'], 34 case_insensitive: true, 35 subLanguage: 'xml', 36 contains: [ 37 hljs.COMMENT(/\{%\s*comment\s*%}/, /\{%\s*endcomment\s*%}/), 38 hljs.COMMENT(/\{#/, /#}/), 39 { 40 className: 'template-tag', 41 begin: /\{%/, end: /%}/, 42 contains: [ 43 { 44 className: 'name', 45 begin: /\w+/, 46 keywords: { 47 name: 48 'comment endcomment load templatetag ifchanged endifchanged if endif firstof for ' + 49 'endfor ifnotequal endifnotequal widthratio extends include spaceless ' + 50 'endspaceless regroup ifequal endifequal ssi now with cycle url filter ' + 51 'endfilter debug block endblock else autoescape endautoescape csrf_token empty elif ' + 52 'endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix ' + 53 'plural get_current_language language get_available_languages ' + 54 'get_current_language_bidi get_language_info get_language_info_list localize ' + 55 'endlocalize localtime endlocaltime timezone endtimezone get_current_timezone ' + 56 'verbatim' 57 }, 58 starts: { 59 endsWithParent: true, 60 keywords: 'in by as', 61 contains: [FILTER], 62 relevance: 0 63 } 64 } 65 ] 66 }, 67 { 68 className: 'template-variable', 69 begin: /\{\{/, end: /}}/, 70 contains: [FILTER] 71 } 72 ] 73 }; 74 } 75 76 module.exports = django;