Number ordering where 22 doesn't come before 3?

Hi everyone

By default TiddlyWiki numbers things like 1, 11, 2, 22, 3, 33 etc, so if I want something strictly ordered I need to add zeroes before 1, 2, 3, etc.

Is there a plugin or fix so that it orders numbers strictly automatically? Sorry I am not aware of the correct terminology.

Blessings!

Is this a context where the nsort, in a filter, can do the work you need?

https://tiddlywiki.com/#nsort%20Operator

Maybe. It is a list filter, sorting titles, but wanting to sort them by nsort and not just alphabetically. The snippet below doesn’t work.

<$list filter='[search:notebox:literal<currentTiddler>] +[nsort[]]'><div class='notecard'><$transclude field='text' mode='block' /></div></$list>

Hmm. Seems to work correctly.

To be clear, your titles are actual numbers. e.g. β€œ1”,β€œ11”,β€œ2”, etc ?

No, they are combinations. Bible verses, as in below.

Matthew 2.36
Matthew 3.1
Matthew 22.22

This?

No. here is the snippet I gave above.

<$list filter='[search:notebox:literal<currentTiddler>] +[nsort[]]'><div class='notecard'><$transclude field='text' mode='block' /></div></$list>

It is in a viewtemplate filter, to transclude all tids that have current tiddler title in their notebox field. But I am tired of adding 0s to tiddler titles so they will line up. I just want to know if I can get, say, Matthew 3.1 to appear before Matthew 22.1, etc.

But I was implying you need sortan not nsort

It may not work everywhere, but it seems okay here.

2 Likes

Ah! Thanks now I understand. The following works properly:

<$list filter='[search:notebox:literal<currentTiddler>] +[sortan[]]'><div class='notecard'><$transclude field='text' mode='block' /></div></$list>

5 Likes