1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-10-31 15:16:18 +00:00

Simplify freelinks regexp

As discussed here: https://github.com/Jermolene/TiddlyWiki5/issues/6029#issuecomment-917612980
This commit is contained in:
jeremy@jermolene.com 2021-09-14 10:22:27 +01:00
parent e9e5d37ff0
commit f725123690

View File

@ -81,12 +81,13 @@ TextNodeWidget.prototype.execute = function() {
$tw.utils.each(sortedTitles,function(title) { $tw.utils.each(sortedTitles,function(title) {
if(title.substring(0,3) !== "$:/") { if(title.substring(0,3) !== "$:/") {
titles.push(title); titles.push(title);
reparts.push("(\\b" + $tw.utils.escapeRegExp(title) + "\\b)"); reparts.push("(" + $tw.utils.escapeRegExp(title) + ")");
} }
}); });
var regexpStr = "\\b(?:" + reparts.join("|") + ")\\b";
return { return {
titles: titles, titles: titles,
regexp: new RegExp(reparts.join("|"),ignoreCase ? "i" : "") regexp: new RegExp(regexpStr,ignoreCase ? "i" : "")
}; };
}); });
// Repeatedly linkify // Repeatedly linkify