Hi,
may I suggest a small extension to the PrettyLink:
Currently we may have links like
[[label text|tiddler or externalRef]]
I suggest to allow a third (optional) parameter that defines an external
link, in case a tiddler given at second place does not exists (or has no
shadow).
Example:
[[Documentation|ForEachTiddlerDocumentation|http://tiddlywiki.abego-software.de/#ForEachTiddlerDocumentation]]
Some motivation:
when writing a plugin you try to keep the size of the plugin as small as
possible. Therefore it is a frequently used approach to put
documentation, examples etc. into separate tiddlers that are then
referenced from the plugin tiddler (e.g. in a "Documentation" field in
the header). So a user may decide to get just the plugin without
documentation to keep his TW small.
To give him a chance to still read the documentation one often creates a
shadow tiddler with the same name as the (e.g.) documentation tiddler
that then refers to the documentation on the web:
ForEachTiddlerDocumentation
--------------------
Find the complete documentation
[[here|http://tiddlywiki.abego-software.de/#ForEachTiddlerDocumentation]].
This approach work fine but has some drawbacks:
1) the plugin must be loaded to initialize the shadow tiddler with the
reference to the documentation.
2) A shadow tiddler must be created for every such "tiddler with
external backup"
3) To access the external reference the user is first navigate to the
shadow tiddler and then he again has to click a link to get the actual
documentation.
With the suggested extension these problems are gone.
Here the required code change (in Formatter.js, "prettyLink")
else if(lookaheadMatch[3]) // Pretty bracketted link
{
var link = lookaheadMatch[4];
* var i = link.indexOf("|");
if (i)
{
var s = link.substr(0,i);
link = (store.getTiddler(s) ||
store.isShadowTiddler(s)) ? s : link.substr(i+1);
}
* e = config.formatterHelpers.isExternalLink(link) ?
createExternalLink(w.output,link) : createTiddlyLink(w.output,link,false);
}
createTiddlyText(e,text);
Of cause the usage of this kind of link is not restricted to
documentation tiddlers, but also for things like copyright, licence etc.
Udo
----------
Udo Borkowski
http://www.abego-software.de