In examples from https://tiddlywiki.com/#list-links%20Macro%20(Examples) the filter: parameter name is explicitly specified. In this thread the filter is passed as positional rather than named parameter. Is it because when parameters are passed positionally, the macro handles them in the order they are specified in the macro definition?
Official documentation for macro calls doesn’t explicitly state it, but what I understand is parameter names can be omitted and then declaration position is used for name/value mapping.
So in @stefan_from_germany example code, the second parameter value "sort[title]" would be mapped to type parameter.
This can be seen in “widget tree” preview mode:
Even though I don’t know why anyone would want to do this, it’s possible to override positional order by using indices instead of parameter names like this:
One last topic I need to ask here.
The list will be sorted by the title but shown will be the caption?
So far so good. Bu If the Title is alphabetically sorted before the caption it is not sorted.
If in your real use-case some tiddlers have a caption and some don’t, I don’t know how to solve the sorting problem. Maybe it could be done in a <$list> widget instead of a <<list-links>> macro, but even then I wouldn’t know how to do it… You’d have to remember the original tiddler title, replace it by caption when available, then sort, and build the links… quite involved! Maybe by building a compound string like caption-or-title|title, then sorting, then splitting back to get the tiddler title…
Anyway, if every tiddler has a caption though, it’s easy:
The advantage of the :sort[...] filter run is that it uses a separate filter to determine the value to sort by, without changing the current title value in the process.
I created a tiddler and tagged it with $:/tags/ViewTemplate.
Now I get the information below each tiddler what is very helpful in such a complex wiki like mine.
created: 20241206114923250
creator: stefan_from_germany
modified: 20241216083126496
modifier: stefan_from_germany
tags: $:/tags/ViewTemplate
title: $:/List_of_Linked_Tiddlers
<hr>
<b>
This Information is linked with these chapters also:
</b>
<<list-links "[<currentTiddler>backlinks[]] [<currentTiddler>backtranscludes[]] :sort[{!!caption}!match[]else{!!title}]">>
<hr>