Hello everyone.
I’m trying to use a single macro to create all the Admonitions variants that require six macros in the add-on I created.
To do this, I created two additional parameters: styles (whose values would be lateral or lateralb) and dropdown (with the value details).
Following @Scott_sauyet’s advice, I transformed the macro into a procedure, and everything seems to work except I can’t get the class to have the value I want. This also happens with the normal macro.
This is the code I’m using:
\procedure callout2(type:"note", src, title, width:"100%", class)
<$let theme-class = {{{ [[$:/palette]get[text]get[color-scheme]else[light]addprefix[theme-]] }}}
callout-title = {{{ [<title>!is[blank]] :else[<type>titlecase[]] }}}
callout-style = {{{ [<style>!is[blank]then[<style>]] }}}
icon-tiddler = {{{ [all[tiddlers+shadows]tag[$:/tags/TimitAdmonitions/Image]contains:callout-type<type>]
:else[[$:/plugins/timit/admonitions/images/note]] }}}
source = {{{ [<src>get[text]else<src>] }}} >
<div class=<<theme-class>> style=`width:$(width)$`>
<div data-callout=<<type>> class=`callout <<callout-style>>`>
<div class="callout-title">
<div class="callout-icon"><$transclude tiddler=<<icon-tiddler>> field=text/></div>
<div class="callout-title-inner"><<callout-title>></div>
</div>
<$list filter="[<src>!is[blank]]" variable=ignore>
<div class="callout-content">
<$transclude tiddler=<<source>> field=title mode=block />
</div>
</$list>
</div>
</div>
</$let>
\end callout2
In this example, I’m just using one new parameter, callout-styles.
For some reason, it doesn’t create the class correctly. I’ve tried everything: ``, " ", {{{ }}}, using +[join[]], etc…, but it always ends up wrong.
class=`callout <<callout-style>>`>
If I separate callout from callout-style in this code: class="callout <> ", the admonition appears, but with the callout class, if I put it all together, the admonition doesn’t get any style.
I’m sure it’s something obvious, but I can’t figure it out. I’ve been reviewing the documentation, but I’m getting really confused and can’t figure anything out. The AI tells me everything’s fine, but I know it’s failing a lot…
Does anyone know what I’m doing wrong?
Best regards, and thanks.