Tiddler Count to dictate HTML table rowspan

93 views
Skip to first unread message

Stuart Amor

unread,
Aug 16, 2018, 10:55:09 AM8/16/18
to TiddlyWiki
I am trying to devise a way where a tiddler tag count dictates the number of merged columns in a table.  The following lines gives me the tiddler tag count:

<$count tiddler="Contents" filter=[tag[Contents]]/>

And I am using the following script example to generate a html table colspan:

<table>
<tr>
<td colspan="3">  3 columns </td>
</tr>
<tr><td> 1 </td><td> 2 </td><td> 3 </td></tr>
</table>Enter code here...

But when I combine the two items...

<table>
<tr>
<td colspan="<$count tiddler="Contents" filter=[tag[Contents]]/>">  <$count tiddler="Contents" filter=[tag[Contents]]/> columns </td>
</tr>
<tr><td> 1 </td><td> 1 </td><td> 1 </td></tr>
</table>

I can't find a way to make the count number within the colspan statement equate to a number.  I have tried macros and everything

Jeremy Ruston

unread,
Aug 16, 2018, 11:03:17 AM8/16/18
to tiddl...@googlegroups.com
Hi Stuart

The trick is to use the wikify widget to render the output of the count widget into a variable, and then to transclude that variable as the value of the colspan attribute. For example:

<$wikify name="count" text="<$count filter='[tag[Contents]]'/>">
<table>
<tr>
<td colspan=<<count>>>
<$count tiddler="Contents" filter=[tag[Contents]]/> columns </td>
</tr>
<tr><td> 1 </td><td> 1 </td><td> 1 </td><td> 1 </td></tr>
</table>
</$wikify>

Best wishes

Jeremy.


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/460d83c2-5b82-4b52-954b-04f51c1fc37b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TonyM

unread,
Aug 17, 2018, 2:10:37 AM8/17/18
to TiddlyWiki
Stuart,

I suggest you follow jeremys suggestion, however your code has a problem you could have noticed. Your Quotes are all over the place

"<$count tiddler="Contents" filter=[tag[Contents]]/>">  <$count tiddler="Contents" filter=[tag[Contents]]/> columns 

See below I how broke it up based on pairs of quotes, as if I was tiddlywiki trying to work out what you were asking.

"<$count tiddler="
Contents
" filter=[tag[Contents]]/>"
>  <$count tiddler=
"Contents"
 filter=[tag[Contents]]/> columns 

Regards
Tony

Mohammad

unread,
Jan 31, 2019, 12:39:56 AM1/31/19
to tiddl...@googlegroups.com
Hi
Is tiddler attribute here added by mistake

<$count tiddler="Contents" filter="[tag[Contents]]"/>


The documentation does not show such attribute for Count Widget!

I think the correct syntax is as below

<$count filter="[tag[Contents]]"/>


--Mohammad

TonyM

unread,
Jan 31, 2019, 2:18:36 AM1/31/19
to TiddlyWiki
But filter in quotes

Mohammad

unread,
Jan 31, 2019, 3:45:55 AM1/31/19
to TiddlyWiki
That's right!

On Thursday, January 31, 2019 at 10:48:36 AM UTC+3:30, TonyM wrote:
But filter in quotes
Reply all
Reply to author
Forward
0 new messages