PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/samples/scalate-sample-sitegen/src/highlight/languages/django.js

http://github.com/scalate/scalate
JavaScript | 61 lines | 56 code | 1 blank | 4 comment | 0 complexity | bff5fd21ed4dafb0c37d6388dbeb9315 MD5 | raw file
 1/*
 2Language: Django
 3Requires: html-xml.js
 4*/
 5
 6hljs.LANGUAGES.django = {
 7  defaultMode: {
 8    contains: ['tag', 'comment', 'doctype', 'template_comment', 'template_tag', 'variable']
 9  },
10  case_insensitive: true,
11  modes: [
12    hljs.XML_COMMENT,
13    hljs.HTML_DOCTYPE,
14    {
15      className: 'tag',
16      lexems: [hljs.IDENT_RE],
17      keywords: hljs.HTML_TAGS,
18      begin: '<[A-Za-z/]', end: '>',
19      contains: ['attribute', 'template_comment', 'template_tag', 'variable']
20    },
21    hljs.HTML_ATTR,
22    hljs.HTML_SHORT_ATTR,
23    {
24      className: 'value',
25      begin: '"', end: '"',
26      contains: ['template_comment', 'template_tag', 'variable']
27    },
28    hljs.HTML_VALUE,
29    {
30      className: 'template_comment',
31      begin: '\\{\\%\\s*comment\\s*\\%\\}', end: '\\{\\%\\s*endcomment\\s*\\%\\}'
32    },
33    {
34      className: 'template_comment',
35      begin: '\\{#', end: '#\\}'
36    },
37    {
38      className: 'template_tag',
39      begin: '\\{\\%', end: '\\%\\}',
40      lexems: [hljs.IDENT_RE],
41      keywords: {'comment': 1, 'endcomment': 1, 'load': 1, 'templatetag': 1, 'ifchanged': 1, 'endifchanged': 1, 'if': 1, 'endif': 1, 'firstof': 1, 'for': 1, 'endfor': 1, 'in': 1, 'ifnotequal': 1, 'endifnotequal': 1, 'widthratio': 1, 'extends': 1, 'include': 1, 'spaceless': 1, 'endspaceless': 1, 'regroup': 1, 'by': 1, 'as': 1, 'ifequal': 1, 'endifequal': 1, 'ssi': 1, 'now': 1, 'with': 1, 'cycle': 1, 'url': 1, 'filter': 1, 'endfilter': 1, 'debug': 1, 'block': 1, 'endblock': 1, 'else': 1},
42      contains: ['filter']
43    },
44    {
45      className: 'variable',
46      begin: '\\{\\{', end: '\\}\\}',
47      contains: ['filter']
48    },
49    {
50      className: 'filter',
51      begin: '\\|[A-Za-z]+\\:?', end: '^', excludeEnd: true,
52      lexems: [hljs.IDENT_RE],
53      keywords: {'truncatewords': 1, 'removetags': 1, 'linebreaksbr': 1, 'yesno': 1, 'get_digit': 1, 'timesince': 1, 'random': 1, 'striptags': 1, 'filesizeformat': 1, 'escape': 1, 'linebreaks': 1, 'length_is': 1, 'ljust': 1, 'rjust': 1, 'cut': 1, 'urlize': 1, 'fix_ampersands': 1, 'title': 1, 'floatformat': 1, 'capfirst': 1, 'pprint': 1, 'divisibleby': 1, 'add': 1, 'make_list': 1, 'unordered_list': 1, 'urlencode': 1, 'timeuntil': 1, 'urlizetrunc': 1, 'wordcount': 1, 'stringformat': 1, 'linenumbers': 1, 'slice': 1, 'date': 1, 'dictsort': 1, 'dictsortreversed': 1, 'default_if_none': 1, 'pluralize': 1, 'lower': 1, 'join': 1, 'center': 1, 'default': 1, 'truncatewords_html': 1, 'upper': 1, 'length': 1, 'phone2numeric': 1, 'wordwrap': 1, 'time': 1, 'addslashes': 1, 'slugify': 1, 'first': 1},
54      contains: ['argument']
55    },
56    {
57      className: 'argument',
58      begin: '"', end: '"'
59    }
60  ]
61};