Hello everyone.
I’m having a problem generating the Admonitions macro with the details element and the “open” status.
If I do it with normal macro syntax, everything works as it should.
Sample code:
\define callout(type:"note", src, title, model, status, 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-model = {{{ [<__model__>!is[blank]addprefix[-]] }}}
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$;">
<details data-callout=<<__type__>>class={{{ [[callout]addsuffix<callout-model>] }}} $status$>
<summary class="callout-title">
<div class="callout-icon"><$transclude tiddler=<<icon-tiddler>> field=text/></div>
<div class="callout-title-inner"><<callout-title>></div>
<div class="callout-fold">{{$:/plugins/timit/admonitions/images/chevron}}</div>
</summary>
<div class="callout-content">
<$transclude tiddler=<<source>> field=title mode=block />
</div>
</details>
</div>
</$let>
\end callout
But if I do it with procedure syntax, it no longer works, and the status value is passed correctly, according to what I’ve seen in the documentation and other threads discussing this case.
This is the code I’m using:
\procedure callout(type:"note", src, title, model, status, 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-model = {{{ [<model>!is[blank]addprefix[-]] }}}
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$;">
<details data-callout=<<type>> class=`callout$(callout-model)$` $(status)$ >
<summary class="callout-title">
<div class="callout-icon"><$transclude tiddler=<<icon-tiddler>> field=text/></div>
<div class="callout-title-inner"><<callout-title>></div>
<div class="callout-fold">{{$:/plugins/timit/admonitions/images/chevron}}</div>
</summary>
<div class="callout-content">
<$transclude tiddler=<<source>> field=title mode=block />
</div>
</details>
</div>
</$let>
\end callout
This is to find out what the problem is, since macros using the old method work perfectly for me. But I tried doing it with procedures to document it, and I ran into this problem.
Since I’m not sure if I’m making a mistake, due to my lack of programming knowledge, I’ve tried following other examples I’ve seen to do a “creative” programming exercise. But it didn’t work for me either.
I’ll leave the alternative suggestions here:
<details data-callout={{{ <<type>> class=`callout$(callout-model)$` [<status>mach[open]then[open]] +[join[ ]] }}}
<details data-callout=<<type>> {{{class=`callout$(callout-model)$` [<status>mach[open]then[open]] +[join[ ]] }}}>
<details data-callout=<<type>> class=`callout$(callout-model)$` [<status>mach[open]then[open]] >
Best regards
