This is not an elegant solution and not semantic, but works! \define spanmac(text) <span style="color:$(myColor)$;"> $text$ </span> \end
\define mymacro(c:"", text) <$list filter="[enlist[$c$ $(vc)$]limit[1]]" variable=myColor> <<spanmac """$text$""">> </$list> \end <$vars vc="red" > ;Test one, no color sent :<<mymacro text:"Hi, I am red!">> ;Test two :<<mymacro c:blue text:"Hi, I am blue!">> </$vars> The vc has a default red color, so if you call the mymacro without c parameter, the default value here red is used! If you pass c parameter, then it used! Try above code inside tiddlywiki.com --Mohammad On Sunday, March 31, 2019 at 10:15:44 AM UTC+4:30, RA wrote: > > Yes, but I'd like `c` to have a default value, and I'd like to define that > default not as a literal color value, but via a variable. Can you do that? > > On Saturday, March 30, 2019 at 10:12:41 PM UTC-7, Mohammad wrote: >> >> Why noy use something like this >> >> \define mymacro(c, text) >> <span style="color:$c$"> >> $text$ >> \end >> >> Then use it as >> >> <<mymacro blue "Hi, I am blue!">> >> >> >> >> >> On Sunday, March 31, 2019 at 8:29:26 AM UTC+4:30, RA wrote: >>> >>> Is it possible? I want to do something like this: >>> >>> \define mymacro(c:variable_for_color) <span style= >>> "color:variable_for_color"/> >>> >>> So, there are 3 questions here really: defining a variable before >>> defining a macro, using variable as a macro parameter default, and using >>> variable inside html tag. >>> >> -- 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 https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/a6dfea21-a7f6-4b36-8332-700b1a3f514b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

