Skip to content

Commit 14fdfe3

Browse files
Sass: Fixed issues with CSS Extras (#2994)
1 parent 693b743 commit 14fdfe3

File tree

7 files changed

+48
-8
lines changed

7 files changed

+48
-8
lines changed

components.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,7 @@
11171117
"sass": {
11181118
"title": "Sass (Sass)",
11191119
"require": "css",
1120+
"optional": "css-extras",
11201121
"owner": "Golmote"
11211122
},
11221123
"scss": {

components/prism-css-extras.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
});
7777

7878
var unit = {
79-
pattern: /(\b\d+)(?:%|[a-z]+\b)/,
79+
pattern: /(\b\d+)(?:%|[a-z]+(?![\w-]))/,
8080
lookbehind: true
8181
};
8282
// 123 -123 .123 -.123 12.3 -12.3
@@ -97,7 +97,10 @@
9797
alias: 'color'
9898
},
9999
'color': [
100-
/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,
100+
{
101+
pattern: /(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,
102+
lookbehind: true
103+
},
101104
{
102105
pattern: /\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,
103106
inside: {

components/prism-css-extras.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/prism-sass.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
// Sass comments don't need to be closed, only indented
44
'comment': {
55
pattern: /^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,
6-
lookbehind: true
6+
lookbehind: true,
7+
greedy: true
78
}
89
});
910

@@ -12,6 +13,7 @@
1213
'atrule-line': {
1314
// Includes support for = and + shortcuts
1415
pattern: /^(?:[ \t]*)[@+=].+/m,
16+
greedy: true,
1517
inside: {
1618
'atrule': /(?:@[\w-]+|[+=])/m
1719
}
@@ -33,6 +35,7 @@
3335
// We want to consume the whole line
3436
'variable-line': {
3537
pattern: /^[ \t]*\$.+/m,
38+
greedy: true,
3639
inside: {
3740
'punctuation': /:/,
3841
'variable': variable,
@@ -42,6 +45,7 @@
4245
// We want to consume the whole line
4346
'property-line': {
4447
pattern: /^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,
48+
greedy: true,
4549
inside: {
4650
'property': [
4751
/[^:\s]+(?=\s*:)/,
@@ -64,8 +68,9 @@
6468
// what's left should be selectors
6569
Prism.languages.insertBefore('sass', 'punctuation', {
6670
'selector': {
67-
pattern: /([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/,
68-
lookbehind: true
71+
pattern: /^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,
72+
lookbehind: true,
73+
greedy: true
6974
}
7075
});
7176

components/prism-sass.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.lucidagrande-normal-black-14px
2+
color: var(--black)
3+
font-family: var(--font-family-lucidagrande)
4+
font-size: var(--font-size-m)
5+
--foo: black
6+
7+
----------------------------------------------------
8+
9+
[
10+
["selector", ".lucidagrande-normal-black-14px"],
11+
["property-line", [
12+
["property", "color"],
13+
["punctuation", ":"],
14+
" var(--black)"
15+
]],
16+
["property-line", [
17+
["property", "font-family"],
18+
["punctuation", ":"],
19+
" var(--font-family-lucidagrande)"
20+
]],
21+
["property-line", [
22+
["property", "font-size"],
23+
["punctuation", ":"],
24+
" var(--font-size-m)"
25+
]],
26+
["property-line", [
27+
["property", "--foo"],
28+
["punctuation", ":"],
29+
" black"
30+
]]
31+
]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy