Newbie help: kind of a nested list

149 views
Skip to first unread message

Alex W

unread,
Jul 16, 2018, 8:40:57 AM7/16/18
to TiddlyWiki
Hello all,

my question is probably a no-brainer for you folks, but I am totally overwhelmed :-(

I have the following construct of tiddlers:
  • category-tiddler, not tagged
  • list-tiddler, tagged with a category
  • task-tiddler, tagged with a list

I now want a nested (dynamic) view:

Category A
    List X
       Task 1
       Task 2
        ....
    List Y
       Task 1
       Task 2
    ....

Category B
  ...

I tried various variations with filters and <$list..., but I did not got the clue.
Could some pls help me out here? Tx a lot!!

PS: I am using the TW-Plugin "Dropboard". Therefore the structure/ tagging etc. is given.

Greets, Alex

Mark S.

unread,
Jul 16, 2018, 9:56:54 AM7/16/18
to TiddlyWiki
The table-of-content macros can already do that for you:


Have fun,

-- Mark

Alex W

unread,
Jul 16, 2018, 10:16:07 AM7/16/18
to TiddlyWiki
Thanks a lot, I will have a look into it!!

TonyM

unread,
Jul 16, 2018, 4:33:56 PM7/16/18
to TiddlyWiki
Alex,

I will just add in your example, to  use the TOC macros, you will need a root tag, such as TableOfContents or in your case maybe "AllCategories" that tags Category A and Category B then the TOCs root tag will be AllCategories

Regards
Tony

Alex W

unread,
Jul 17, 2018, 2:39:01 AM7/17/18
to TiddlyWiki
Thank you, it is working like a charm :-)

Is it possible to modify the way of display, eg. show the tags of the tiddlers?

Greets, Alex

Mark S.

unread,
Jul 17, 2018, 10:19:45 AM7/17/18
to TiddlyWiki
This is a quick way. Put the macros at the top of your tiddler:

\define toc-caption()
<$set name="tv-wikilinks" value="no">
 
<$transclude field="caption">
   
<$view field="title"/>{{||$:/core/ui/ViewTemplate/tags}}
 
</$transclude>
</
$set>
\end

\define toc-body(tag,sort:"",itemClassFilter,exclude,path)
<ol class="tc-toc">
 
<$list filter="""[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$] -[[$tag$]] $exclude$""">
   
<$vars item=<<currentTiddler>> path="""$path$/$tag$""" excluded="""$exclude$ -[[$tag$]]""">
     
<$set name="toc-item-class" filter="""$itemClassFilter$""" emptyValue="toc-item" value="toc-item-selected">
       
<li class=<<toc-item-class>>>
         
<$list filter="[all[current]toc-link[no]]" emptyMessage="<$link><<toc-caption>></$link>">
           
<<toc-caption>>
         
</$list>
          <$macrocall $name="toc-body" tag=<<item>> sort="""$sort$""" itemClassFilter="""$itemClassFilter$""" exclude=<<excluded>> path=<<path>>/
>
       
</li>
      </
$set>
   
</$vars>
  </
$list>
</ol>
\end

This was just a quick hack of the existing TOC macros. It used to be (I think) that you only had to override toc-caption. Now you have to override the body a little.

Then invoke like <<toc HelloThere>>

As you see, it puts the tags on a separate line. So that may be less than optimal. But it was fast ;-)

-- Mark
Reply all
Reply to author
Forward
0 new messages