Thanks Mark! That worked great. In looking at your code, I can see where I 
went wrong when I tried to do the same thing. Lack of experience on my part 
certainly is evident.

Damon


On Friday, June 14, 2019 at 3:31:45 PM UTC-5, Mark S. wrote:
>
> Be sure to have a backukp, or use on a disposable TW file.
>
> Clone the existing $:/core/macros/tree tiddler, rename it to 
> $:/core/macros/tree2, and replace the contents with the code below.
>
> Invoke as "tree2" -- this way there will be no confusion when reporting 
> results to the community.
>
> This uses the "description" field to form the relationships. I guess the 
> next step would be for someone to write a version where you can specify any 
> field to form the relationships.
>
>
>
> \define leaf-link2(full-title,chunk,separator: "/")
> <$link to=<<__full-title__>>><$text text=<<__chunk__>>/></$link>
> \end
>
> \define leaf-node2(prefix,chunk)
> <li>
> <$list filter="[<__prefix__>addsuffix<__chunk__>]" variable="full-title">
> <$list filter="[description<full-title>is[shadow]] 
> [description<full-title>is[tiddler]]" variable="dummy">
> <$list filter="[<full-title>removeprefix<__prefix__>]" variable="chunk">
> <span>{{$:/core/images/file}}</span> <$macrocall $name="leaf-link2" full-
> title=<<full-title>> chunk=<<chunk>>/>
> </$list>
> </$list>
> </$list>
> </li>
> \end
>
> \define branch-node2(prefix,chunk,separator: "/")
> <li>
> <$set name="reveal-state" value={{{ 
> [[$:/state/tree/]addsuffix<__prefix__>addsuffix<__chunk__>] }}}>
> <$reveal type="nomatch" stateTitle=<<reveal-state>> text="show">
> <$button setTitle=<<reveal-state>> setTo="show" class="tc-btn-invisible">
> {{$:/core/images/folder}} <$text text=<<__chunk__>>/>
> </$button>
> </$reveal>
> <$reveal type="match" stateTitle=<<reveal-state>> text="show">
> <$button setTitle=<<reveal-state>> setTo="hide" class="tc-btn-invisible">
> {{$:/core/images/folder}} <$text text=<<__chunk__>>/>
> </$button>
> </$reveal>
> <span>(<$count filter="[all[shadows+tiddlers]each[description]get[
> description]removeprefix<__prefix__>removeprefix<__chunk__>] -[<__prefix__
> >addsuffix<__chunk__>]"/>)</span>
> <$reveal type="match" stateTitle=<<reveal-state>> text="show">
> <$macrocall $name="tree-node2" prefix={{{ 
> [<__prefix__>addsuffix<__chunk__>] }}} separator=<<__separator__>>/>
> </$reveal>
> </$set>
> </li>
> \end
>
> \define tree-node2(prefix,separator: "/")
> <ol>
> <$list filter="[all[shadows+tiddlers]each[description]get[description]
> removeprefix<__prefix__>splitbefore<__separator__>sort[]!suffix<
> __separator__>]" variable="chunk">
> <$macrocall $name="leaf-node2" prefix=<<__prefix__>> chunk=<<chunk>> 
> separator=<<__separator__>>/>
> </$list>
> <$list filter="[all[shadows+tiddlers]each[description]get[description]
> removeprefix<__prefix__>splitbefore<__separator__>sort[]suffix<
> __separator__>]" variable="chunk">
> <$macrocall $name="branch-node2" prefix=<<__prefix__>> chunk=<<chunk>> 
> separator=<<__separator__>>/>
> </$list>
> </ol>
> \end
>
> \define tree2(prefix: "$:/",separator: "/")
> <div class="tc-tree">
> <span><$text text=<<__prefix__>>/></span>
> <div>
> <$macrocall $name="tree-node2" prefix=<<__prefix__>> 
> separator=<<__separator__>>/>
> </div>
> </div>
> \end
>
>
>
>
> On Friday, June 14, 2019 at 12:08:11 PM UTC-7, Damon Pritchett wrote:
>>
>> All right, it's definitely not that simple. Can what I want to do be done 
>> with just modifications or is a whole new macro needed for that?
>>
>> Damon
>>
>>
>> On Friday, June 14, 2019 at 10:44:43 AM UTC-5, Damon Pritchett wrote:
>>>
>>> In looking at the tree macro this morning, I'm wondering if I changed 
>>> the filter lines that contain [
>>>
>>> all[shadows+tiddlers] 
>>>
>>>
>>> to something that searched for a certain field instead of the title. 
>>> It's probably not that simple and I thought I'd ask for opinions before I 
>>> started hacking things.
>>>
>>> Thanks,
>>>
>>> Damon
>>>
>>>
>>> On Thursday, June 13, 2019 at 10:03:49 PM UTC-5, Damon Pritchett wrote:
>>>>
>>>> The more I look at this, the more I like it and it may be just what 
>>>> I've been needing for a long time. I do have a question. Would it be 
>>>> possible to have the macro, as on option, look at the caption or another 
>>>> field instead of the tiddler title? I ask this because I can see, at least 
>>>> in my case, the tiddler titles getting extremely long which is not 
>>>> aesthetically pleasing not to mention hard to read.
>>>>
>>>> Thanks again,
>>>>
>>>> Damon
>>>>
>>>> On Thursday, June 13, 2019 at 9:09:00 PM UTC-5, Damon Pritchett wrote:
>>>>>
>>>>> Great discussion and I like the new option for separator in the tree 
>>>>> macro. Looking forward to the next release although I may start using the 
>>>>> updated tree macro sooner.
>>>>>
>>>>> Damon
>>>>>
>>>>>
>>>>> On Thursday, June 13, 2019 at 9:40:23 AM UTC-5, @TiddlyTweeter wrote:
>>>>>>
>>>>>>
>>>>>> Jeremy Ruston wrote:
>>>>>>>
>>>>>>> As it turns out, I suspect it’s not wildly useful beyond the system 
>>>>>>> tiddlers. Given the following data tiddlers:
>>>>>>>
>>>>>>
>>>>>>  
>>>>>> For some use cases, perhaps? For instance a navigator for a novel you 
>>>>>> want separate from "system" ($:).
>>>>>>
>>>>>> Say...
>>>>>>
>>>>>>  Great Expectations-Vol 1-Chapter 1-Para 1
>>>>>>
>>>>>>
>>>>>> through to 
>>>>>>
>>>>>>  Great Expectations-Vol 2-Chapter 52-Para 135
>>>>>>
>>>>>>
>>>>>> In someways I think its about having a navigator that is more than 
>>>>>> for $:? But its not exactly desperately needed :-)
>>>>>>
>>>>>> But the Tree Explorer certainly helps, I think, understand structure 
>>>>>> in TW. And its a good metaphorical likeness to file browsers.
>>>>>>
>>>>>> Best wishes
>>>>>> Josiah
>>>>>>
>>>>>>
>>>>>> ... The output is ...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4a4d4edb-2158-41e4-b765-8050467f813d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to