Great solutions by all participants. I am really excited when I see a discussion on TW filter language.
Yet another clean solution using the new terminology in TW 5.3.x (function)
\procedure mylist(filter, sortType, flagList, field:"title")
\function myfilter() "[subfilter<filter>] :sort:$(sortType)$:$(flagList)$[get[$(field)$]]" :map[substitute[]]
<$list filter=<<myfilter>> template="$:/core/ui/ListItemTemplate"/>
\end
<<mylist filter:"[tag[Learning]limit[10]]" sortType:"alphanumeric" flagList:"reverse,caseinsensitive">>
This is equivalent to:
<$list filter="[tag[Learning]limit[10]] :sort:alphanumeric:reverse,caseinsensitive[get[title]]" template="$:/core/ui/ListItemTemplate"/>
NOTE: In <$list filter=<<myfilter>>
the myfilter
is first rendered and generates the final filter and then $list evaluates it. Don’t use it like a filter operator (I intentionally did not include the dot in the name).