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:
2.1 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | 'use strict'
|
---|
| 2 |
|
---|
| 3 | module.exports = css
|
---|
| 4 | css.displayName = 'css'
|
---|
| 5 | css.aliases = []
|
---|
| 6 | function css(Prism) {
|
---|
| 7 | ;(function (Prism) {
|
---|
| 8 | var string =
|
---|
| 9 | /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/
|
---|
| 10 | Prism.languages.css = {
|
---|
| 11 | comment: /\/\*[\s\S]*?\*\//,
|
---|
| 12 | atrule: {
|
---|
| 13 | pattern: /@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,
|
---|
| 14 | inside: {
|
---|
| 15 | rule: /^@[\w-]+/,
|
---|
| 16 | 'selector-function-argument': {
|
---|
| 17 | pattern:
|
---|
| 18 | /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
---|
| 19 | lookbehind: true,
|
---|
| 20 | alias: 'selector'
|
---|
| 21 | },
|
---|
| 22 | keyword: {
|
---|
| 23 | pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
---|
| 24 | lookbehind: true
|
---|
| 25 | } // See rest below
|
---|
| 26 | }
|
---|
| 27 | },
|
---|
| 28 | url: {
|
---|
| 29 | // https://drafts.csswg.org/css-values-3/#urls
|
---|
| 30 | pattern: RegExp(
|
---|
| 31 | '\\burl\\((?:' +
|
---|
| 32 | string.source +
|
---|
| 33 | '|' +
|
---|
| 34 | /(?:[^\\\r\n()"']|\\[\s\S])*/.source +
|
---|
| 35 | ')\\)',
|
---|
| 36 | 'i'
|
---|
| 37 | ),
|
---|
| 38 | greedy: true,
|
---|
| 39 | inside: {
|
---|
| 40 | function: /^url/i,
|
---|
| 41 | punctuation: /^\(|\)$/,
|
---|
| 42 | string: {
|
---|
| 43 | pattern: RegExp('^' + string.source + '$'),
|
---|
| 44 | alias: 'url'
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
| 47 | },
|
---|
| 48 | selector: {
|
---|
| 49 | pattern: RegExp(
|
---|
| 50 | '(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' +
|
---|
| 51 | string.source +
|
---|
| 52 | ')*(?=\\s*\\{)'
|
---|
| 53 | ),
|
---|
| 54 | lookbehind: true
|
---|
| 55 | },
|
---|
| 56 | string: {
|
---|
| 57 | pattern: string,
|
---|
| 58 | greedy: true
|
---|
| 59 | },
|
---|
| 60 | property: {
|
---|
| 61 | pattern:
|
---|
| 62 | /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
---|
| 63 | lookbehind: true
|
---|
| 64 | },
|
---|
| 65 | important: /!important\b/i,
|
---|
| 66 | function: {
|
---|
| 67 | pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
---|
| 68 | lookbehind: true
|
---|
| 69 | },
|
---|
| 70 | punctuation: /[(){};:,]/
|
---|
| 71 | }
|
---|
| 72 | Prism.languages.css['atrule'].inside.rest = Prism.languages.css
|
---|
| 73 | var markup = Prism.languages.markup
|
---|
| 74 | if (markup) {
|
---|
| 75 | markup.tag.addInlined('style', 'css')
|
---|
| 76 | markup.tag.addAttribute('style', 'css')
|
---|
| 77 | }
|
---|
| 78 | })(Prism)
|
---|
| 79 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.