Folks,
I have long wanted a replacement for an editor toolbar button, in TWV in QuickEdit to quickly sort some lines;
I just realised we can do this on the fly with a macro, not how by default it creates a link
Alternatively we can add inside each list
<$text text=<<currentTiddler>><br>
\define sort(text order:"a-z")
<$list filter="[[$order$]match[a-z]] [[$order$]match[a]]" variable=nul>
<$list filter="[[$text$]splitregexp[\n]sort[]]">
</$list>
</$list>
<$list filter="[[$order$]match[z-a]] [[$order$]match[z]]" variable=nul>
<$list filter="[[$text$]splitregexp[\n]!sort[]]">
</$list>
<$list filter="[[$order$]match[n]] [[$order$]match[z]]" variable=nul>
<$list filter="[[$text$]splitregexp[\n]nsort[]]">
</$list>
</$list>
\end
<<sort """
a sdsht
b adrgwskslh
z agroitgjitsij
d adrgvoistrwpwrtlko
zest
""" a-z>>
This can't handle bullets etc.. eg *
If you want a learning task consider
- what are the parameter which is the default?
- Allow a click to copy the result to the clipboard.
- Build a EditorToolbar button to sort and replace selected text (Challenge)
Regards
Tones