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

Unified 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, 2 months 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/prism/components/prism-sass.js
diff --git a/lib/src/prism/components/prism-sass.js b/lib/src/prism/components/prism-sass.js
index 9115684fa309d0009ff690330ef2b256784711fb..0a34c00e7430812f8441c11bc80fefa3dc4e556a 100644
--- a/lib/src/prism/components/prism-sass.js
+++ b/lib/src/prism/components/prism-sass.js
@@ -1,7 +1,10 @@
(function(Prism) {
Prism.languages.sass = Prism.languages.extend('css', {
// Sass comments don't need to be closed, only indented
- 'comment': /^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t]+.+)*/m
+ 'comment': {
+ pattern: /^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t]+.+)*/m,
+ lookbehind: true
+ }
});
Prism.languages.insertBefore('sass', 'atrule', {
@@ -10,7 +13,7 @@
// Includes support for = and + shortcuts
pattern: /^(?:[ \t]*)[@+=].+/m,
inside: {
- 'atrule': /^(?:[ \t]*)(?:@[\w-]+|[+=])/m
+ 'atrule': /(?:@[\w-]+|[+=])/m
}
}
});
@@ -18,13 +21,18 @@
var variable = /((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i;
- var operator = /[-+]{1,2}|==?|!=|\|?\||\?|\*|\/|%/;
+ var operator = [
+ /[+*\/%]|[=!]=|<=?|>=?|\b(?:and|or|not)\b/,
+ {
+ pattern: /(\s+)-(?=\s)/,
+ lookbehind: true
+ }
+ ];
Prism.languages.insertBefore('sass', 'property', {
// We want to consume the whole line
'variable-line': {
- pattern: /(^|(?:\r?\n|\r))[ \t]*\$.+/,
- lookbehind: true,
+ pattern: /^[ \t]*\$.+/m,
inside: {
'punctuation': /:/,
'variable': variable,
@@ -33,8 +41,7 @@
},
// We want to consume the whole line
'property-line': {
- pattern: /(^|(?:\r?\n|\r))[ \t]*(?:[^:\s]+[ ]*:.*|:[^:\s]+.*)/i,
- lookbehind: true,
+ pattern: /^[ \t]*(?:[^:\s]+ *:.*|:[^:\s]+.*)/m,
inside: {
'property': [
/[^:\s]+(?=\s*:)/,
@@ -58,7 +65,7 @@
delete Prism.languages.sass.selector;
Prism.languages.insertBefore('sass', 'punctuation', {
'selector': {
- pattern: /([ \t]*).+(?:,(?:\r?\n|\r)\1[ \t]+.+)*/,
+ pattern: /([ \t]*)\S(?:,?[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,?[^,\r\n]+)*)*/,
lookbehind: true
}
});
« 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