Skip to content

Commit

Permalink
SCSS: Match placeholders inside selectors + alias other placeholders …
Browse files Browse the repository at this point in the history
…as selectors (fix #238)
  • Loading branch information
Golmote committed Jul 11, 2015
1 parent d4194c9 commit 4e42e26
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions components/prism-scss.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ Prism.languages.scss = Prism.languages.extend('css', {
// 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
// can "pass" as a selector- e.g: proper#{$erty})
// this one was ard to do, so please be careful if you edit this one :)
'selector': /([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/m
'selector': {
pattern: /([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/m,
inside: {
'placeholder': /%[-_\w]+/i
}
}
});

Prism.languages.insertBefore('scss', 'atrule', {
Expand All @@ -32,7 +37,10 @@ Prism.languages.insertBefore('scss', 'property', {
});

Prism.languages.insertBefore('scss', 'function', {
'placeholder': /%[-_\w]+/i,
'placeholder': {
pattern: /%[-_\w]+/i,
alias: 'selector'
},
'statement': /\B!(default|optional)\b/i,
'boolean': /\b(true|false)\b/,
'null': /\b(null)\b/,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-scss.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4e42e26

Please sign in to comment.