Filter using toc?

172 views
Skip to first unread message

Steven Schneider

unread,
Jan 10, 2017, 11:04:49 PM1/10/17
to TiddlyWiki
I figure this must be possible, but can't quite get it to work.

How would I write a filter that would list all tiddlers listed with <<toc "TableOfContents">>?

Thanks,

//steve.


Tobias Beer

unread,
Jan 11, 2017, 1:46:10 AM1/11/17
to TiddlyWiki
Hi Steven,

I once made one:

  1. wasn't considered useful for the core.
  2. needs some more polishing to prevent recursion
    • right now it doesn't, so you may hit an infinite loop
  3. will publish as a plugin.
  4. will reconsider options, since in the end I want to be able to define:
    • the tag (falls back to currentTiddler)
    • the max level to go down to
    • a filter of titles to exclude (and not further look for children)
    • a filter of titles to truncate (and not further look for children)
      • they are in the results
Best wishes,

Tobias.

PMario

unread,
Jan 11, 2017, 6:05:49 AM1/11/17
to TiddlyWiki
On Wednesday, January 11, 2017 at 5:04:49 AM UTC+1, Steven Schneider wrote:
I figure this must be possible, but can't quite get it to work.
How would I write a filter that would list all tiddlers listed with <<toc "TableOfContents">>?

I'm not sure, what you want to achieve. ... The toc macro is a "relatively" straight forward recursive macro, that creates a structure using ordered lists. So changing this behaviour, to create a simple list, should be possible.

If you want to print out a dynamically generated filter, that's used to create the toc, this should be possible too. .. But the result will be super ugly and barely readable for humans. We have to deal with "infinite recursion protection", which makes the filter ugly.

Can you clarify the usecase a bit?

-mario

CL

unread,
Jan 11, 2017, 8:10:37 AM1/11/17
to tiddl...@googlegroups.com
You could use this filter.
just add more 'tagging[]' operator if you have larger toc

<$list filter="
[[TableOfContents]]
[[TableOfContents]tagging[]]
[[TableOfContents]tagging[]tagging[]]
[[TableOfContents]tagging[]tagging[]tagging[]]
[[TableOfContents]tagging[]tagging[]tagging[]tagging[]]
[[TableOfContents]tagging[]tagging[]tagging[]tagging[]tagging[]]
">
<$link>{{!!title}}</$link><br>
</$list>

Tobias Beer

unread,
Jan 11, 2017, 3:35:05 PM1/11/17
to TiddlyWiki
Hi Mario,
 
I'm not sure, what you want to achieve

One useful thing could be a searchable index of everything in a toc.
Another useful thing would be to able to page through a toc as if a book.

Best wishes,

Tobias. 

Tobias Beer

unread,
Jan 11, 2017, 6:19:54 PM1/11/17
to TiddlyWiki
Hi Seven,

Just announced the release of tobibeer/toc.

Best wishes,

Tobias.

Steven Schneider

unread,
Jan 23, 2017, 6:57:48 PM1/23/17
to TiddlyWiki
Thanks, Tobias, This is great. I'm using it in various ways all the time these days. It's an interesting way to slice into a wiki - through toc.

//steve.
Reply all
Reply to author
Forward
0 new messages