Can't specify table macros via var/macro/transclusion

53 views
Skip to first unread message

David Nebauer

unread,
Jan 30, 2019, 6:06:11 PM1/30/19
to TiddlyWiki
I've been unable to specify table classes in the classes pseudo-row from "outside" the table:

Can't do it with a variable:

<$vars varclasses="myclass1 myclass2">

|<
<varclasses>>|k
...

</$vars>

Can't do it with a macro:

\define macroclasses() myclass1 myclass2

|<<macroclasses>>|k
...

Can't do it by transcluding from another tiddler:

|{{tiddlerclasses}}|k
...

I also experimented with a <$text> widget in case wikification was involved, but without success.

It is possible to load a table cell from variables, macros and transclusion, so I assume my problem is that the classes pseudo-row is handled in a special manner. If so, is there a way around that mechanism to load the class names from outside the table?

Note: I realise I can achieve my goal by creating my own class, copying the content of other classes into it, and then adding the new class name directly to the table classes pseudo-row. I'd still like to pursue this possibility, though, if possible...

Mark S.

unread,
Jan 30, 2019, 7:46:58 PM1/30/19
to TiddlyWiki
Move your entire table to a macro:

\define mytable()
|$(myclasses)$|k
|This is a caption |c
|Cell1 |Cell2 |
|Cell3 |Cell3 |
|Header|Header|h
|Footer|Footer|f
\end


And then invoke like:


<$vars myclasses="myclass anotherClass">

<
<mytable>>
</$vars>



Good luck
-- Mark

David Nebauer

unread,
Jan 31, 2019, 6:55:27 AM1/31/19
to TiddlyWiki
Thanks, Mark. That worked!

Sure is cumbersome, though...

Regards,
David.

S. S.

unread,
Jan 31, 2019, 8:05:23 AM1/31/19
to TiddlyWiki

Since both the table pipe |..... | definition and the <<macro...>> invocation are WikiText, I may be mistaken, but this appears to be a failing instance of trying to put WikiText inside WikiText.

Mohammad

unread,
Jan 31, 2019, 8:48:43 AM1/31/19
to TiddlyWiki
Yes,

I may define the macro as below


\define mytable()
<table class="$(myclasses)$">
<caption>This is the table caption</caption>
<thead><tr><td>Header-L</
td><td>Header-R</td></tr></thead>
<tbody>
<tr><td>Cell 1</td><td>Cell 2</td></tr>
<tr><td>Cell 3</td><td>Cell 4</td></tr>
<tr><td>Cell 5</td><td>Cell 6</td></tr>
<tr><td>Cell 7</td><td>Cell 8</td></tr>
</tbody>
<tfoot><tr><td>Footer-L</
td><td>Footer-R</td></tr></tfoot>
\end

Mark S.

unread,
Jan 31, 2019, 9:36:21 AM1/31/19
to TiddlyWiki
Yes, exactly.
Reply all
Reply to author
Forward
0 new messages