One of my personal TiddlyWiki’s contains song lyrics and chords, with the 
default tiddler displaying a list of the songs sorted by title. It’s been 
annoying for a long time that the titles starting “The …” are sorted under “T”, 
and not the first letter of the following word.

The new sortsub operator in v5.1.23 has provided a simple means to resolve 
things:

\define sort-filter() [<currentTiddler>removeprefix[the ]] 
~[<currentTiddler>removeprefix[The ]] ~[<currentTiddler>]

<$list filter="[tag[song]sortsub<sort-filter>]" 
template="$:/_SongItemTemplate"/>

The subfilter relies on the fact that the removeprefix operator doesn’t return 
anything if the input string doesn’t start with the specified prefix. Thus we 
can step through the prefixes we want to remove, finishing up with the original 
title.

A more complete version should perhaps strip the prefix “A ”  as well.

It would be nicer if we have a case-insensitive version of removeprefix.

Best wishes

Jeremy

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6924FFC6-DB20-4C9E-B356-B620723A1A32%40gmail.com.

Reply via email to