Thank you very much Soren -- it works beautifully! Thanks also for your 
clear explanation.

On Tuesday, May 4, 2021 at 4:34:21 AM UTC+10 Soren Bjornstad wrote:

> Sorry, there's a typo in that macro, should be:
>
> \define myfilt() [all[current]split[ ]first[]match[SP]then[010]] 
> [all[current]split[ ]first[]match[SC]then[020]] [all[current]split[ 
> ]first[]match[ER]then[030]]
>
> On Monday, May 3, 2021 at 1:30:56 PM UTC-5 Soren Bjornstad wrote:
>
>> Here's a solution using sortsub, which sorts based on a key obtained by 
>> running a filter against each input item.  This assumes your prefixes are 
>> separated from the rest of the tiddler title by a space. If not, you may 
>> have to change the split character or get a bit more creative:
>>
>> \define myfilt() [all[current]split[ ]first[]match[SP]then[010] 
>> [all[current]split[ ]first[]match[SC]then[020]] [all[current]split[ 
>> ]first[]match[ER]then[030]]
>>
>> <<list-links "[tag[yourtag]sortsub<myfilt>]">>
>>
>> The subfilter in myfilt uses a series of runs to convert each prefix 
>> into a numerical value which sorts in the order you want. You can add as 
>> many steps to the filter as you need to handle all your prefixes. Any items 
>> that don't have a prefix listed in the filter will get no sort key and so 
>> show up at the top of the list.
>>
>> I am sure you could get creative and figure out how to store the mapping 
>> in a data tiddler and dynamically build the filter, but I'll let someone 
>> else figure that out if they're so inclined.
>>
>> On Monday, May 3, 2021 at 8:05:12 AM UTC-5 PMario wrote:
>>
>>> On Monday, May 3, 2021 at 11:48:41 AM UTC+2 Max Rozeman wrote:
>>>
>>>> Well it looks like this isn't as simple as I had hoped. Maybe what I 
>>>> need is a macro, but that's a skill I've yet to learn. For the time being 
>>>> then I'll just have to sort my titles the easy and messy way by adding 
>>>> prefixes to my prefixes.
>>>>
>>>
>>> You are right. My code doesn't work as expected. ... I did very poor 
>>> testing, so it looked like it would have worked. ... :/ Sorry for that. 
>>>
>>> But the sortby operator needs "matching titles" it doesn't use regexp 
>>> matches internally, which would have been needed for your usecase. 
>>>
>>> So imo there won't be a "out of the box" solution. ... At least I don't 
>>> know it. 
>>>
>>> -mario
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/667c128b-5cff-47f4-9207-cf9b73189f92n%40googlegroups.com.

Reply via email to