TOC question

329 views
Skip to first unread message

David Gifford

unread,
Sep 2, 2014, 6:46:30 PM9/2/14
to tiddl...@googlegroups.com
Why would both this:

<div class='tc-table-of-contents'>
<<toc-selective-expandable "[tag[GettingStarted]!tag[$:/Note]]">>
</div>

and this

<div class='tc-table-of-contents'>
<<toc-selective-expandable '[tag[GettingStarted]!tag[$:/Note]]'>>
</div>

result in this:

Filter error: Syntax error in filter expression

and how do I get it to work? (Make a TOC of all tiddlers that have the tag GettingStarted but not the tag $:/Note)

p.s. I realize the new CSS is tc-toc. I am using a stylesheet where I have changed the old tc-table-of-contents to suit my tastes here.

Andreas Hahn

unread,
Sep 2, 2014, 9:01:43 PM9/2/14
to tiddl...@googlegroups.com
Hi David,

the toc macro does not actually accept a filter expression as its first parameter, but instead just a tag that is then filled into a filter expression. Within the toc-macro, the list widget is invoked with the following filter exp:

<$list filter="[tag[$tag$]$sort$]">

$tag$ is the first parameter, so your

<<toc-selective-expandable '[tag[GettingStarted]!tag[$:/Note]]'>>

leads to it being filled in like this:

<$list filter="[tag[[tag[GettingStarted]!tag[$:/Note]]]]">

And this is obviously not a well-formed filter expression. However this is not the end of the line. To make
your filter work, you can do a filter injection by doing

<<toc-selective-expandable 'GettingStarted]!tag[$:/Note'>>

so that it becomes

<$list filter="[tag[GettingStarted]!tag[$:/Note]">

which will work but doesn't make for good end-user experience whatsoever.

/Andreas
--
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 http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

David Gifford

unread,
Sep 2, 2014, 9:38:59 PM9/2/14
to tiddl...@googlegroups.com
Thanks Andreas,

Your

I am curious why you say it will not make for a good end-user experience whatsoever, since the end result of the toc will be the same.

Blessings

Dave


--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/gV-J8Nf_oio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--
David Gifford
Christian Reformed World Missions, Mexico City

Andreas Hahn

unread,
Sep 2, 2014, 9:52:26 PM9/2/14
to tiddl...@googlegroups.com
Hi David,

for people starting out with TW it is probably pretty confusing since the documentation states that the toc macro expects the first parameter to be a tag and not some weird half finished filter expression.

Obviously using that trick yourself is totally fine for all practical purposes, it was merely a side note for Jeremy (and others) that those filter injection tricks are not user-friendly for new TW users but when people tend to do this to get more complex behaviour out of a macro, they will inevitably get in touch with this and it will be very confusing for them.

On the other hand, please don't ruin this beautiful macro by adding useless parameters :D

/Andreas

David Gifford

unread,
Sep 2, 2014, 10:12:43 PM9/2/14
to tiddl...@googlegroups.com
Thanks for the explanation.

In beginning to explain why I was going to use this parameter, I just realized I don't need it! My viewtemplate includes two parts to the body, one governed by tags but with an additional tag, "$:/TOC", and the other governed by tags but with an additional tag, "$:/Note". The idea of the parameter was to filter out the second set of tiddlers. But I just remembered that in GettingStarted I won't have any tiddlers tagged $:/Note. So this whole question is a moot point. Nevertheless at least I have a hack for it in case I ever need to do it that way for some reason. Thanks!

Dave

Jeremy Ruston

unread,
Sep 4, 2014, 12:13:24 PM9/4/14
to TiddlyWiki
Hi Andreas
 
Obviously using that trick yourself is totally fine for all practical purposes, it was merely a side note for Jeremy (and others) that those filter injection tricks are not user-friendly for new TW users but when people tend to do this to get more complex behaviour out of a macro, they will inevitably get in touch with this and it will be very confusing for them.

I've found working on the core macros (toc, tabs etc) quite liberating. The fact that it's so easy for an end user to copy and modify the macros relieves the normal pressure to try to cater for every edge case. So, in this case I think it's probably right that the toc macro takes a tag, rather than a filter. It allows for the trick discussed here, but keeps the macro itself clean and simple.

Anyhow, one prediction for the future is that I think we'll see an awful lot of macros in the general area of creating hierarchical views of tiddler relationships...

Best wishes

Jeremy



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Matias Altalef

unread,
Mar 6, 2016, 2:41:47 PM3/6/16
to TiddlyWiki
a way to do the same thing that's a little prettier:

<<toc-selective-expandable 'GoodTag' !tag[BadTag]sort[title]>>
Reply all
Reply to author
Forward
0 new messages