diff --git a/core/modules/parsers/wikiparser/rules/wikilink.js b/core/modules/parsers/wikiparser/rules/wikilink.js index 7be9a5f0e..f4b543896 100644 --- a/core/modules/parsers/wikiparser/rules/wikilink.js +++ b/core/modules/parsers/wikiparser/rules/wikilink.js @@ -26,7 +26,8 @@ exports.types = {inline: true}; var textPrimitives = { upperLetter: "[A-Z\u00c0-\u00d6\u00d8-\u00de\u0150\u0170]", lowerLetter: "[a-z0-9\u00df-\u00f6\u00f8-\u00ff\u0151\u0171]", - anyLetter: "[A-Za-z0-9\u00c0-\u00d6\u00d8-\u00de\u00df-\u00f6\u00f8-\u00ff\u0150\u0170\u0151\u0171]" + anyLetter: "[A-Za-z0-9\u00c0-\u00d6\u00d8-\u00de\u00df-\u00f6\u00f8-\u00ff\u0150\u0170\u0151\u0171]", + blockPrefixLetters: "[A-Za-z0-9\-_\u00c0-\u00d6\u00d8-\u00de\u00df-\u00f6\u00f8-\u00ff\u0150\u0170\u0151\u0171]" }; textPrimitives.unWikiLink = "~"; @@ -53,9 +54,9 @@ exports.parse = function() { if(linkText.substr(0,1) === textPrimitives.unWikiLink) { return [{type: "text", text: linkText.substr(1)}]; } - // If the link has been preceded with a letter then don't treat it as a link + // If the link has been preceded with a blocked letter then don't treat it as a link if(this.match.index > 0) { - var preRegExp = new RegExp(textPrimitives.anyLetter,"mg"); + var preRegExp = new RegExp(textPrimitives.blockPrefixLetters,"mg"); preRegExp.lastIndex = this.match.index-1; var preMatch = preRegExp.exec(this.parser.source); if(preMatch && preMatch.index === this.match.index-1) { diff --git a/editions/test/tiddlers/tests/test-wikitext.js b/editions/test/tiddlers/tests/test-wikitext.js index c252ddffc..271688cee 100644 --- a/editions/test/tiddlers/tests/test-wikitext.js +++ b/editions/test/tiddlers/tests/test-wikitext.js @@ -51,6 +51,9 @@ describe("WikiText tests", function() { expect(wiki.renderText("text/html","text/vnd-tiddlywiki","No Wiki-Link here").indexOf("