From 6f2c28de6e511fb9fa05bf47195f826d9de7068e Mon Sep 17 00:00:00 2001 From: Kai Labusch Date: Tue, 26 May 2020 12:15:07 +0200 Subject: [PATCH] support multiple disambiguations --- neat.js | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/neat.js b/neat.js index 009667e..437ab85 100644 --- a/neat.js +++ b/neat.js @@ -565,21 +565,32 @@ function setupInterface(data, file, urls) { if (column == 'ID') { fillAction = function(td,content) { - if (String(content).match(/^Q[0-9]+$/g) == null) { + if (String(content).match(/^Q[0-9]+.*/g) == null) { td.text(content); } else { td.html(""); - let link = $('' + - content + "") - link.click( - function(event) { - event.stopPropagation(); - } - ); - - td.append(link); + var reg = /.*?(Q[0-9]+).*?/g; + var result; + let count = 0; + while((element = reg.exec(content)) !== null) { + + if (count > 2) break; + + console.log(element); + let link = $('' + + element[1] + "") + link.click( + function(event) { + event.stopPropagation(); + } + ); + + td.append(link); + td.append($("
")) + count++; + } } } }