kookma / TW-Shiraz

Shiraz is a small Tiddlywiki 5 plugin contains macros, stylesheets, templates, snippets, images, static tables, dynamic tables and acts as a starter kit.
https://kookma.github.io/TW-Shiraz/
81 stars 8 forks source link

Using another macro output as input for Shinraz plugin input #35

Closed dezii98 closed 1 year ago

dezii98 commented 1 year ago

Hi I'm staring to learn Tiddlywiki. I have found your plugin and love it so far Here I take one of your example and I want to display it in table

\define theme() primary secondary success warning danger info light dark

<table>
    <$list filter="[enlist<theme>]" variable=__curtheme__>
    <tr>
        <td><<__curtheme__>></td>
        <td><<badge type:"<<__curtheme__>>" src:"<<__curtheme__>> badge">></td>
    </tr>
    </$list>
</table>

When paste it to Tiddlywiki, you can see that only the text of badge is render, the badge itself isn't however. Can you tell me this is because of Tiddlywiki mechanic, the plugin or my code wasn't proper.

Thank you very much!

kookma commented 1 year ago

Hi @dezii98

There is some error in your code. The reason is you cannot pass a variable like <> to a macro using param:<>. You should use $macrocall.

Try this one (very close to yours)

\define theme() primary secondary success warning danger info light dark
\define mybadge() <<badge type:"$(curtheme)$" src:"$(curtheme)$ badge">>

<table>
    <$list filter="[enlist<theme>]" variable=curtheme>
    <tr>
        <td><<curtheme>></td>
        <td><<mybadge>></td>
    </tr>
    </$list>
</table>

I recommend posting your question here: talk.tiddlywiki.org Many super users may propose different solutions.

dezii98 commented 1 year ago

@kookma

Thank you for your response! I didn't know we have a place to discuss about tiddlywiki

Thank you and have a nice day!