Mohammad, Since we are using the parameter *c* as a variable, we have to define its value as a variable first. So if we wanted to pass the value *red* to the parameter *c*, we first have to define the variable *red*. In this case we give the variable *red* the value *red* also. Then it will work, as shown below.
\define myhelper(h) <span style="color:$h$"/> \define mymacro(c:"variable_for_color") <$macrocall $name="myhelper" h=<<$c$ >>/> <$set name="variable_for_color" value="blue"> a <<mymacro>> b </$set> <$set name="red" value="red"> c <<mymacro red>> d </$set> Results in HTML produced: a <span style="color:blue"></span> b </p><p> c <span style="color:red"></span> d </p> Regards. On Sunday, March 31, 2019 at 7:28:16 PM UTC+7, Mohammad wrote: > > Why this does not work? > > <$set name="variable_for_color" value="blue"> > a <<mymacro>> b > > c <<mymacro red>> d > </$set> > > > It produces > > > <p> a <span style="color:blue"></span> b c <span style="color:"></span> d > </p> > > > > On Sunday, March 31, 2019 at 3:49:19 PM UTC+4:30, S. S. wrote: >> >> RA, >> >> See if this works for you: >> \define myhelper(h) <span style="color:$h$"/> >> \define mymacro(c:"variable_for_color") <$macrocall $name="myhelper" h=<< >> $c$>>/> >> >> <$set name="variable_for_color" value="blue"> >> a <<mymacro>> b >> </$set> >> >> Inspecting the underlying HTML gives: >> <p> >> a <span style="color:blue"></span> b >> >> </p> >> >> Cheers >> >> >> On Sunday, March 31, 2019 at 10:59:26 AM UTC+7, 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/37793e13-677d-4b81-979d-af1a54218f56%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

