Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce new subfilter operator #3508

Merged
merged 3 commits into from
Nov 16, 2018
Merged

Introduce new subfilter operator #3508

merged 3 commits into from
Nov 16, 2018

Conversation

Jermolene
Copy link
Member

Fixes #3505

Needs better examples.

@Jermolene
Copy link
Member Author

Hi @abesamma I've just triggered a build of this new branch that should fix your TOC problem in #3505. Could you kindly give it a try? (It'll take 10 minutes to appear -- you'll know it's the right one if you don't see the "single tiddler mode" demo material at the top of the page).

@pmario
Copy link
Member

pmario commented Oct 31, 2018

@kookma
Copy link
Contributor

kookma commented Nov 1, 2018

Thank you Jeremy! Thanks Mario
Here I made a try on https://tiddlywiki.com/prerelease/ for TW5.1.18

Example

Assume you have several macros tagged with myTag and you want to build a table of contents but you want to exclude few tiddlers e.g tid-a, tid-b, tid-c

<<toc-selective-expandable 
tag:"myTag" 
exclude:"[subfilter[tid-a tid-b tid-e]]">>

Another example

Assume you have several tiddlers tagged with tt and there are some of them ALSO have been tagged with tts, how to build a TOC excluding those tagged with tts"

<$set name="myFilter" value="[tag[tts]]">
  <<toc-selective-expandable 
    tag:"tt" 
    exclude:"[subfilter<myFilter>]">>
</$set>

References

The main discussion
https://groups.google.com/d/msg/tiddlywiki/8QxnwHzaRLg/UzO90F9TAgAJ

Further talk
https://groups.google.com/d/msg/tiddlywiki/x3HVIjJrbx8/iof9Ml7KAgAJ

A bad news

I tried some previous examples of toc macro included in TW 5.1.18pre, some of them broken! For example see: https://tiddlywiki.com/prerelease/#Example%20Table%20of%20Contents%3A%20Simple

It seems the toc macro has some issues. Using it raise the red local widow with this error:

Uncaught RangeError: Maximum call stack size exceeded

toc-selective-expandable

This macro is also returns the Javascript error you can check it on tiddlywiki.com/prerelease
see: https://tiddlywiki.com/prerelease/#Example%20Table%20of%20Contents%3A%20Expandable

@pmario
Copy link
Member

pmario commented Nov 1, 2018

@kookma ... be aware, that the exclude parameter is for internal use only!!!!! If you use it wrong it will blow up your TOC.

@pmario
Copy link
Member

pmario commented Nov 1, 2018

The exclude parameter MUST have -[[something]]. Where the "-" is important. If it is missing it won't work

@pmario
Copy link
Member

pmario commented Nov 1, 2018

@Jermolene ... I propose to rethink the TOC macros ... again. IMO it's starting to be a mess.

The exclude parameter was introduced 2 years ago with "Toc recursion protection #2650" .. Now everyone seems to use it completely wrong!! ... We need to fix this.

@kookma
Copy link
Contributor

kookma commented Nov 1, 2018

@kookma ... be aware, that the exclude parameter is for internal use only!!!!! If you use it wrong it will blow up your TOC.

Okay Mario! I will remain and will stop using it for now! In my case I want to use toc-selective-expandable to make table of contents of tiddlers tagged by say myTag but exclude those have also ignored as tag! That's all

Thank you

@Jermolene
Copy link
Member Author

Thank you @pmario, I had forgotten that the exclude parameter was internal. Apologies @kookma!

I'll remove the modifications to the TOC macro from this PR but go ahead with the subfilter operator, it's something I've wanted to add for some time.

@Jermolene Jermolene changed the title First pass at fixing toc issues with a new subfilter operator Introduce new subfilter operator Nov 1, 2018
@kookma
Copy link
Contributor

kookma commented Nov 1, 2018

The exclude parameter MUST have -[[something]]. Where the "-" is important. If it is missing it won't work

@pmario But what is in the revised code does not requite - sign! Check it on prerelease!
By the way I remain for next revised code and I will give you my feedback!

@kookma
Copy link
Contributor

kookma commented Nov 1, 2018

ove the modifications to the TOC macro from this PR but go ahead with

@Jermolene
Do you mean a subfilter will be added to be able to exclude some tiddlers from TOC? This is really demanding! Suppose you wish to build a TOC from all tiddlers tagged with say 'myBookand there are some footnote tiddlers havemyBooktag but alsofootnotetag and you want to exclude those tiddler tagged withfootnote` from table of contents!

Thank you Jeremy!

@Jermolene
Copy link
Member Author

Hi @kookma

The revised code didn't need a - sign because the alterations changed the way that the exclude parameter worked.

In terms of the subfilter operator, I meant that the new subfilter operator built for this fix will go ahead into 5.1.18. I've reverted the changes to the TOC macro.

@kookma
Copy link
Contributor

kookma commented Nov 1, 2018

@Jermolene

Thank you! I hope you could also update the documentation when it appeared in TW 5.1.18

@pmario
Copy link
Member

pmario commented Nov 6, 2018

@pmario But what is in the revised code does not requite - sign! Check it on prerelease!

@kookma ... Yea .. and that's the problem. It only looks like, as if there is no - but how the code works atm. There is one. Trust me ;)

The name: "exclude" indicates that if you specify [tag[test]] will exclude every tiddler tagged test ... But in reality the filter that needs to be programmatically calculated is -[tag[text]] ... Which is a new filter run.

One more problem is, that the existing logic can only exclude "tiddler titles" and no "tiddler sets" like [tag[xxx]]

As I wrote. The "exclude" parameter was not intended to be publicly visible. ... but the "usecase" to have one is valid.

@pmario
Copy link
Member

pmario commented Nov 6, 2018

IMO OT for the PR, but on topic for the discussion here. See: About existing TOC vs. prerelease TOC performance degrading #3517

@kookma
Copy link
Contributor

kookma commented Nov 6, 2018

@pmario Thanks for clarification. For me, I cloned the toc-selective-expandable from TW5.1.17 and changed its name and use it and wait for the final release of 5.1.18

@Jermolene Jermolene merged commit 33dd367 into master Nov 16, 2018
@Jermolene Jermolene deleted the subfilter-operator branch November 16, 2018 11:27
jho1965us pushed a commit to jho1965us/TiddlyWiki5 that referenced this pull request Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants