So there is some mistake in your copy & paste, which I can't fix without
seeing it.
But for your convenience I'll copy the full working tiddler here:
/*\
title: $:/core/modules/parsers/wikiparser/rules/wikilink.js
type: application/javascript
module-type: wikirule
Wiki text inline rule for wiki links. For example:
```
AWikiLink
AnotherLink
~SuppressedLink
```
Precede a camel case word with `~` to prevent it from being recognised as a
link.
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.name = "wikilink";
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]"
};
var knownLinks = [
"Gropius",
"Bauhaus"
];
textPrimitives.unWikiLink = "~";
textPrimitives.wikiLink = textPrimitives.upperLetter + "+" +
textPrimitives.lowerLetter + "+" +
textPrimitives.upperLetter +
textPrimitives.anyLetter + "*";
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = new RegExp(textPrimitives.unWikiLink + "?(" + +
textPrimitives.wikiLink+"|"+knownLinks.join("|")+")","mg");
};
/*
Parse the most recent match
*/
exports.parse = function() {
// Get the details of the match
var linkText = this.match[0];
// Move past the macro call
this.parser.pos = this.matchRegExp.lastIndex;
// If the link starts with the unwikilink character then just output it
as plain text
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(this.match.index > 0) {
var preRegExp = new RegExp(textPrimitives.anyLetterStrict,"mg");
preRegExp.lastIndex = this.match.index-1;
var preMatch = preRegExp.exec(this.parser.source);
if(preMatch && preMatch.index === this.match.index-1) {
return [{type: "text", text: linkText}];
}
}
return [{
type: "link",
attributes: {
to: {type: "string", value: linkText}
},
children: [{
type: "text",
text: linkText
}]
}];
};
})();
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.