Hi Tobias

> I was wondering how difficult it might be to extend the set widget so as
> to allow a default value as a fallback for when the value is actually
> undefined:
>

The trouble is that in many situations an empty string is a valid value
that shouldn't be defaulted; what we really want here is a way to detect
missing parameters.



\define tagging(title)
<$set name="tid" value=$title$ default="<<currentTiddler>>">
<$list filter="[[<<tid>>]tagging[]]"/>
\end

This example wouldn't work for a title containing spaces. Bear in mind that
macro parameters are processed with text substitution, so passing "Hello
There" as a title gives you value=Hello There, which won't work as
expected. The fix is to use quotes; triple quotes are recommended because
that allows titles to contain single or double quotes.

<$set name="tid" value="""$title$""">

Best wishes

Jeremy.



>
> \define tagging(title)
> <$set name="tid" value=$title$ default="<<currentTiddler>>">
> <$list filter="[[<<tid>>]tagging[]]"/>
> \end
>
> I am not sure if that would help or be the correct syntax, the latter
> mostly thanks to me not quite being able to decipher the documentation for
> variables on tiddlywiki.com.
>
> Best wishes, Tobias.
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to