Here's a random thought that just popped into my head:
It'd be nice if you could use templates similar to what's possible with
the MediaWiki engine.
I know that simple transclusion is possible using the <<tiddler>> macro,
but there's no way to use parameters with that (AFAIK).
For example, say I keep track of quotes a lot, and they'd always be in
the following format:
<<<
[quote]
<<<
{{source{[author]}}}
So I'd create a tiddler "quoteTemplate" with that content, and could use
<<template quoteTemplate "This is a quote." "me">>
to ensure that quotes are consistently formatted.
This would, of course, be less crucial for TiddlyWiki than for "proper"
wiki engines (like MediaWiki), but it might still be a nice thing to have...
-- F.
Anyway, you can in fact use parameters with the <<tiddler>> macro. For
instance, if you have a tiddler called HelloThere with the text "Hello
\0 and \1", in another tiddler you can use the macro call <<tiddler
HelloThere with:"Jeremy" "Danny">> to display the text "Hello Jeremy
and Danny".
Cheers
Jeremy
--
Jeremy Ruston
mailto:jer...@osmosoft.com
http://www.tiddlywiki.com
> Gosh, I've just realised that the <<tiddler>> macro is currently
> undocumented, whoops.
I'd actually looked up the tiddler macro before posting this, but
couldn't find any documentation - so I just assumed it didn't accept any
parameters other than the tiddler name...
> Anyway, you can in fact use parameters with the <<tiddler>> macro.
That's awesome!!
However ...
> For instance, if you have a tiddler called HelloThere with the text "Hello
> \0 and \1", in another tiddler you can use the macro call <<tiddler
> HelloThere with:"Jeremy" "Danny">> to display the text "Hello Jeremy
> and Danny".
... this doesn't seem to work for me.
Starting with an empty TW, I did exactly as you described. But all I get
from the macro call is "Hello \0 and \1" - so the parameters are not
expanded.
I've also tried a couple of variations (omitting "with:", using just a
single parameter etc.), but I can't get it working!?
-- F.
For instance, if you have a tiddler called HelloThere with the text "Hello
$0 and $1", in another tiddler you can use the macro call <<tiddler
HelloThere with:"Jeremy" "Danny">> to display the text "Hello Jeremy
and Danny".
Cheers
Jeremy
On 3/21/07, FND <Ace_...@gmx.net> wrote:
>
D'oh - I could've thought about the proper variable notation myself!
However, there's another mistake; seems like the array(?) is one-based,
not zero-based. So it should be something like this:
QuoteTemplate:
<<<
$1
<<<
{{{$2}}}
usage:
<<tiddler QuoteTemplate with:"The quote." "The source.">>
Anyways, thank you so much!
-- F.
Just a quick note, for whoever is interested:
If you want to use a template tiddler's References list to check which
tiddlers are using said template, you should enclose the transcluded
tiddler in [[brackets]], like this:
<<tiddler [[templateTiddler]] with: ... >>
(probably not required if "templateTiddler" was a CamelCase title)
-- F.
> probably not required if "templateTiddler" was a CamelCase title
That's correct - which is why I've just changed my templates' names from
"tName" to "TemplateName".
That's a lot easier now, and a lot less error-prone too (I'd never
remember to manually put the brackets... ).
-- F.