Skip to content

Commit

Permalink
CSS: Improve atrules
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Jul 8, 2015
1 parent cd0273e commit e254088
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion components/prism-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Prism.languages.css = {
'atrule': {
pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i,
inside: {
'punctuation': /[;:]/
'rule': /@[\w-]+/
// See rest below
}
},
'url': /url\((?:(["'])(\\\n|\\?.)*?\1|.*?)\)/i,
Expand All @@ -15,6 +16,8 @@ Prism.languages.css = {
'punctuation': /[(){};:]/
};

Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css);

if (Prism.languages.markup) {
Prism.languages.insertBefore('markup', 'tag', {
'style': {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-css.min.js

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

3 changes: 2 additions & 1 deletion components/prism-scss.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Prism.languages.scss = Prism.languages.extend('css', {
'atrule': {
pattern: /@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+(\{|;))/i,
inside: {
// See rest at the end of the file
'rule': /@[\w-]+/
// See rest below
}
},
// url, compassified
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.

5 changes: 4 additions & 1 deletion prism.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,8 @@ Prism.languages.css = {
'atrule': {
pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i,
inside: {
'punctuation': /[;:]/
'rule': /@[\w-]+/
// See rest below
}
},
'url': /url\((?:(["'])(\\\n|\\?.)*?\1|.*?)\)/i,
Expand All @@ -499,6 +500,8 @@ Prism.languages.css = {
'punctuation': /[(){};:]/
};

Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css);

if (Prism.languages.markup) {
Prism.languages.insertBefore('markup', 'tag', {
'style': {
Expand Down

0 comments on commit e254088

Please sign in to comment.