Sorting tag dropdown

70 views
Skip to first unread message

Michael Wiktowy

unread,
Jan 15, 2021, 9:22:19 AM1/15/21
to TiddlyWiki
I'm sorry if this has been asked before but I couldn't find it in the archives ...

I have section headings that are best sorted by sortan[] ... for instance:

Default sort:
§§417.26-417.100
§417.1
§417.11
§417.13
§417.15
§417.17
§417.19
§417.21
§417.23
§417.25
§417.3
§417.5
§417.7
§417.9

sortan[]
§§417.26-417.100
§417.1
§417.3
§417.5
§417.7
§417.9
§417.11
§417.13
§417.15
§417.17
§417.19
§417.21
§417.23
§417.25

When these show up in the tag dropdown, they use the default sort. I would like to change this list to use sortan[] by default.

I thought by changing the filters in:
$:/core/ui/ViewTemplate/tags or
$:/core/ui/TagTemplate
to use sortan, it would affect the dropdown list but apparently I am looking at the wrong spot since changing either (and both) doesn't affect the sorting.

Does anyone know where I should be changing the filter sort for the tag dropdown?

/Mike

Michael Wiktowy

unread,
Jan 19, 2021, 12:39:01 AM1/19/21
to TiddlyWiki
Just reporting back some success for those looking to do this.

Digging into the $:/core/ui/TagTemplate tiddler revealed that what I wanted to tweak was in the list-tagged-draggable macrocall. That macro accepts a "subFilter" parameter that I could pass my "sortan[]" into.

In investigating further to try to get the section range markings (§§) in the right spot, I tried the new sortsub operator. The following substitution to the macrocall to list-tagged-draggable works but seems rather messy:

<$vars sortsubFilter="[trim[§]splitbefore[ ]splitbefore[-]trim[-]trim[]addprefix[v]addsuffix[.0]]">
<$macrocall $name="list-tagged-draggable" tag=<<currentTiddler>> subFilter="sortsub:version<sortsubFilter>"/>
</$vars>

Two comments:
1) It would be convenient if the "version" modifier to the sortsub operator was more tolerant of other types of version strings like #.# or #.#.# without the v
2) It seems like there ought to be an equivalent to a splitafter operator ... or a negation to the splitbefore operator .... that just grabs the string *after* the delimiter. Am I missing something? It would have made that sortsubFilter easier to enable chopping out the integer after the "." and used the "integer" modifier on the sortsub operator and not worried about the pickiness of "version".

Is there a simpler way that I am missing? This works but seems rather brute-force.

/Mike
Reply all
Reply to author
Forward
0 new messages