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

Side by Side Diff: lib/src/prism/components/prism-sass.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
« no previous file with comments | « lib/src/prism/components/prism-sas.min.js ('k') | lib/src/prism/components/prism-sass.min.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 (function(Prism) { 1 (function(Prism) {
2 Prism.languages.sass = Prism.languages.extend('css', { 2 Prism.languages.sass = Prism.languages.extend('css', {
3 // Sass comments don't need to be closed, only indented 3 // Sass comments don't need to be closed, only indented
4 » » 'comment': /^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t]+.+)*/m 4 » » 'comment': {
5 » » » pattern: /^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t]+.+)*/ m,
6 » » » lookbehind: true
7 » » }
5 }); 8 });
6 9
7 Prism.languages.insertBefore('sass', 'atrule', { 10 Prism.languages.insertBefore('sass', 'atrule', {
8 // We want to consume the whole line 11 // We want to consume the whole line
9 'atrule-line': { 12 'atrule-line': {
10 // Includes support for = and + shortcuts 13 // Includes support for = and + shortcuts
11 pattern: /^(?:[ \t]*)[@+=].+/m, 14 pattern: /^(?:[ \t]*)[@+=].+/m,
12 inside: { 15 inside: {
13 » » » » 'atrule': /^(?:[ \t]*)(?:@[\w-]+|[+=])/m 16 » » » » 'atrule': /(?:@[\w-]+|[+=])/m
14 } 17 }
15 } 18 }
16 }); 19 });
17 delete Prism.languages.sass.atrule; 20 delete Prism.languages.sass.atrule;
18 21
19 22
20 var variable = /((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i; 23 var variable = /((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i;
21 » var operator = /[-+]{1,2}|==?|!=|\|?\||\?|\*|\/|%/; 24 » var operator = [
25 » » /[+*\/%]|[=!]=|<=?|>=?|\b(?:and|or|not)\b/,
26 » » {
27 » » » pattern: /(\s+)-(?=\s)/,
28 » » » lookbehind: true
29 » » }
30 » ];
22 31
23 Prism.languages.insertBefore('sass', 'property', { 32 Prism.languages.insertBefore('sass', 'property', {
24 // We want to consume the whole line 33 // We want to consume the whole line
25 'variable-line': { 34 'variable-line': {
26 » » » pattern: /(^|(?:\r?\n|\r))[ \t]*\$.+/, 35 » » » pattern: /^[ \t]*\$.+/m,
27 » » » lookbehind: true,
28 inside: { 36 inside: {
29 'punctuation': /:/, 37 'punctuation': /:/,
30 'variable': variable, 38 'variable': variable,
31 'operator': operator 39 'operator': operator
32 } 40 }
33 }, 41 },
34 // We want to consume the whole line 42 // We want to consume the whole line
35 'property-line': { 43 'property-line': {
36 » » » pattern: /(^|(?:\r?\n|\r))[ \t]*(?:[^:\s]+[ ]*:.*|:[^:\s ]+.*)/i, 44 » » » pattern: /^[ \t]*(?:[^:\s]+ *:.*|:[^:\s]+.*)/m,
37 » » » lookbehind: true,
38 inside: { 45 inside: {
39 'property': [ 46 'property': [
40 /[^:\s]+(?=\s*:)/, 47 /[^:\s]+(?=\s*:)/,
41 { 48 {
42 pattern: /(:)[^:\s]+/, 49 pattern: /(:)[^:\s]+/,
43 lookbehind: true 50 lookbehind: true
44 } 51 }
45 ], 52 ],
46 'punctuation': /:/, 53 'punctuation': /:/,
47 'variable': variable, 54 'variable': variable,
48 'operator': operator, 55 'operator': operator,
49 'important': Prism.languages.sass.important 56 'important': Prism.languages.sass.important
50 } 57 }
51 } 58 }
52 }); 59 });
53 delete Prism.languages.sass.property; 60 delete Prism.languages.sass.property;
54 delete Prism.languages.sass.important; 61 delete Prism.languages.sass.important;
55 62
56 // Now that whole lines for other patterns are consumed, 63 // Now that whole lines for other patterns are consumed,
57 // what's left should be selectors 64 // what's left should be selectors
58 delete Prism.languages.sass.selector; 65 delete Prism.languages.sass.selector;
59 Prism.languages.insertBefore('sass', 'punctuation', { 66 Prism.languages.insertBefore('sass', 'punctuation', {
60 'selector': { 67 'selector': {
61 » » » pattern: /([ \t]*).+(?:,(?:\r?\n|\r)\1[ \t]+.+)*/, 68 » » » pattern: /([ \t]*)\S(?:,?[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,?[^,\r\n]+)*)*/,
62 lookbehind: true 69 lookbehind: true
63 } 70 }
64 }); 71 });
65 72
66 }(Prism)); 73 }(Prism));
OLDNEW
« no previous file with comments | « lib/src/prism/components/prism-sas.min.js ('k') | lib/src/prism/components/prism-sass.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698