In procedure, how apply argument as a div class?

Like a chicken, I have thus far made a run for macros in the following situation, nervously hiding from procedures that I don’t know how to apply here. But, the time has come for the chicken to grab the bull by its horns. Yes, clearly a good idea.

With the code below, I want to color RED red. But the <<class>> syntax does not correctly access the parameter here. Nor do I succeed using backticks or $class$ etc. What is the magic combo of characters that I need to use?

\procedure applyclass(class) <div class="anotherclass <<bg>>"> RED </div>

<<applyclass bg>>

<style>.bg {background:red;} </style>

Thank you!

1 Like
\procedure applyclass(class) <div class=`anotherclass $(class)$`> RED </div>

See https://tiddlywiki.com/#Substituted%20Attribute%20Values

2 Likes

Thanks! (Ooufff - I cudda sworn I tried that because I did read that doc.)

To remember it:

  • the backticks are clearly delimiters replacing the regular quotes in the class="..." attribute
  • the $()$ syntax is the same as when macros refer to an external variable (instead of a local param).