Hi Paul,
 

> My TiddlySpace inherited ToggleText from a set of spaces included by class 
> projects at my university -- mostly just a set of common plug-ins. The full 
> source of the ToggleText tiddler is as I noted above:
>

Ah, I see. So, pretty straight forward.
 

> Thanks for the help. I think your concept of substituting a variable to 
> change $1 dynamically in a different tiddler that would then call 
> ToggleText makes a lot of sense. However, I don't really see how to 
> implement it.
>

You see, it works just the same as it is done with using *ToggleText*. This 
called *transclusion* and everything after the *with:* parameter in the 
*tiddler* macro defines substitution variables *$1*..*$9*, which is why it 
helps readability to put each on its own line.

As indicated in my last post, you can chain those, so that *A* transcludes 
*B* transcludes *ToggleText*. Whereas *both* ToggleText *and* B function as 
a kind of template to make things more reusable.
 

> I don't understand how to substitute variables into a tiddler directly. Is 
> there way to call a tiddler with specific values for the variables within 
> the tiddler source, equivalent to calling a routine with the variables in 
> parenthesis? Like this in most languages:
>

<<tiddler SomeTiddler with: "foo" "bar" "baz">>

In the above, every occasion in *SomeTiddler* of the following variables 
*$1*..*$3* will be replaced like so...

$1 => foo
$2 => bar
$3 => baz

Now, let's imagine we are actually using such a substitution variable in a 
parameter of the tiddler macro itself...

title: *SomeOtherTiddler*

<<tiddler SomeTiddler with: "mumble $1 gronk" "$2 zonk" "klonk">>

Now, if I use the tiddler in YetAnotherTiddler to transclude 
*SomeOtherTiddler*, then this is what happens...

title: *YetAnotherTiddler*

<<tiddler SomeOtherTiddler with: "frotz" "stronck">>

What is actually passed down to *SomeTiddler*, replaced and then wikified 
in *YetAnotherTiddler *is actually...

$1 => mumble frotz gronk
$2 => stronck zonk
$3 => klonk

Does that make sense?

So, *SomeTiddler* can contain *anything*, a script, just wikitext, whatever 
you want it to... like *ToggleText*.

Best wishes, Tobias.

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to