The $variable$ variables only work with parameters from the macro -- you 
can't assign them inside the macro.

For variables that you create, you have to use the <<variable>> 
nomenclature, except inside a filter expression in which case you can use 
operator<variable> nomenclature.

Just to confuse things more, inside your macro you could also refer to the 
parameters like this

<<__title__>>  and <<__label__>>

This will get the default the way you want. I'm not sure why you're using 
the text widget instead of just placing the text, but anyways ...

\define mymac(title,label)

<$text text="""Title: $title$"""/>
<br>
<$text text="""Label: $label$"""/>
<br>

<$set name="label" filter="$label$" value="$label$" 
emptyValue="""$title$""">
<$text text="""Title: $title$"""/>
<br>
<$text text="""Label: """/>
<$text text=<<label>>/>

</$set>

\end

<<mymac title:"test" >>



On Monday, November 2, 2020 at 9:53:13 AM UTC-8, Jon Dyer wrote:
>
> I think I'm not understanding something essential about access to 
> variables vs. params in macros and Wikitext. Suppose in a macro I'm writing 
> I want one variable to default to the value of another if it isn't present. 
> I've tried to use the SetWidget to make this work, but no matter what I try 
> I can't seem to overwrite the parameter value with what I have in the 
> <$set...> part. Can you tell what I'm doing wrong?
>
> For a concrete example:
>
> \define mymac(title,label)
>
> <$text text="""Title: $title$"""/>
> <br>
> <$text text="""Label: $label$"""/>
> <br>
>
> <$set name="label" filter="$label$" value="$label$" 
> emptyValue="""$title$""">
> <$text text="""Title: $title$"""/>
> <br>
> <$text text="""Label: $label$"""/>
> </$set>
>
> \end
>
> <<mymac title:"test" label:"hello">>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4084d0e9-6535-4f2a-9772-9fbb76de4cdfo%40googlegroups.com.

Reply via email to