How to split $list by 3 items?

126 views
Skip to first unread message

Archizona V

unread,
Jan 23, 2018, 3:11:10 AM1/23/18
to TiddlyWiki
Hi! I have ten tiddlers with tag 'test' and titles 1 2 3 4...
So I make <$list filter="[tag[text]]/> I see my list 1 2 3 4 5...
How can I separate every 3 items by symbol '|' to get this list

1 2 3|4 5 6|7 8 9|10

TonyM

unread,
Jan 23, 2018, 8:11:17 AM1/23/18
to TiddlyWiki
The listops widget and the filter operator limit[3] may get you there

Tony

Mark S.

unread,
Jan 23, 2018, 10:12:56 AM1/23/18
to TiddlyWiki
<$vars lst="X 1 2 3 4 5 6 7 8 9 10" >
<$list filter="X 3 6 9">
<$list filter="[enlist
<lst>]  +[allafter<currentTiddler>limit[3]]">
<
<currentTiddler>>
</$list>|</$list>
</$vars>

Mat

unread,
Jan 23, 2018, 11:57:53 AM1/23/18
to TiddlyWiki
The best solution is probably to use CSS... something along the lines of:

.myelement nth-of-type(3):after {
content:"|";
}

Sorry I don't have time to be more detailed or to try it.

<:-)

Mark S.

unread,
Jan 23, 2018, 12:59:18 PM1/23/18
to TiddlyWiki
Mat is like a CSS wizard. I wouldn't have thought of doing it this way. He may have something more clever in mind, but based on his suggestion this seems to work:

<style>
.myelement:nth-of-type(3):after {content:"|";}
.myelement:nth-of-type(6):after {content:"|";}
.myelement:nth-of-type(9):after {content:"|";}
</style>

<$list filter="1 2 3 4 5 6 7 8 9 10">
@@.myelement
<$view field="title"/>
@@
</$list>


-- Mark

Archizona V

unread,
Jan 24, 2018, 2:05:17 AM1/24/18
to TiddlyWiki
Using CSS is good idea. Can I with CSS convert my list to table with 3 columns and many rows?

Mat

unread,
Jan 25, 2018, 3:21:31 AM1/25/18
to TiddlyWiki


On Tuesday, January 23, 2018 at 6:59:18 PM UTC+1, Mark S. wrote:
Mat is like a CSS wizard. I wouldn't have thought of doing it this way. He may have something more clever in mind, but based on his suggestion this seems to work:

<style>
.myelement:nth-of-type(3):after {content:"|";}
.myelement:nth-of-type(6):after {content:"|";}
.myelement:nth-of-type(9):after {content:"|";}
</style>

A more general way is this (notice "3n")

<style>
.myelement:nth-of-type(3n):after {content:"|";}
</style>

<:-)

Mat

unread,
Jan 25, 2018, 3:25:39 AM1/25/18
to TiddlyWiki
On Wednesday, January 24, 2018 at 8:05:17 AM UTC+1, Archizona V wrote:
Using CSS is good idea. Can I with CSS convert my list to table with 3 columns and many rows?

A table is something else. The method to generate a table from the listwidget has been discussed several times and, basically, you use html markup in the listwidget. Do a search in the archives.

<:-)


Mat

unread,
Jan 25, 2018, 3:37:48 AM1/25/18
to TiddlyWiki
Ah - or maybe you mean something like this?

<style>
.myelement:nth-of-type(3n):after {
  content
: "|\A";
  white
-space: pre;
}
</style>


<:-)
Reply all
Reply to author
Forward
0 new messages