Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: lib/src/prism/components/prism-scss.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 Prism.languages.scss = Prism.languages.extend('css', { 1 Prism.languages.scss = Prism.languages.extend('css', {
2 'comment': { 2 'comment': {
3 » » pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/, 3 » » pattern: /(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,
4 lookbehind: true 4 lookbehind: true
5 }, 5 },
6 'atrule': { 6 'atrule': {
7 » » pattern: /@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+(\{|;))/i, 7 » » pattern: /@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+[{;])/,
8 inside: { 8 inside: {
9 'rule': /@[\w-]+/ 9 'rule': /@[\w-]+/
10 // See rest below 10 // See rest below
11 } 11 }
12 }, 12 },
13 // url, compassified 13 // url, compassified
14 » 'url': /([-a-z]+-)*url(?=\()/i, 14 » 'url': /(?:[-a-z]+-)*url(?=\()/i,
15 // CSS selector regex is not appropriate for Sass 15 // CSS selector regex is not appropriate for Sass
16 // since there can be lot more things (var, @ directive, nesting..) 16 // since there can be lot more things (var, @ directive, nesting..)
17 // a selector must start at the end of a property or after a brace (end of other rules or nesting) 17 // a selector must start at the end of a property or after a brace (end of other rules or nesting)
18 » // it can contain some caracters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable 18 » // it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
19 // the end of a selector is found when there is no rules in it ( {} or { \s}) or if there is a property (because an interpolated var 19 // the end of a selector is found when there is no rules in it ( {} or { \s}) or if there is a property (because an interpolated var
20 // can "pass" as a selector- e.g: proper#{$erty}) 20 // can "pass" as a selector- e.g: proper#{$erty})
21 » // this one was ard to do, so please be careful if you edit this one :) 21 » // this one was hard to do, so please be careful if you edit this one :)
22 'selector': { 22 'selector': {
23 » » pattern: /([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|#\{\$[-_\w]+\})+)(?=\s *\{(\}|\s|[^\}]+(:|\{)[^\}]+))/m, 23 » » // Initial look-ahead is used to prevent matching of blank selec tors
24 » » pattern: /(?=\S)[^@;\{\}\(\)]?([^@;\{\}\(\)]|&|#\{\$[-_\w]+\})+( ?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/m,
24 inside: { 25 inside: {
25 » » » 'placeholder': /%[-_\w]+/i 26 » » » 'placeholder': /%[-_\w]+/
26 } 27 }
27 } 28 }
28 }); 29 });
29 30
30 Prism.languages.insertBefore('scss', 'atrule', { 31 Prism.languages.insertBefore('scss', 'atrule', {
31 » 'keyword': /@(if|else if|else|for|each|while|import|extend|debug|warn|mi xin|include|function|return|content)|(?=@for\s+\$[-_\w]+\s)+from/i 32 » 'keyword': [
33 » » /@(?:if|else(?: if)?|for|each|while|import|extend|debug|warn|mix in|include|function|return|content)/i,
34 » » {
35 » » » pattern: /( +)(?:from|through)(?= )/,
36 » » » lookbehind: true
37 » » }
38 » ]
32 }); 39 });
33 40
34 Prism.languages.insertBefore('scss', 'property', { 41 Prism.languages.insertBefore('scss', 'property', {
35 // var and interpolated vars 42 // var and interpolated vars
36 » 'variable': /((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i 43 » 'variable': /\$[-_\w]+|#\{\$[-_\w]+\}/
37 }); 44 });
38 45
39 Prism.languages.insertBefore('scss', 'function', { 46 Prism.languages.insertBefore('scss', 'function', {
40 'placeholder': { 47 'placeholder': {
41 » » pattern: /%[-_\w]+/i, 48 » » pattern: /%[-_\w]+/,
42 alias: 'selector' 49 alias: 'selector'
43 }, 50 },
44 » 'statement': /\B!(default|optional)\b/i, 51 » 'statement': /\B!(?:default|optional)\b/i,
45 » 'boolean': /\b(true|false)\b/, 52 » 'boolean': /\b(?:true|false)\b/,
46 » 'null': /\b(null)\b/, 53 » 'null': /\bnull\b/,
47 » 'operator': /\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|%)\s+/ 54 » 'operator': {
55 » » pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/,
56 » » lookbehind: true
57 » }
48 }); 58 });
49 59
50 Prism.languages.scss['atrule'].inside.rest = Prism.util.clone(Prism.languages.sc ss); 60 Prism.languages.scss['atrule'].inside.rest = Prism.util.clone(Prism.languages.sc ss);
OLDNEW
« no previous file with comments | « lib/src/prism/components/prism-scheme.min.js ('k') | lib/src/prism/components/prism-scss.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698