mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-04 13:19:11 +00:00
Remove support for underscore and dash in wikilinks
Starting to fix #337
This commit is contained in:
parent
bd92dc3692
commit
d7390dbbe1
@ -25,9 +25,8 @@ exports.types = {inline: true};
|
|||||||
|
|
||||||
var textPrimitives = {
|
var textPrimitives = {
|
||||||
upperLetter: "[A-Z\u00c0-\u00de\u0150\u0170]",
|
upperLetter: "[A-Z\u00c0-\u00de\u0150\u0170]",
|
||||||
lowerLetter: "[a-z0-9_\\-\u00df-\u00ff\u0151\u0171]",
|
lowerLetter: "[a-z0-9\u00df-\u00ff\u0151\u0171]",
|
||||||
anyLetter: "[A-Za-z0-9_\\-\u00c0-\u00de\u00df-\u00ff\u0150\u0170\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]"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
textPrimitives.unWikiLink = "~";
|
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 the link has been preceded with a letter then don't treat it as a link
|
||||||
if(this.match.index > 0) {
|
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;
|
preRegExp.lastIndex = this.match.index-1;
|
||||||
var preMatch = preRegExp.exec(this.parser.source);
|
var preMatch = preRegExp.exec(this.parser.source);
|
||||||
if(preMatch && preMatch.index === this.match.index-1) {
|
if(preMatch && preMatch.index === this.match.index-1) {
|
||||||
|
@ -45,6 +45,11 @@ describe("WikiText tests", function() {
|
|||||||
it("should support attributes specified as macro invocations", 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>");
|
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);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user