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