Convert warnings to regex

These aren't shown in the layer currently, but for future use this
should work
This commit is contained in:
SilentSpike
2018-09-03 12:55:11 +01:00
committed by Bryan Housel
parent da23bf79a8
commit 9bd772748a
4 changed files with 28 additions and 8 deletions
+2 -2
View File
@@ -1185,13 +1185,13 @@ en:
description: 'There is more than one node in this spot. Offending node IDs: {var1}.'
_60:
title: 'depreciated tags'
description: 'This {var1} uses deprecated tag {var2}={var3}. Please use {var4} instead!'
description: 'This {var1} uses deprecated tag "{var2}"="{var3}". Please use {var4} instead!'
_300:
title: 'missing maxspeed'
description: 'missing maxspeed tag.'
_360:
title: 'language unknown'
description: 'It would be nice if this {var1} had an additional tag name:XX={var2} where XX shows the language of its name {var2}.'
description: 'It would be nice if this {var1} had an additional tag "name:XX"="{var2}" where XX shows the language of its name "{var2}".'
_390:
title: 'missing tracktype'
description: This track doesn't have a tracktype.
+2 -2
View File
@@ -1470,7 +1470,7 @@
},
"_60": {
"title": "depreciated tags",
"description": "This {var1} uses deprecated tag {var2}={var3}. Please use {var4} instead!"
"description": "This {var1} uses deprecated tag \"{var2}\"=\"{var3}\". Please use {var4} instead!"
},
"_300": {
"title": "missing maxspeed",
@@ -1478,7 +1478,7 @@
},
"_360": {
"title": "language unknown",
"description": "It would be nice if this {var1} had an additional tag name:XX={var2} where XX shows the language of its name {var2}."
"description": "It would be nice if this {var1} had an additional tag \"name:XX\"=\"{var2}\" where XX shows the language of its name \"{var2}\"."
},
"_390": {
"title": "missing tracktype",
+7 -4
View File
@@ -373,7 +373,7 @@
},
"_412": {
"title": "domain hijacking",
"description": "Possible domain squatting: <a target=_blank href=(.+)>\\1</a>. Suspicious text is: ''(.+)''",
"description": "Possible domain squatting: <a target=_blank href=(.+)>\\1</a>\\. Suspicious text is: ''(.+)''",
"regex": true
},
"_413": {
@@ -385,11 +385,14 @@
"warnings": {
"_20": {
"title": "multiple nodes on the same spot",
"description": "There is more than one node in this spot. Offending node IDs: {$1}"
"description": "There is more than one node in this spot\\. Offending node IDs: ((?:#\\d+,?)+)",
"IDs": ["20"],
"regex": true
},
"_60": {
"title": "depreciated tags",
"description": "This {$1} uses deprecated tag {$2} = {$3}. Please use {$4} instead!"
"description": "This (node|way|relation) uses deprecated tag '([\\w:]+)=(.+)'\\. Please use &quot;(.+)&quot; instead!",
"regex": true
},
"_300": {
"title": "missing maxspeed",
@@ -397,7 +400,7 @@
},
"_360": {
"title": "language unknown",
"description": "It would be nice if this (node|way|relation) had an additional tag ''name:XX=(\\.+?)''where XX shows the language of its name ''\\2''",
"description": "It would be nice if this (node|way|relation) had an additional tag 'name:XX=(.+)' where XX shows the language of its name '\\2'",
"regex": true
},
"_390": {
+17
View File
@@ -141,6 +141,20 @@ export function parseErrorDescriptions(entity) {
return newList.join(', ');
}
// arbitrary node list of form: #ID,#ID,#ID...
function parseWarning20(list) {
var newList = [];
var items = list.split(',');
items.forEach(function(item) {
// ID has # at the front
var id = fillPlaceholder('n' + item.slice(1));
newList.push(id);
});
return newList.join(', ');
}
if (!(entity instanceof krError)) return;
// find the matching template from the error schema
@@ -186,6 +200,9 @@ export function parseErrorDescriptions(entity) {
break;
case '294':
group = parseError294(group);
break;
case '20':
group = parseWarning20(group);
}
} else if (html_re.test(group)) {
// escape any html in non-IDs