Andrew, All of this is possible, but a full answer will take time. You may want to consider the existing TOC macros to see if you can leverage them. However I expect if you built your own TOC macro you would get more control. I need to get to bed so can't answer in full now.
However I am developing some guides and this may be interesting as a start, it demonstrates recursion that makes a TOC work to an unlimited number of levels, but you could write one just to process your known number of levels and treat each level differently. One macr call the chapter, the next the sections the next the paragraphs. RecursionLike a toc macro, recursion drills down into a heirachical structureA sophisticated combination of iteration and selectionThis example uses the same filter for each level, it processes all "tagging[]" the current tiddler then moves on to the next tiddler in the previous list. \define each-other-level(filter) Start level $filter$ <$link to=<<currentTiddler>> ><$text text=<<currentTiddler>>/></$link><br> <$list filter="$filter$"> <<each-other-level $filter$>> </$list> End level for "<$text text=<<currentTiddler>>/>"<br> \end \define first-level(filter) Start all<br> <$list filter="$filter$"> <<each-other-level $filter$>> </$list> End all<br> \end Start in TableOfContents<br> <$tiddler tiddler="TableOfContents"> <<first-level "[is[current]tagging[]]">> </$tiddler> Or the unfinished Structured levels *not finished Incomplete and untested*Process a fixed and limited set of levels in a heirachieA combination of iteration and selectionEach town within state within countrySee recursion for an indefinite tree \define all-countries() Start all countries<br> <$list filter="[tag[country]]" variable=country> <$macrocall $name=country country-name=<<country>> /> </$list> Start all countries<br> </$list> \end \define country{country-name} Start $country-name$<br> <$set name=country value="$country-name$"> <!-- <<country>> will stay set until you return here --> <$list filter="[####tag[state]country<country>]" variable=state <$macrocall $name=state country-name=<<country>> state=<<state>>/> </$list> End $country-name$<br> </$set> \end \define state{state} Start $state$<br> <$set name=state value="$state$"> <!-- <<state>>will stay set until you return here --> <$list filter="[#####tag[country]]" variable=state <$macrocall $name=town state=<<state>>/> </$list> End $country-name$<br> </$set> \end \define town(town} Start $town$<br> <$set name=state value="$town$"> <!-- <<town>>will stay set until you return here --> <$list filter="[$$$$tag[country]]" variable=state <$macrocall $name=state state=<<state>>/> </$list> End $town$<br> </$set> \end <<all-countries>> Regards Tony On Thursday, August 8, 2019 at 4:49:55 PM UTC+10, AndrewMc wrote: > > Hi All > > While I have been using TW for some years (mainly TWc) my usage of TW5 is > rather basic and I am having difficulty with what I think is a filter > problem. > I have some book text arranged in tiddlers, tagged with the chapter > number, section number, and paragraph number of the text. > > For example, all text from Chapter 7 is tagged with [C07]. > The first Section of the chapter is a tiddler named [C07S01], containing > just the section title, and is tagged with [C07] and [S01]. > This section may contain several paragraphs. > The first Paragraph is a tiddler named [C07S01P01], and is tagged with > [C07], [S01] and [P01]. > The second paragraph is a tiddler named [C07S01P02], and is tagged with > [C07], [S01] and [P02]. > > The second section in chapter 7 is [C07S02] (tagged with [C07] and [S02]). > and this has paragraphs [C07S02P01] and [C07S02P02] etc. > > I am wanting to create a list of the tiddlers that make up this chapter. > I have created a [Chapter 7] tiddler containing the list-links macro: > <<list-links [tag[C07]]>> > > This is a good start, and gets me the equivalent of: > * [[C07S01]] > * [[C07S01P01]] > * [[C07S01P02]] > * [[C07S02]] > * [[C07S02P01]] > * [[C07S02P02]] > > However, I am wondering if there is a way to get the following: > {{C07S01}} > * [[C07S01P01]] > * [[C07S01P02]] > {{C07S02}} > * [[C07S02P01]] > * [[C07S02P02]] > > That is, I would like to know if there is a way that I can transclude all > of the Section tiddlers of a chapter, in numerical order, each followed by > a list of the paragraphs within each section. Is this a task for a macro? > > For a start, I am struggling to create a filter to obtain just the section > tiddlers. I want to get only those tiddlers tagged with a chapter tag [C07] > and with a tag beginning with [S], and without a tag beginning with [P]. > Is it possible to do this? Or, should I just add some more tags, [Section] > for each section tiddler, and [Paragraph] for each paragraph tiddler? > > Any suggestions and ideas appreciated. > > Cheers > Andrew Mc > -- 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/81cf4a99-c98c-428a-91c2-9f4da1f13cea%40googlegroups.com.