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
1 changed files with 3 additions and 2 deletions

View File

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