Transcluding limited number of characters of a field in a list widget

69 views
Skip to first unread message

Teun van Leeuwen

unread,
Feb 15, 2020, 1:27:20 PM2/15/20
to TiddlyWiki
Hi,

I have used Tiddlywiki for a while, but I'm still struggling so now and then to figure things out. I don't have much experience with programming, but I do love knowledge management and Tiddlywiki is the only tool that suits my needs.

The problem is the following:

I am using a list widget to list Tiddlers with the tag "Inbox" in a table like so:

 

15/02/2020 - Sat February 15

Title of the Tiddler

Text of the Tiddler

 

What I'd like to be able to do is cut the text of the tiddler displayed in the list after a certain amount of characters. In case an item in the list is really long, it would look like this:

 



15/02/2020 - Sat February 15

Title of a short Tiddler

Text of a short tiddler

15/02/2020 - Sat February 15

Title of a long Tiddler

Text of a really long tiddler which is cut off after x amount of chara...

 

I googled around for quite a while, but I was probably using the wrong keywords. Is there any way I can easily achieve this? The code for the list that I have now is:

<table class="tableFormatter">
<$list filter="[all[shadows+tiddlers]!prefix[$:/]tag[Inbox]]  +[sort[created]]">
<tr>
<td><$view field="created" format="date" template="DD/0MM/YYYY - ddd MMM DD"/></td>
<td  valign="top"><$link to=<<currentTiddler>>><$view field='title'/></$link></td>
<td>{{!!text}}</td>
</tr>
</$list>
</table>

Thanks in advance!

Mark S.

unread,
Feb 15, 2020, 1:45:12 PM2/15/20
to TiddlyWiki
Here's a version that uses the "HelloThere" tag on TiddlyWiki.com. You'll see where to change it back:

<table class="tableFormatter">
<$list filter="[all[shadows+tiddlers]!prefix[$:/]tag[HelloThere]]  +[sort[created]]">
<tr>
<td><$view field="created" format="date" template="DD/0MM/YYYY - ddd MMM DD"/></td>
<td  valign="top"><$link to=<<currentTiddler>>><$view field='title'/></$link></td>
<td><$text text={{{ [<currentTiddler>get[text]split[]limit[30]join[]] }}} /></td>
</tr>
</$list>
</table>


Teun van Leeuwen

unread,
Feb 16, 2020, 6:54:59 AM2/16/20
to TiddlyWiki
Thanks, I got it to work! It would have been hard to figure that logic out on my own.

Sidenote: If anyone has the same problem, make sure your Tiddlywiki version is recent enough to support all the operators used here.

Op zaterdag 15 februari 2020 18:45:12 UTC schreef Mark S.:
Reply all
Reply to author
Forward
0 new messages