Dynamic class

38 views
Skip to first unread message

Thomas Schnetzer

unread,
Jan 22, 2022, 10:04:12 PM1/22/22
to TiddlyWiki
Hello
I try to make a tabs with a dynamic changeable class tc-vertical and tc-horizontal.
I tried many things the simplest are this two but they didn't work.
The $tName$ works but class seems to use another render path.

<$macrocall $name="tabs" tabsList="""[tag[$tName$]nsort[order]]""" class="""$alignment$""" />
<$macrocall $name="tabs" tabsList="""[tag[$tName$]nsort[order]]""" class="""<<alignment>>""" />

This generate this HTML code in firefox:

<div class="tc-tab-buttons <<alignment>>">
or
<div class="tc-tab-buttons $alignment$">

Can anyone  help to get this working.

Thanks
Thomas

Mark S.

unread,
Jan 22, 2022, 10:10:54 PM1/22/22
to TiddlyWiki
```
We need to see more of your code.

Syntax like $something$ only works inside a macro. So what are the parameters of the macro? And how is the macro called? 

Likewise, a notation like <<alignment>> represents a macro or variable, which has to be defined. If you have such a variable, how is it defined?

```

Thomas Schnetzer

unread,
Jan 23, 2022, 4:29:55 AM1/23/22
to TiddlyWiki
Hello Marc
I tested this only the last Test shows the Tabs Vertical
Thanks for your help.

```
\define testFunction(alignmentTabs:"", tName:"" )
Second Test: <<alignmentTabs>>,$alignmentTabs$

<$macrocall $name="tabs" tabsList="[tag[$tName$]nsort[order]]" class="""$alignmentTabs$""" />

\end

\define dynamicTabs(current:"", tName:"" )

<$set name="alignmentTabs" value="tc-vertical" >
First Test: <<alignmentTabs>>,$alignmentTabs$

<$macrocall $name="tabs" tabsList="""[tag[$tName$]nsort[order]]""" class="""<<alignmentTabs>>""" />
<br/>
<$macrocall $name="testFunction" alignmentTabs="""<<alignmentTabs>>""" tName="""$tName$""" />
<br/>

Last Test:
<$macrocall $name="tabs" tabsList="""[tag[$tName$]nsort[order]]""" class="tc-vertical" />
</$set>
''
\end

<$macrocall $name="dynamicTabs" current=<<currentTiddler>> tName="TableOfContents"/>
```

Eric Shulman

unread,
Jan 23, 2022, 4:41:15 AM1/23/22
to TiddlyWiki
Remove the quotes around `"""<<alignmentTabs>>"""`.  Like this:
```
<$macrocall $name="tabs" tabsList="""[tag[$tName$]nsort[order]]""" class=<<alignmentTabs>> />
<br/>
<$macrocall $name="testFunction" alignmentTabs=<<alignmentTabs>> tName="""$tName$""" />
<br/>
```

Thomas Schnetzer

unread,
Jan 23, 2022, 10:09:14 AM1/23/22
to TiddlyWiki
Many thanks this works!
Reply all
Reply to author
Forward
0 new messages