copied from another thread:
> Just discovered the new MissingTiddlersPlugin on your site:
>
http://www.tiddlytools.com/#MissingTiddlersPlugin
>
> However, from the Documentation it's not that clear how it could be
> use for redirecting to an alternative existing tiddler. Though in the
> usage section it describes using: <<missingTiddler [[title]] [[list]]
> [[fallback]]>>, however I can't find a working example of this macro,
> but the [[MissingTiddlersList]] instead, where an altenative message
> could be defined.
This plugin uses a very subtle trick to invoke the <<missingTiddler>>
macro:
The core defines built-in fallback content that is displayed if a
tiddler doesn't exist.
This text is stored in a core internal variable:
config.views.wikified.defaultText
with a default value of:
"The tiddler '%0' doesn't yet exist. Double-click to create it"
MissingTiddlersPlugin changes this default value to:
<<missingTiddler [[%0]]>>
as a result, when the core renders the fallback, it invokes
<<missingTiddler>> instead of simply displaying the standard message.
The macro then attempts to match the desired title against a list of
regexp-based 'title patterns'. Each pattern is specified using the TW
section syntax, where the name of the section is the pattern, and the
body of the section is the replacement content if that pattern is
matched.
The plugin also defines a shadow tiddler named [[MissingTiddler]]
which provides an easy way to customize the generic fallback message.
If a missing tiddler's title does not match any of the listed
patterns, or if there is no [[MissingTiddlersList]], then the content
from [[MissingTiddler]] is used.
Note: When directly viewing the MissingTiddlerList tiddler itself, you
can prevent any macros or scripts contained within the replacement
text from being rendered by enclosing a section's content within
{{{...}}}. When the text is *applied* (by matching a missing tiddler
title), any initial "{{{" and trailing "}}}" will be removed from the
output, so that the section content is rendered normally at that time.
> How would it be possible to also create redirects to existing
> tiddlers?
Sorry, no. Here's why:
MissingTiddlersPlugin is providing alternative fallback content for
the core to use when it needs to display a missing tiddler. This is
similar to the way that the core uses the config.shadowTiddler[...]
definitions to provide fallback content for key system tiddlers.
The plugin simply adds the ability to select the desired fallback text
from a configurable, tiddler-based list of possibilities, based on
pattern matching, rather than the hard-coded names used by the
shadowTiddler[...] data.
Thus, MissingTiddlersPlugin isn't really 'redirecting' to another
tiddler and, because existing tiddlers don't use the value stored in
config.views.wikified.defaultText, they will *never* trigger the
<<missingTiddler>> macro.
Also note that, because the default text is only used when attempting
to *display* a missing tiddler, the plugin does *not* apply to tiddler
transclusions (e.g., <<tiddler SomeMissingTitle>>), nor will it change
the use of core functions: store.tiddlerExists(), store.getTiddler(),
or store.getTiddlerText().
One really interesting result *can* be produced by using
MissingTiddlersPlugin is a kind of 'load-on-demand' mechanism... If
you have LoadTiddlersPlugin installed, and the fallback content for a
given tiddler title (or title pattern) is something like:
<<loadTiddlers [[tiddler:%0]] [[http://...]] quiet nodirty noreport
temporary>>
then displaying that missing tiddler will automatically trigger an
attempt to load it from the remote URL!
You can see kind of handling on TiddlyTools when you try to view a FAQ
tiddler. To save space, all the TiddlyTools FAQ articles were moved
to an external 'archive', faq.html. Then, when you try to view a
tiddler whose title starts with "FAQ_", the MissingTiddlerPlugin kicks
in and triggers the [[GetTheFAQs]] script, which, after asking,
invokes the <<loadTiddlers>> macro to pull in the FAQ articles *on
demand*.
enjoy,
-e