Hi,

I'm using a template that needs a variable to be set.
So the tiddler "Gronk" calling the template looks like :

<$set name="somevariable" value="Baz">

{{Gronk||Template}}
</$set>

I'd like to have a default value defined for "somevariable" so that a 
direct call without setting the variable works :

{{Gronk||Template}}

I've tried to define the default value inside the template like this :

<$set name="somevariable1" filter=<<somevariable>> value=<<somevariable>> 
emptyValue="Default">
... template code ...
</$set>

When "somevariable" is defined outside the template (in the calling 
tiddler) it's OK. But when I call {{Gronk||Template}} it appears 
"somevariable" is not set to the default value.

I've found a workaround. In the template I put the following code :

\define myFilter() foobar$(sometext)$ +[removesuffix[foobar]]

<$set name="somevariable1" filter=<<myFilter>> value="Default" 
emptyValue=<<somevariable>>>
... template code ...
</$set>

I was wondering if there were a simple way of defining default values for 
variables inside templates.

Any ideas ?

Thanks

FrD

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e4a8ba08-9a9e-41ee-b9a0-7b675f173b53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to