main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /* FIXME :
|
---|
2 | :extend() is not handled specifically : its highlighting is buggy.
|
---|
3 | Mixin usage must be inside a ruleset to be highlighted.
|
---|
4 | At-rules (e.g. import) containing interpolations are buggy.
|
---|
5 | Detached rulesets are highlighted as at-rules.
|
---|
6 | A comment before a mixin usage prevents the latter to be properly highlighted.
|
---|
7 | */
|
---|
8 |
|
---|
9 | Prism.languages.less = Prism.languages.extend('css', {
|
---|
10 | 'comment': [
|
---|
11 | /\/\*[\s\S]*?\*\//,
|
---|
12 | {
|
---|
13 | pattern: /(^|[^\\])\/\/.*/,
|
---|
14 | lookbehind: true
|
---|
15 | }
|
---|
16 | ],
|
---|
17 | 'atrule': {
|
---|
18 | pattern: /@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,
|
---|
19 | inside: {
|
---|
20 | 'punctuation': /[:()]/
|
---|
21 | }
|
---|
22 | },
|
---|
23 | // selectors and mixins are considered the same
|
---|
24 | 'selector': {
|
---|
25 | pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,
|
---|
26 | inside: {
|
---|
27 | // mixin parameters
|
---|
28 | 'variable': /@+[\w-]+/
|
---|
29 | }
|
---|
30 | },
|
---|
31 |
|
---|
32 | 'property': /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,
|
---|
33 | 'operator': /[+\-*\/]/
|
---|
34 | });
|
---|
35 |
|
---|
36 | Prism.languages.insertBefore('less', 'property', {
|
---|
37 | 'variable': [
|
---|
38 | // Variable declaration (the colon must be consumed!)
|
---|
39 | {
|
---|
40 | pattern: /@[\w-]+\s*:/,
|
---|
41 | inside: {
|
---|
42 | 'punctuation': /:/
|
---|
43 | }
|
---|
44 | },
|
---|
45 |
|
---|
46 | // Variable usage
|
---|
47 | /@@?[\w-]+/
|
---|
48 | ],
|
---|
49 | 'mixin-usage': {
|
---|
50 | pattern: /([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,
|
---|
51 | lookbehind: true,
|
---|
52 | alias: 'function'
|
---|
53 | }
|
---|
54 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.