Thank you Mark, that works perfectly, but I have realized that it is less adaptable than I initially thought.
I have tried adapting it to filter for *only* tiddlers tagged with "spam". I first tried the following with the field "tag-filter=spam" in the section I want to filter: <<toc-selective-expandable 'Section' sort:"sort[title]]+[tag{!!tag-filter}">> The problem is that in other sections without a "tag-filter" field the filter becomes "[sort[title]]+[tag[]]" which returns nothing. I've spent the last hour trying to figure out another way of doing it to no avail. Can you see a way to do this? Thanks again for your help. On Monday, January 20, 2020 at 6:33:46 PM UTC, Mark S. wrote: > > You can use the sort attribute to insert whole filter runs. However, the > syntax will look lopsided: > > <<toc-selective-expandable 'Section' sort:"sort[title]]+[!tag[spam]">> > > Notice that the brackets are not balanced. Basically the macro is > providing the final, right-hand square bracket. You need to provide sort > criteria because you're over-riding the default. > > This seemed to work in my tests. Topmost elements were tagged with > "Section" so that they all hung together. > > Good luck! > > On Monday, January 20, 2020 at 6:08:24 AM UTC-8, si wrote: >> >> Hi folks. >> >> How could you exclude all tiddlers with a certain tag from a >> Table-of-Contents, but *only* within a specific sub-section of the >> hierarchy? >> >> For example, say that I have a the following table of contents: >> >> - Section1 >> - Subitem >> - Subitem >> - Section2 >> - Subitem >> - Subitem >> - Section3 >> - Subitem >> - Subitem >> >> How could I apply a filter to the macro that excludes all tiddlers with >> the tag "spam", but only apply it to the descendants of "Section2"? >> >> I have tried a couple of things so far: >> >> First I tried creating separate Table-of-Contents macros for each Section: >> >> <div class="tc-table-of-contents"> >> >> <<toc-selective-expandable 'Section1Tag'>> >> <<toc-selective-expandable 'Section2Tag' sort:"!tag[spam]">> >> <<toc-selective-expandable 'Section3Tag'>> >> >> </div> >> >> This works but puts a blank line between each section in the TOC. Maybe >> I'm being nitpicky but it makes the TOC look much uglier than it needs to >> and takes up an impractical amount of space when you have a lot of sections. >> >> I have also tried using the following: >> >> <div class="tc-table-of-contents"> >> >> <<toc-selective-expandable 'TableOfContents' sort:"!tag{!!exclude-tag}">> >> >> </div> >> >> And then adding the field "exclude-tag=spam" to the "Section2" tiddler. >> This didn't work at all. >> >> Does anyone know of a tidy way to do this? >> >> Thanks a lot for your help. Si >> > -- 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/319a6da8-3256-40b5-9856-e23a5574da0a%40googlegroups.com.