PageRenderTime 36ms CodeModel.GetById 10ms app.highlight 23ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/scalate/scalate
JavaScript | 81 lines | 76 code | 1 blank | 4 comment | 0 complexity | ba190d030d3b49d177c676fedc242d81 MD5 | raw file
 1/*
 2Language: CSS
 3Requires:  html-xml.js
 4*/
 5
 6hljs.LANGUAGES.css = {
 7  defaultMode: {
 8    contains: ['at_rule', 'id', 'class', 'attr_selector', 'pseudo', 'rules', 'comment'],
 9    keywords: hljs.HTML_TAGS,
10    lexems: [hljs.IDENT_RE],
11    illegal: '='
12  },
13  case_insensitive: true,
14  modes: [
15    {
16      className: 'at_rule',
17      begin: '@', end: '[{;]',
18      excludeEnd: true,
19      lexems: [hljs.IDENT_RE],
20      keywords: {'import': 1, 'page': 1, 'media': 1, 'charset': 1, 'font-face': 1},
21      contains: ['function', 'string', 'number', 'pseudo']
22    },
23    {
24      className: 'id',
25      begin: '\\#[A-Za-z0-9_-]+', end: '^'
26    },
27    {
28      className: 'class',
29      begin: '\\.[A-Za-z0-9_-]+', end: '^',
30      relevance: 0
31    },
32    {
33      className: 'attr_selector',
34      begin: '\\[', end: '\\]',
35      illegal: '$'
36    },
37    {
38      className: 'pseudo',
39      begin: ':(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\"\\\']+', end: '^'
40    },
41    {
42      className: 'rules',
43      begin: '{', end: '}',
44      contains: ['rule', 'comment'],
45      illegal: '[^\\s]'
46    },
47    {
48      className: 'rule',
49      begin: '[A-Z\\_\\.\\-]+\\s*:', end: ';', endsWithParent: true,
50      lexems: ['[A-Za-z-]+'],
51      keywords: {'play-during': 1, 'counter-reset': 1, 'counter-increment': 1, 'min-height': 1, 'quotes': 1, 'border-top': 1, 'pitch': 1, 'font': 1, 'pause': 1, 'list-style-image': 1, 'border-width': 1, 'cue': 1, 'outline-width': 1, 'border-left': 1, 'elevation': 1, 'richness': 1, 'speech-rate': 1, 'border-bottom': 1, 'border-spacing': 1, 'background': 1, 'list-style-type': 1, 'text-align': 1, 'page-break-inside': 1, 'orphans': 1, 'page-break-before': 1, 'text-transform': 1, 'line-height': 1, 'padding-left': 1, 'font-size': 1, 'right': 1, 'word-spacing': 1, 'padding-top': 1, 'outline-style': 1, 'bottom': 1, 'content': 1, 'border-right-style': 1, 'padding-right': 1, 'border-left-style': 1, 'voice-family': 1, 'background-color': 1, 'border-bottom-color': 1, 'outline-color': 1, 'unicode-bidi': 1, 'max-width': 1, 'font-family': 1, 'caption-side': 1, 'border-right-width': 1, 'pause-before': 1, 'border-top-style': 1, 'color': 1, 'border-collapse': 1, 'border-bottom-width': 1, 'float': 1, 'height': 1, 'max-height': 1, 'margin-right': 1, 'border-top-width': 1, 'speak': 1, 'speak-header': 1, 'top': 1, 'cue-before': 1, 'min-width': 1, 'width': 1, 'font-variant': 1, 'border-top-color': 1, 'background-position': 1, 'empty-cells': 1, 'direction': 1, 'border-right': 1, 'visibility': 1, 'padding': 1, 'border-style': 1, 'background-attachment': 1, 'overflow': 1, 'border-bottom-style': 1, 'cursor': 1, 'margin': 1, 'display': 1, 'border-left-width': 1, 'letter-spacing': 1, 'vertical-align': 1, 'clip': 1, 'border-color': 1, 'list-style': 1, 'padding-bottom': 1, 'pause-after': 1, 'speak-numeral': 1, 'margin-left': 1, 'widows': 1, 'border': 1, 'font-style': 1, 'border-left-color': 1, 'pitch-range': 1, 'background-repeat': 1, 'table-layout': 1, 'margin-bottom': 1, 'speak-punctuation': 1, 'font-weight': 1, 'border-right-color': 1, 'page-break-after': 1, 'position': 1, 'white-space': 1, 'text-indent': 1, 'background-image': 1, 'volume': 1, 'stress': 1, 'outline': 1, 'clear': 1, 'z-index': 1, 'text-decoration': 1, 'margin-top': 1, 'azimuth': 1, 'cue-after': 1, 'left': 1, 'list-style-position': 1},
52      contains: ['value']
53    },
54    hljs.C_BLOCK_COMMENT_MODE,
55    {
56      className: 'value',
57      begin: '^', endsWithParent: true, excludeEnd: true,
58      contains: ['function', 'number', 'hexcolor', 'string']
59    },
60    {
61      className: 'number',
62      begin: hljs.NUMBER_RE, end: '^'
63    },
64    {
65      className: 'hexcolor',
66      begin: '\\#[0-9A-F]+', end: '^'
67    },
68    {
69      className: 'function',
70      begin: hljs.IDENT_RE + '\\(', end: '\\)',
71      contains: ['params']
72    },
73    {
74      className: 'params',
75      begin: '^', endsWithParent: true, excludeEnd: true,
76      contains: ['number', 'string']
77    },
78    hljs.APOS_STRING_MODE,
79    hljs.QUOTE_STRING_MODE
80  ]
81};