How to create a header in table of contents which shows all untagged Tiddlers?

105 views
Skip to first unread message

Blue Steel

unread,
Feb 15, 2019, 5:04:34 AM2/15/19
to TiddlyWiki
I'm new to TW and managed to create a basic table of contents, but I can't figure out how to create a section which will automatically show all my untagged Tiddlers. I want this section so I can quickly create Tiddlers and give them a tag for sorting later, as well as show any Tiddlers I've forgotten to tag.

In the TableOfContents note I've got a list field currently with: Tasks3 Tasks [[Tasks 2]] Unsorted. I want to make 'Unsorted' into the section header for my untagged notes.

S. S.

unread,
Feb 15, 2019, 5:46:09 AM2/15/19
to TiddlyWiki
Well, here's a possible start. Perhaps not exactly what you want to end up with, but perhaps it might do for now.

In your tiddler titled: Unsorted
That should have a tag: TableOfContents
Put this in its text field:
<<list-links filter:[!has[tags]!prefix[$:/]]>>

The filter: [!has[tags]!prefix[$:/]] does 3 things

1. Since we have not told the filter what are the input titles to look for, it defaults to all System & Normal Tiddlers (omitting Shadow tiddlers)

2. This part: has[tags]  :would return all tiddlers that have tags.
    The ! instructs the filter to be a negation, thus:  !has[tags]  :returns tiddlers that have an empty tags field (no tags).

3. prefix[$:/] would return only tiddlers whose titles begin with $:/ - which in this case would be all System tiddlers.
   We want the opposite of that, and once again the ! negates the return, so:  !prefix[$:/] :returns all the non-system tiddlers.

The <<list-links .... >> macro creates the bullet point list.

Hope that helps.

Jeremy Ruston

unread,
Feb 15, 2019, 7:06:52 AM2/15/19
to tiddl...@googlegroups.com
Hi SS

There is also an “untagged” filter operator which you can use for this,

Best wishes

Jeremy

--
Jeremy Ruston

--
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+...@googlegroups.com.
To post to this group, send email to tiddl...@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/5d0f72ac-6f15-4001-8bea-bc8984e4d03f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Blue Steel

unread,
Feb 15, 2019, 7:20:31 AM2/15/19
to TiddlyWiki
Thanks guys! I combined both your answers to get:
<<list-links filter:[untagged[all]!prefix[$:/]]>>

It works correctly in showing the untagged Tiddlers within the "Unsorted" Tiddlers note, but it doesn't show up in the Table of Contents for some reason. Any ideas?
tw-unsorted2.png
tw-unsorted.png

S. S.

unread,
Feb 15, 2019, 7:22:19 AM2/15/19
to TiddlyWiki
Thanks Jeremy!

Never noticed that one. Sure makes things easier.

<<list-links filter:"[!is[system]untagged[]]">>

Makes me fee nice (the original 13th century meaning of the word from its Latin root - nescius).

TonyM

unread,
Feb 15, 2019, 7:42:36 AM2/15/19
to TiddlyWiki
Blue,

Can I suggest you look into learning how to make your own set of recursive macros to do what the toc macro does? You can research how the existing ones work or possibly search for posts of mine on this previously. If you can find it let me know.

The fact is you can do anything you want in a to if you build it yourself.

Regards
Tony

S. S.

unread,
Feb 15, 2019, 7:57:06 AM2/15/19
to TiddlyWiki
Blue Steel,

As I said in my first post:
Perhaps not exactly what you want to end up with.

TiddlyWiki's built in Table-of-Contents Macros are based on a tag-tree of "parent-child" tiddlers. This means each parent tiddler is the name of a tag which is used by its "children" tiddlers. And each of those children in turn can be names of tags used by their own "children".

Using that would mean that for each "untagged" tiddler to appear in your Unsorted tiddler, they would have to be tagged with Unsorted ! Oops - but then they would not be untagged!
I guess one way to do it would be to tag all new tiddlers with an Unsorted tag to begin with. Then the tiddlers would show up in your Table of Contents. You could also put this in the text field of your Unsorted tiddler just to display the list there:

<<list-links filter:"[tag[Unsorted]]>>

Later when you decide how to tag them, you add the new tags, and delete the Unsorted tag.

Would that work for you?

Blue Steel

unread,
Feb 15, 2019, 5:29:39 PM2/15/19
to TiddlyWiki
Hmm I see, I think I'll stick with the current functionality then, and see if I can figure out macros to automatically tag new Tidders with 'Unsorted' at some point. Thanks for the helpful replies everyone.

TonyM

unread,
Feb 15, 2019, 9:42:59 PM2/15/19
to TiddlyWiki
Bluey?

Here is a complete TOC recursive pair of macros if you feel like building your own, This one will traverse the whole tree, but not display those that match the filter.

\define each-level(filter)
<$list filter="$filter$" variable=nul>
[[$(currentTiddler)$]]<br>
</$list>
<$list filter="[is[current]tagging[]]">
        <<each-level $filter$>>
</
$list>
\end
\define list-toc(tiddlername filter)
<h2>Top of TOC</h2>
<$tiddler tiddler="$tiddlername$">
   <$list filter="[is[current]tagging[]]">
       <<each-level $filter$>>
   </
$list>
</$tiddler>
\end

<<list-toc TableOfContents "[is[current]!tag[hide]]">>
there is no indenting each level in this

As stated before you cant have a tree of untagged tiddlers, if that tree is defined by tags, However you could have a tree defined by using another field such as the parent field, the advantage also being you can force only one parent.

\define each-child(filter)
[[$(currentTiddler)$]]<br>
<$list filter="[parent[$(currentTiddler)$]]">
       
<<each-child $filter$>>
</$list>
\end
\define list-tocP(tiddlername)
<$tiddler tiddler="$tiddlername$">
   [[$tiddlername$]]<br>
   <$list filter="[parent[$tiddlername$]]">
       <<each-child>>
   </
$list>
</$tiddler>
\end

<<list-tocP "New Home">>
This can be facilitated using marios TOCP plugin https://wikilabs.github.io/editions/tocP/

Back to the tag based TOC, I did asked myself why you may want untagged tiddlers in a tree, and realising the normal approach is that children are tagged with the parent I realised even the lowest "leaf" on a tag tree has a tag, you will not find even those at the bottom free of tags. However If the TOC finds a tiddler that no other tiddler uses as a tag, then it will be a leaf. I may use this to identify leaves.

For my above examples I am looking for an easy method to indent each level.

Best wishes 
Tony
Reply all
Reply to author
Forward
0 new messages