colorize namedcolor followed by ! without a space

This commit is contained in:
tophf 2018-01-09 20:16:59 +03:00
parent bbfda6d33b
commit 885919e7d9

View File

@ -44,7 +44,7 @@
'(' + '(' +
RX_COLOR.hex.source + '|' + RX_COLOR.hex.source + '|' +
'(?:rgb|hsl)a?(?=\\()|(?:' + [...colorConverter.NAMED_COLORS.keys()].join('|') + ')' + '(?:rgb|hsl)a?(?=\\()|(?:' + [...colorConverter.NAMED_COLORS.keys()].join('|') + ')' +
'(?=[\\s;(){}[\\]/"]|$)' + '(?=[\\s;(){}[\\]/"!]|$)' +
')', 'gi'); ')', 'gi');
const RX_DETECT_FUNC = /(rgb|hsl)a?\(/iy; const RX_DETECT_FUNC = /(rgb|hsl)a?\(/iy;
@ -368,6 +368,11 @@
} }
color = text.slice(start, isFunc ? text.indexOf(')', end) + 1 : end); color = text.slice(start, isFunc ? text.indexOf(')', end) + 1 : end);
const j = !isHex && !isFunc && color.indexOf('!');
if (j > 0) {
color = color.slice(0, j);
end = start + j;
}
const spanState = markedSpans && checkSpan(); const spanState = markedSpans && checkSpan();
if (spanState === 'same') continue; if (spanState === 'same') continue;
if (checkColor()) { if (checkColor()) {