toc-selective-expandable macro: how to exclude some tiddlers tagged with say ignored

340 views
Skip to first unread message

Mohammad

unread,
Oct 4, 2018, 1:45:56 AM10/4/18
to TiddlyWiki
I use the toc-selective-expanable to create a table of contents for all tiddlers tagged with lecture

<<toc-selective-expandable tag:"lecture" sort:"sort[caption]">>

Some tiddlers belong to the lecture category also tagged with ignored. How can I exclude them in the macro toc-selective-expanable to exclude them in TOC?


-Mohammad

BurningTreeC

unread,
Oct 4, 2018, 2:37:31 AM10/4/18
to TiddlyWiki
Hi Mohammad,

This is the toc-selective-expandable code:

\define toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path)
<$vars tag="""$tag$""" sort="""$sort$""" itemClassFilter="""$itemClassFilter$""" excluded="""$exclude$ -[[$tag$]]""" path="""$path$/$tag$""">
  <ol class="tc-toc toc-selective-expandable">
    <$list filter="""[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$] -[[$tag$]] $exclude$""">
      <$list filter="[all[current]toc-link[no]]" variable="ignore" emptyMessage=<<toc-selective-expandable-empty-message>> >
        <$macrocall $name=toc-unlinked-selective-expandable-body tag="""$tag$""" sort="""$sort$""" itemClassFilter="""$itemClassFilter$""" exclude=<<excluded>> path=<<path>> >
      </$list>
    </$list>
  </ol>
</$vars>
\end
 
As you can see if you look on top of it, it accepts an "exclude" attribute

this is the filter where your exclude filter would be used:

<$list filter="""[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$] -[[$tag$]] $exclude$""">

If you want to exclude - say - all tiddlers tagged "bla" you pass exclude:"-[tag[bla]]" or all tiddlers with the field "blu" exclude:"-[has:field[blu]]"

Mohammad

unread,
Oct 4, 2018, 5:18:09 AM10/4/18
to TiddlyWiki
Hello BTC,
 Many thanks, works like a charm!

Cheers
Mohammad

Mohammad

unread,
Oct 30, 2018, 2:16:14 PM10/30/18
to TiddlyWiki
Hello BTC,
 Have you tried this in TW 5.1.18pre? It seems the exclude parameter does not work anymore!
I noticed the macro has been changed as below:

\define toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path)
<$vars tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> excluded="""[enlist<__exclude__>] -[<__tag__>]""" path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
  <ol class="tc-toc toc-selective-expandable">
    <$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
      <$list filter="[all[current]toc-link[no]]" variable="ignore" emptyMessage=<<toc-selective-expandable-empty-message>> >
        <$macrocall $name=toc-unlinked-selective-expandable-body tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>> >
      </$list>
    </$list>
  </ol>
</$vars>
\end


Would mind to have a look at https://tiddlywiki.com/prerelease/ ?


Mohammad



On Thursday, October 4, 2018 at 10:07:31 AM UTC+3:30, BurningTreeC wrote:

BurningTreeC

unread,
Oct 30, 2018, 3:37:47 PM10/30/18
to TiddlyWiki
Hi Mohammad, I believe this is the result of a - maybe unintended? - redesign of how the exclude parameter gets inserted into the filter
In the new code it accepts a list and in the old code it accepts a filter. I don't believe that it should stay like that

Mohammad

unread,
Oct 30, 2018, 3:40:49 PM10/30/18
to TiddlyWiki
Hi BTC,
 Thank you for clarification! So, I wait to see what Jeremy thinks on that!

I noticed these changes have been recently applied and my older prerelease work fine!

-Mohammad

Mohammad

unread,
Oct 31, 2018, 12:44:45 AM10/31/18
to TiddlyWiki

Mohammad

unread,
Oct 31, 2018, 11:44:28 PM10/31/18
to tiddl...@googlegroups.com
Hello BTC,

Jeremy just announced some modifications to toc macros!

See


and also my thread here


Please have a look and give your comments!


Mohammad

PMario

unread,
Nov 1, 2018, 6:13:41 AM11/1/18
to TiddlyWiki
Hi,

As you can see if you look on top of it, it accepts an "exclude" attribute

Just be sure, that you are misusing this parameter. If you don't know what you are doing, you'll run into big trouble.
 

this is the filter where your exclude filter would be used:

<$list filter="""[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$] -[[$tag$]] $exclude$""">

If you want to exclude - say - all tiddlers tagged "bla" you pass exclude:"-[tag[bla]]" or all tiddlers with the field "blu" exclude:"-[has:field[blu]]"

The most important sign here is the minus "-" in -[tag[bla]] 

If someone uses [tag[bla]]  feeded into the exclude parameter everything will go wrong, because the existing TOC-macros only have this parameter for internal usege!

-mario
Reply all
Reply to author
Forward
0 new messages