On Thursday, August 6, 2020 at 1:42:50 AM UTC-7, Teo Piitulainen wrote: > > Hello, I'm new here, and new to the code! >
Welcome! > I use these Tag Manager-like Tiddlers to organize my tag hierarchies. For > example, this one creates a table of all my wiki's "topics" tags and shows > their count next to them (on the left). > Is there a way to sort the resultant table primarily by the count (most > popular tag first), and secondarily by the tag title? > In the latest *pre*-release of the TWCore (v5.1.23) there is a new filter, "sortsub", which lets you sort items by a "subfilter" definition. The subfilter uses filter syntax to compute a "derived value", based on the current tiddler being processed. For your use-case, this does the job: \define lingo-base() $:/language/TagManager/ \define sub() [tagging[]count[]] <table class="tc-tag-manager-table"> <tr> <th><<lingo Count/Heading>></th> <th><<lingo Tag/Heading>></th> </tr> <$list filter="[tags[]tag[topics]!is[system]sort[title]!sortsub:integer<sub>]"> <tr> <td style="text-align: right"><$count filter="[all[current]tagging[]]"/></td> <td>{{||$:/core/ui/TagTemplate}}</td> </tr> </$list> </table> Notes: * you will need to use the 5.1.23 pre-release, which you can get here: https://tiddlywiki.com/prerelease/empty * because the subfilter syntax contains square brackets, it can't be "nested" inside the sortsub[...] syntax. To work around this, use a macro (variable) to define the subfilter, and then reference it using the <...> variable syntax * your posted table syntax had a few oddities that I cleaned up: 1) there is no need for a <tbody> tag 2) there was an extra row with empty <td>'s 3) there was no terminating </$list> or </table> You might also be interested in checking out my TagCloud "filter generator": http://tiddlytools.com/filtergenerators.html#TiddlyTools%2FFilterGenerators%2FTagCloud It sorts the tags by number of tagged items, but instead of displaying a table, it shows the count included in the "tag pill" text, and also scales the size of the tag pill in proportion to the number of items it is tagging. enjoy, -e -- 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 tiddlywiki+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/1b876e98-8775-4f9a-914a-749762ec518ao%40googlegroups.com.