Is there a way to show more content in addition to title/caption in a select-expandable TOC?
Use case: I’m using built-in toc-selective-expandable macro. I have some tiddlers listed in TOC, usually at second-level or more that have a field added with variable value when they are “complete.” I want to indicate in TOC that such a tiddler is complete.
I was thinking of showing the caption and adding a mark/glyph in the TOC list to show the tiddler is complete. How do I go about doing this?
EDIT: Anyone who considers using this as a basis for their own code should consider the below from @EricShulman . This code is meant to be a demonstration of the fact that such a TOC can be constructed, and works specifically under unique tagging conditions which may not match your own. Further work may be required to make functional for your setup. Use caution. Always backup.
Hello @well-noted,
that looks very good.
Would you please give an example of how it’s used.
Tiddler tagging, fields required etc.
I am sure it is simple but I am missing something.
Thanks,
Sunny
I use this as a template, but you can see how it works by adding the content to a new tiddler.
Anything that is tagging that tiddler will show up in the TOC list. And if it is tagged Completed the tag will appear (you will need to add the style code if you want it to show up as if it were a tag:
If you do as I have, and make it a template, you might name it something like $:/readingListTemplate, and then any tiddler you want to have a list you can pass through the template with {{||$:/readingListTemplate}} will have a list of items which are tagging that tiddler, and the completed tag will show up if it’s also tagged completed.
The section <$list filter="[all[current]tag[Completed]]"> could be modified to be any field and value that you wish.
Thank you @well-noted for providing more information on how you use the template.
I am however, still confused.
I have created a tidlyhost site here, which shows my failed attempt to use your code.
What is needed to make this work? - Can you help please.
Thanks,
Sunny
For what it’s worth, here is my entire ReadingListTemplate – it is one of the first more complex tiddler templates I ever constructed and is extremely janky (so take it for what it’s worth), and, though it does work, I plan to do some major renovations on it very soon (incorporating multiple authors for example).
Thank You very much @well-noted
It worked as you suggested. I thought the second part was required in another tiddler. I had added the Style in a Stylesheet previously, but deleted it when nothing worked.
I look forward to studying your entire ReadingListTemplate and possibly your renovations too.
Thanks again for your help.
!!level is a field reference, but the actual level value was passed in as a macro parameter, so <<__level__>> (or <__level__> within filter syntax) would be the correct way to get the value.
To add 1 to a value, you need to use filter syntax with the add[1] operator, like this:
level={{{ [<__level__>add[1]] }}}
Also, your recursion doesn’t protect against infinite loops. For example, if TiddlerB is tagged with TiddlerA, AND TiddlerA is tagged with TiddlerB, then you will get a tree like this:
TiddlerA
TiddlerB
TiddlerA
TiddlerB
... etc ...
With infinite recursion until the browser hangs or crashes with an “out of memory” error.
To address this, the TWCore TOC macros (as well as my TiddlyTools/TOC macros and @pmario’s TOCP macros) all use an “exclude” parameter that automatically keeps track of tree nodes that have already been “visited” on the current branch, so that they won’t be re-visited to prevent infinite loops.
'preciate it, @EricShulman, as mentioned this code is in terrible need of revision – it was kitbashed together in 2020, and held together with pieces of duct tape found along the way.
I’ve gotten pretty far in developing the modal to input authors for the new version, but I haven’t been in a rush overall because it is functional for the time being (and, importantly, for the very specific way that I’ve organized my reading notes).
Anyone looking at this code as a basis for their own should definitely see it as more of a proof of concept and consider what Eric is saying… Infinite recursion is no fun
Keep us up to date here, @Sunny, as I’ve said multiple times this is something that I verymuch intend to come back to - - whatever you make of it, I will be very interested to see.
My problem is I’m like a kid in a sweet shop, everywhere I look …
I need to concentrate on a specific project and progress step by step.
If and when I get there I’ll let you know
I feel you with the kid in the candy store analogy - - I have come around to allowing myself to pursue whatever it is my mind is drawn to at any given time, and just keeping extensive documentation in order to advance projects.