Learning list and list widget in Tiddlywiki as a loop

707 views
Skip to first unread message

Mohammad

unread,
Jun 1, 2018, 6:59:29 AM6/1/18
to TiddlyWiki
I am looking for learning resources on TW list feature, specially for using as a loop and processing different parts of tiddlers.
I found these pages, I appreciate if you advise me on more resources and tutorial with some advanced features.


These are useful pages I found
Best
Mohammad

TonyM

unread,
Jun 2, 2018, 5:42:46 AM6/2/18
to TiddlyWiki
Mohammad,

I do not know of too many resources on this but I have solutions that use the list widget in sophisticated ways so when you find gaps please ask the group.

You are aware that one of the best ways to learn tiddlywiki is searching and browsing tiddlywiki itself. Using advanced search and system or shadow tiddlers can help and you quickly learn other things. This is particularly helpfull with searching for widget use eg <$list or filter= is great.

Do not be intimidated by what you do not understand just scan until you see things you can understand.

Another thing is to try and find something similar to what you want and try and work it out which has long term gains.

Regards
Tony

Mat

unread,
Jun 2, 2018, 8:13:20 AM6/2/18
to TiddlyWiki
Mohammad, IMO the "secret" is not to "learn the listwidget" but to study the filter operators.

<:-)

Mohammad

unread,
Jun 2, 2018, 1:58:59 PM6/2/18
to TiddlyWiki
Thank you Tony! Yes, that's true!
I tried to go into the codes behind some plugins!

Best

Mohammad

unread,
Jun 2, 2018, 2:08:42 PM6/2/18
to TiddlyWiki
Mat!
 I started to do that! I found the Jed introduction to lists very interesting, but as you said, the secret is in using filters.
Also as Tony advised, I found reading other codes useful, while the learning curve in this way is not short!

Cheers
Mohammad

Rahul Kashyap

unread,
May 23, 2020, 1:20:54 AM5/23/20
to TiddlyWiki
Hello everyone,

Could someone please help me with a particular implementation that I'm trying to achieve?  Any help would be appreciated. 

I want to use a macro for all the tiddlers satisfying a certain filter esp. (demo/details/details-macro (https://kookma.github.io/TW-Shiraz/#Install) macro of Shiraz. 

I know that {{!!title}} or <$view field='title'/>  prints the title of the tiddlers  and I can use <$transclude mode="block"/> to transclude the content as well but, I couldn't transclude them inside the macro. 
I also tried a template unsuccessfully. 

<$list filter="[tag[my_tag]]">


<
<details sum:"[[tiddler_variable_in_the_loop]]" src:"{{tiddler_variable_in_the_loop}}">>   // desired output with visible link and hidden translusion


<<details sum:"{{!!title}}" src:<$transclude mode="block"/> >>   // displays the title of the tiddler without link; do not transclude.
<
<currentTiddler>>{{||$:/rkashyap/template/detail}}   // similar to above


<$transclude mode="block"/>   // transludes the whole content without hiding it
</$list>


The code below achieves the task if the title of the tiddlers are not CamelCase in which case it opens the tiddler which I don't want. 
<$appear show= {{!!title}} >
<$transclude mode="block"/>
</$appear>


Thanks,
-Rahul

Mat

unread,
May 23, 2020, 4:56:36 AM5/23/20
to TiddlyWiki
@Rahul
 
I don't know the intricacies of the macro you intend to use but I'm guessing you wish to pass the tiddler that is current in the listwidget. 

But for example this

<<details sum:"{{!!title}}" src:<$transclude mode="block"/> >>

passes the literal string {{!!title}} and not the current tiddlers actual title.

Also, the argument to src needs to be enclosed properly assuming you DO want to send that as a string. In that case it'd be

src:"""<$transclude mode="block"/>"""

But, overall, I suspect that you are intending for the arguments to the details macro to be evaluated prior to being sent.  If this is the case then you had better use the macrocall widget instead of calling the macro with the shortform (<<...>>) as you do now, i.e

<$macrocall $name=details sum={{!!title}} src={{!!text}} />

(possibly the {{!!text}} will ruin the block format, but try it first to see if it does)

OK, that should at least be some steps on the way.

<:-)

Mat

unread,
May 23, 2020, 4:58:54 AM5/23/20
to TiddlyWiki
@Rahul, by the way:


Could someone please help me with a particular implementation

...then start a new particular thread instead of hijacking this old one which is not about your question.

<:-)
Message has been deleted

Rahul Kashyap

unread,
May 23, 2020, 10:19:54 AM5/23/20
to TiddlyWiki
Hi Mat,

Thanks for reply.  I tried your method but, it caused "maximum stack call" error. 

I posted on this because it was about understanding and using the loop structure of list widget. I thought it reduces the duplication of questions and convenience for other people seeing related discussions together. 

Apology if I understood it incorrectly. 

I saw another reply by Michael here but, it seems deleted now. I didn't understand there on how to use the macro "outline" it doesn't take a filter as input.

Thanks again, 
-Rahul

Mat

unread,
May 23, 2020, 10:47:04 AM5/23/20
to TiddlyWiki
Rahul Kashyap wrote:
Hi Mat,

Thanks for reply.  I tried your method but, it caused "maximum stack call" error. 

The thing is that what I wrote is not a complete solution, I was only pointing out a few probably issues with your code. To really solve it one has to look at the macro you want to use. But, OK, I had a very quick look at the details macro and I think you can do this:

\define call-details() <<details sum:"$(sum)$" src:"$(src)$" status:"$(status)$" class:"$(class)$" style:"$(style)$">>

<$list filter="[tag[my_tag]]">
<$set name=sum value=....>
<$set name=src value=...>
...etc with SetWidgets...
<<call-details>>
</$set>
</
$set>
</$list>

It is not clear how your tiddlers tagged my_tag contain their data so I can't say how the data is extracted so that sum, src etc get their values, but is might be the title of the tiddler, in which case you do value={{!!title}} or perhaps the text of the tiddler in wihch case it'd be value={{!!text}}, or some other field. Obviously, whatever you feed the parameters must be in the format that the details macro expects. I have not investigated that macro so I can't talk about it. I think it is Mohammads macro.

Regarding posting here only because it has to do with the ListWidget - no, it doesn't make sense because there are thousands of questions involving the listwidget. It is a very important and common widget. So next time, or perhaps even this time, start/continue with a new thread.

<:-)


Reply all
Reply to author
Forward
0 new messages