If the structure you created was a "perfect" tree, with no double-backs and 
only one tag per tiddler, then it might not be too hard to do.

But if you have multiple tags, then you could quickly have a large number 
of possible paths And if any tiddler has a tag that refers to somewhere 
down in the tree, then you could end up with an endless loop.

Workarounds for these problems might including a tag list with the 
invocation. The tag list would indicate which tags are considered part of 
the tree. The other thing might be to create a list of tiddlers that have 
already been visited. Then any tags that are that list will not be 
traversed a second time. These extra precautionary steps make the intended 
macro more intensive to write.

Another approach would be to trace down a particular path way (top down). 
Possibly the code in the TOC can already do this. Then save all the paths 
that are created. Then list over the paths, reversing them, and selecting 
only the ones that match your branch at the bottom. I've actually never 
used this approach, so it's a bit more speculative. 

Perhaps, more importantly, might be to understand why you want the reverse 
tree. Sometimes understanding why something is wanted yields simpler 
solutions.


On Saturday, March 28, 2020 at 6:07:55 PM UTC-7, Damon Pritchett wrote:
>
> Hey all,
>
> Hope everyone is having a safe and healthy weekend.
>
> I would like to use the list widget and/or macro to do a tag trace on a 
> specific set of tiddlers. In essence, it would be kind of a like a reverse 
> table of contents. I've tried to do this myself, but am really not sure 
> where to start especially since this would be recursive. Let me illustrate 
> what I'd like.
>
> Suppose I have a set of tiddlers that are tagged thusly:
>
> * Tiddler A is tagged with Root
> * Tiddler B is tagged with Tiddler A
> * Tiddler C is tagged with Tiddler A
> * Tiddler D is tagged with Tiddler B
> * Tiddler E is tagged with Tiddler D
>
> In Tiddler E, I would like to display something like this:
>
> Tiddler E -> Tiddler D -> Tiddler B -> Tiddler A -> Root
>
> Tiddler C would show Tiddler C -> Tiddler A -> Root
>
> How would I go about doing this?
>
> Many thanks,
>
> Damon
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/29cb7219-00e6-4565-a7a7-a78dcee14fe1%40googlegroups.com.

Reply via email to