[TW5] Json Mangler Update 0.3.0

96 views
Skip to first unread message

Joshua Fontany

unread,
Dec 14, 2017, 3:47:59 PM12/14/17
to TiddlyWiki
Hi all. I have updated my plugin to impliment "alphanumeric" tokenized sorting of the JSON keys whenever a refresh event happens.

The Alphanum Algorithm is discussed at http://www.DaveKoelle.com and there is a reference tiddler in my plugin from his site.

As an example, previously these keys would sort in this order:

"colors[0].color": "black",
"colors[1].color": "white",
"colors[10].color": "octarine",
"colors[2].color": "red",
"colors[3].color": "blue"
And now they sort in this order:

"colors[0].color": "black",
"colors[1].color": "white",
"colors[2].color": "red",
"colors[3].color": "blue",
"colors[10].color": "octarine"


Still thinking about other functionality to add...

---------------------
As an aside, the base sorting Filter Operators also choke when it comes to numbers embedded in strings ("path" style strings with numerals).

Would this be worth implementing in a new "alphanum[] / alphanumcs[]" pair of Filter Operators?

For example, right now both the sort[] and nsort[] operators return the same ("incorrect" to humans) result from this $list of tiddler titles:
Test/0/test0
Test/0/test1
Test/0/test10
Test/0/test2
Test/1/test0
Test/1/test1
Test/1/test10
Test/1/test2
Test/10/test1
Test/2/test1
---------------------

Best,
Joshua Fontany

Joshua Fontany

unread,
Dec 14, 2017, 3:48:45 PM12/14/17
to TiddlyWiki

Ste Wilson

unread,
Dec 15, 2017, 5:29:26 PM12/15/17
to TiddlyWiki
I have no idea what this means but bonus points for the disc world reference :)

Jed Carty

unread,
Dec 16, 2017, 4:39:40 AM12/16/17
to TiddlyWiki
Did you make a filter version of the alphanumeric sort? People have been asking for one that works for a while and I couldn't find a good way to create one last time I tired. I need to look closer at the chunkify part of the code but it looks like it takes care of the part that I couldn't figure out before.

So yes, I think that at a minimum a plugin to add the filters so we can test them out would be a good idea.
Reply all
Reply to author
Forward
0 new messages