1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-23 13:53:15 +00:00

Remove support for underscore and dash in wikilinks

Starting to fix #337
This commit is contained in:
Jermolene 2014-08-08 11:13:41 +01:00
parent bd92dc3692
commit d7390dbbe1
2 changed files with 8 additions and 4 deletions

View File

@ -25,9 +25,8 @@ exports.types = {inline: true};
var textPrimitives = {
upperLetter: "[A-Z\u00c0-\u00de\u0150\u0170]",
lowerLetter: "[a-z0-9_\\-\u00df-\u00ff\u0151\u0171]",
anyLetter: "[A-Za-z0-9_\\-\u00c0-\u00de\u00df-\u00ff\u0150\u0170\u0151\u0171]",
anyLetterStrict: "[A-Za-z0-9\u00c0-\u00de\u00df-\u00ff\u0150\u0170\u0151\u0171]"
lowerLetter: "[a-z0-9\u00df-\u00ff\u0151\u0171]",
anyLetter: "[A-Za-z0-9\u00c0-\u00de\u00df-\u00ff\u0150\u0170\u0151\u0171]"
};
textPrimitives.unWikiLink = "~";
@ -56,7 +55,7 @@ exports.parse = function() {
}
// If the link has been preceded with a letter then don't treat it as a link
if(this.match.index > 0) {
var preRegExp = new RegExp(textPrimitives.anyLetterStrict,"mg");
var preRegExp = new RegExp(textPrimitives.anyLetter,"mg");
preRegExp.lastIndex = this.match.index-1;
var preMatch = preRegExp.exec(this.parser.source);
if(preMatch && preMatch.index === this.match.index-1) {

View File

@ -45,6 +45,11 @@ describe("WikiText tests", function() {
it("should support attributes specified as macro invocations", function() {
expect(wiki.renderTiddler("text/html","TiddlerFour")).toBe("<p><a class='tw-tiddlylink tw-tiddlylink-missing' href='#This%20is%20my%20''amazingly''%20groovy%20macro!'>This is a link</a></p>");
});
it("should identify wikiwords to automatically link", function() {
expect(wiki.renderText("text/html","text/vnd-tiddlywiki","No wikilinks here").indexOf("<a") !== -1).toBe(false);
expect(wiki.renderText("text/html","text/vnd-tiddlywiki","One WikiLink here").indexOf("<a") !== -1).toBe(true);
expect(wiki.renderText("text/html","text/vnd-tiddlywiki","No Wiki-Link here").indexOf("<a") !== -1).toBe(false);
});
});