mirror of
https://github.com/FoggedLens/iD.git
synced 2026-04-21 19:26:41 +02:00
Fix parsing of error type 211
This commit is contained in:
committed by
Bryan Housel
parent
2b1e37ab78
commit
005927dae3
+1
-1
@@ -1067,7 +1067,7 @@ en:
|
||||
description: 'These errors contain self intersecting ways.'
|
||||
_211:
|
||||
title: ''
|
||||
description: 'This way contains more than one node multiple times. Nodes are {var1}, {var2}. This may or may not be an error.'
|
||||
description: 'This way contains more than one node multiple times. Nodes are {var1}. This may or may not be an error.'
|
||||
_212:
|
||||
title: ''
|
||||
description: 'This way has only two different nodes and contains one of them more than once.'
|
||||
|
||||
Vendored
+1
-1
@@ -1312,7 +1312,7 @@
|
||||
},
|
||||
"_211": {
|
||||
"title": "",
|
||||
"description": "This way contains more than one node multiple times. Nodes are {var1}, {var2}. This may or may not be an error."
|
||||
"description": "This way contains more than one node multiple times. Nodes are {var1}. This may or may not be an error."
|
||||
},
|
||||
"_212": {
|
||||
"title": "",
|
||||
|
||||
@@ -195,9 +195,8 @@
|
||||
},
|
||||
"_211": {
|
||||
"title": "",
|
||||
"description": "This way contains more than one node at least twice. Nodes are #(\\d+), ((?:#\\d+(?:, )?)+)\\. This may or may not be an error",
|
||||
"IDs": ["n"],
|
||||
"TODO": "Second group is arbitrary list of node IDs in form: #ID, #ID, #ID...",
|
||||
"description": "This way contains more than one node at least twice\\. Nodes are ((?:#\\d+(?:, )?)+)\\. This may or may not be an error",
|
||||
"IDs": ["211"],
|
||||
"regex": true
|
||||
},
|
||||
"_212": {
|
||||
|
||||
@@ -71,7 +71,21 @@ export function parseErrorDescriptions(entity) {
|
||||
|
||||
function fillPlaceholder(d) { return '<span><a class="kr_error_description-id">' + d + '</a></span>'; }
|
||||
|
||||
// arbitrary list of form: #ID(layer),#ID(layer),#ID(layer)...
|
||||
// arbitrary node list of form: #ID, #ID, #ID...
|
||||
function parseError211(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(', ');
|
||||
}
|
||||
|
||||
// arbitrary way list of form: #ID(layer),#ID(layer),#ID(layer)...
|
||||
function parseError231(list) {
|
||||
var newList = [];
|
||||
var items = list.split(',');
|
||||
@@ -123,18 +137,25 @@ export function parseErrorDescriptions(entity) {
|
||||
// index 0 is the whole match, skip it
|
||||
if (!index) return;
|
||||
|
||||
// Clean and link IDs if present in the group
|
||||
// link IDs if present in the group
|
||||
idType = 'IDs' in errorTemplate ? errorTemplate.IDs[index-1] : '';
|
||||
if (idType) {
|
||||
// some errors have more complex ID lists/variance
|
||||
if (idType === '231') {
|
||||
group = parseError231(group);
|
||||
} else if (['n','w','r'].includes(idType)) {
|
||||
switch (idType) {
|
||||
// simple case just needs a linking span
|
||||
group = fillPlaceholder(idType + group);
|
||||
case 'n':
|
||||
case 'w':
|
||||
case 'r':
|
||||
group = fillPlaceholder(idType + group);
|
||||
break;
|
||||
// some errors have more complex ID lists/variance
|
||||
case '211':
|
||||
group = parseError211(group);
|
||||
break;
|
||||
case '231':
|
||||
group = parseError231(group);
|
||||
}
|
||||
} else if (html_re.test(group)) {
|
||||
// escape any html
|
||||
// escape any html in non-IDs
|
||||
group = '\\' + group + '\\';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user