This is "pre me understanding regular expressions", and "before I go about refactoring" code.
Usually, whatever we are sorting, we want to sort in either ascending or
descending order.
This is about sorting in random order. Useful for gaming, or random
quote/tiddler of the day, or whatever else that gives some unpredictability.
The attachment further below has two tiddlers: a javascript macro tiddler
for the random macro, and the "Randomize Order of Items" tiddler to see the
random sorting in action (push the button for new sort). Download that
attachment and drag into TiddlyWiki.com for study/playing.
In case this tempts you a little, the filter formatted for easier reading:
\define thisSort() [split[::]last[]]
{{{
[[1]addsuffix[::]addsuffix<random 999>]
[[2]addsuffix[::]addsuffix<random 999>]
[[3]addsuffix[::]addsuffix<random 999>]
[[4]addsuffix[::]addsuffix<random 999>]
[[5]addsuffix[::]addsuffix<random 999>]
[[6]addsuffix[::]addsuffix<random 999>]
+[sortsub<thisSort>]
+[splitbefore[::]]
+[search-replace[::],[]]
+[join[, ]] }}}
Cheers !
--
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/438502d5-92f3-43fa-b6b1-30f8f959201en%40googlegroups.com.
RandomOrderOfItems.json
Description: application/json

