On Saturday, September 5, 2020 at 2:10:56 PM UTC-7, amreus wrote:
This is hard to do (but still possible) using the current version of TW (5.1.22)
However, it is very easy using the new "sortsub" filter that is available in the next update (5.1.23)
Let's start by assuming that all your "people" tiddlers are tagged with "people" so you can find them easily.
Then, to sort by ID number extracted from the tiddler titles, use the "sortsub" filter, like this:
\define sub() [split[(]rest[]split[)]first[]]
<$list filter="[tag[people]sortsub<sub>]">
<<currentTiddler>><br>
</$list>
Notes:
* The $list finds all "people" tiddlers.
* The sub() macro defines the filter to extract the ID from each title
* The sortsub[] filter uses the extracted ID values to sort the titles in ascending order
Here's how to do the same thing using the current TW5.1.22:
\define getList()
<$list filter="[tag[people]]">
<$vars id={{{ [<currentTiddler>split[(]rest[]split[)]first[]] }}}>
<$text text="[["/><<id>>;<<currentTiddler>><$text text="]]"/>
</$vars>
</$list>
\end
<$wikify name="people" text=<<getList>>>
<$list filter="[enlist<people>sort[]]">
{{{ [<currentTiddler>split[;]rest[]] }}}<br>
</$list>
</$wikify>
Notes:
* getList() finds all "people" tiddler and, for each, it outputs a string of the form: [[id;tiddlertitle]], including the square brackets (to allow for titles with spaces)
* $wikify invokes <<getList>> and converts the macro output into plain text
* $list enlists this text (converting it to a list of separate items) and then sorts it by the ID (which is now a prefix on each title)
* Then, it outputs each item, removing the prefix and the ";" used as a delimiter
* The result is the original list of [tag[people]], sorted by ID.
Hope this helps,
-e