Convert a dynamic list into a template

51 views
Skip to first unread message

Sandip Deshmukh

unread,
Aug 25, 2021, 11:07:21 AM8/25/21
to TiddlyWiki
Here is a working dynamic list I have:

<ul>
<$list filter="[contains:participants[King George]!sort[at]]">
 <li><$link /></li>
</$list>
</ul>

This works perfectly.

Can I convert this into a template --- 'ParticipatedListTemplate'?

So, I can sit in a tiddler 'King George', write

{{||ParticipatedListTemplate}} and get the same list.

And if it is a template, I can do the same in 'Queen Elizabeth' tiddler, too.

Or is there a better way of achieving the same thing?

Mark S.

unread,
Aug 25, 2021, 11:46:42 AM8/25/21
to TiddlyWiki
Try 

<ul>
<$list filter="[contains:participants<currentTiddler>!sort[at]]">

 <li><$link /></li>
</$list>
</ul>

If that works inside tiddler "King George", then you can paste the text into a tiddler and tag it "$:/tags/ViewTemplate" and it will work everywhere. But you probably don't want it to work everywhere. So you can wrap it with a list that only includes tiddlers that have participants :

<$list filter="[all[current]has[participants]]">
<ul>
<$list filter="[contains:participants<currentTiddler>!sort[at]]">

 <li><$link /></li>
</$list>
</ul>
</$list>

Sandip Deshmukh

unread,
Aug 25, 2021, 12:07:00 PM8/25/21
to TiddlyWiki
Thanks, Mark.


On Wednesday, August 25, 2021 at 9:16:42 PM UTC+5:30 Mark S. wrote:
Try 

<ul>
<$list filter="[contains:participants<currentTiddler>!sort[at]]">

 <li><$link /></li>
</$list>
</ul>

The first block of code worked perfectly.
 

If that works inside tiddler "King George", then you can paste the text into a tiddler and tag it "$:/tags/ViewTemplate" and it will work everywhere. But you probably don't want it to work everywhere. So you can wrap it with a list that only includes tiddlers that have participants :

<$list filter="[all[current]has[participants]]">
<ul>
<$list filter="[contains:participants<currentTiddler>!sort[at]]">

 <li><$link /></li>
</$list>
</ul>
</$list>

But this did not. I had named the tiddler containing this code 'ParticipatedList' and tagged it as suggested by you.

Also, what I am aiming at is not the list. I want to transclude the matching tiddlers.

I have edited the original question to say so explicitly. I earlier thought that {{}} meant it automatically.

 


On Wednesday, August 25, 2021 at 8:07:21 AM UTC-7 Sandip Deshmukh wrote:
Here is a working dynamic list I have:

<ul>
<$list filter="[contains:participants[King George]!sort[at]]">
 <li><$link /></li>
</$list>
</ul>

This works perfectly.

Can I convert this into a template --- 'ParticipatedListTemplate'?

So, I can sit in a tiddler 'King George', write

{{||ParticipatedListTemplate}} and get the same list transcluded.

Mark S.

unread,
Aug 25, 2021, 12:26:41 PM8/25/21
to TiddlyWiki
Can you provide some tiddlers with participants list (e.g. King George, Queen Elizabeth, etc.) Having to guess at someone's data structure makes helping difficult. 

Thanks!

Sandip Deshmukh

unread,
Aug 26, 2021, 1:11:40 AM8/26/21
to TiddlyWiki
Well, I found a solution to the problem!!

Here is what I have done:

ContactInformation tiddler carries this code:

<$list filter="[contains:participants<currentTiddler>!sort[on]]">
  <$link /><br>
  {{!!text}}<br><hr><br>
</$list>

Every time I want to extract this information for a particular tiddler, I just put:

{{||ContactInformation}}

in it. Then it works.
Reply all
Reply to author
Forward
0 new messages