Better parsing of cssParsingErrors' offenders
This commit is contained in:
@@ -392,18 +392,31 @@ var policies = {
|
||||
list: offenders.map(function(offender) {
|
||||
var parts = /^(?:(?:<([^ \(]*)>|\[inline CSS\]) ?)?(?:\((((?! @ ).)*)(?: @ (\d+):(\d+))?\))?$/.exec(offender);
|
||||
|
||||
if (!parts) {
|
||||
debug('cssParsingErrors offenders transform function error with "%s"', offender);
|
||||
if (parts) {
|
||||
return {
|
||||
parseError: offender
|
||||
error: parts[2],
|
||||
file: parts[1] || null,
|
||||
line: (parts[4] && parts[5]) ? parseInt(parts[4], 10) : null,
|
||||
column: (parts[4] && parts[5]) ? parseInt(parts[5], 10) : null
|
||||
};
|
||||
}
|
||||
|
||||
// Try another syntax
|
||||
parts = /^(.*) <(.*)> @ (\d+):(\d+)$/.exec(offender);
|
||||
|
||||
if (parts) {
|
||||
return {
|
||||
error: parts[1],
|
||||
file: parts[2] || null,
|
||||
line: parseInt(parts[3], 10),
|
||||
column: parseInt(parts[4], 10)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
debug('cssParsingErrors offenders transform function error with "%s"', offender);
|
||||
return {
|
||||
error: parts[2],
|
||||
file: parts[1] || null,
|
||||
line: (parts[4] && parts[5]) ? parseInt(parts[4], 10) : null,
|
||||
column: (parts[4] && parts[5]) ? parseInt(parts[5], 10) : null
|
||||
parseError: offender
|
||||
};
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user