Discussion:
[tw] How 'distribute' filter operator on list?
(too old to reply)
Mat
2017-10-02 12:00:22 UTC
Permalink
Raw Message
I have thos ToC, i.e using the root tag "menu" and below it an arbitrary
number of children and grandchildren (i.e two levels below root, but not
more)

menu
- house
---House of Lannister
---House of Stark
- place
---Winterfell
---Kings Landing
- ...


I want to complete this with a listing (i.e not part of the ToC) for all
things that are NOT tagged "house", "place", "...".

Naively I attempted this:

<$set name=listed filter="[tag[menu]]" >
<<list-links "[is[tiddler]!is[system]] +[!tag<listed>]">>
</$set>

...hoping for "!tag" to distribute to all elements in 'listed'. OK, I'm not
surprised it doesn't work, but what should I do?

Thanks!

<:-)


Background, mostly off-topic: I almost never watch TV and especially avoid
TV-series for fear of getting addicted. My brother insisted I watch GoT
(Game of Thrones) ... and I managed to concoct an excuse for myself that
"GoT is now part of todays common knowledge", much like classical plays
once were. (Actually, most old "classics" are today more of an intellectual
oddity than common knowledge or general knowledge. A left over from a time
when intellectual food was scarce. That is not to say they are bad... but
most would not stand a chance had they been produced today.) Anyway, it
turns out GoT is fantastic - *but* *had it not been for a TiddlyWiki to
note things in*, I would frankly not have been *capable *of following it.
There are more names and places than in the Russian classics and I'd be
lost even a few episodes in.
--
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 ***@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/7c488c38-bbfa-4019-9fc6-3847fbc42993%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jed Carty
2017-10-02 13:02:22 UTC
Permalink
Raw Message
I have run into this problem myself a few times and never came up with a
satisfactory answer.

The closest I came up with was to define, using $set with a filter, the
parts that you want to remove and then just subtracting them. I haven't
come up with a way to make this work well.
--
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 ***@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/71e19e48-effe-4130-abed-5de1e563a1d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mat
2017-10-02 16:36:26 UTC
Permalink
Raw Message
Post by Jed Carty
I have run into this problem myself a few times and never came up with a
satisfactory answer.
Hm, that's surprising to hear.
Post by Jed Carty
The closest I came up with was to define, using $set with a filter, the
parts that you want to remove and then just subtracting them. I haven't
come up with a way to make this work well.
But that is what my failed attempt tried. How would you do it with the
above case?

....

@everyone: Would it make sense to make a github request for this (let a
lone a PR of course).
It occurs to me that a times character (*) would make syntactic sense for
distribution:

"[op*[a b c]]" = "[op[a]] [op[b]] [op[c]]"


<:-)
--
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 ***@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/3babee66-84cc-4b0e-a3fa-c5ec0d236bcf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
PMario
2017-10-02 13:51:42 UTC
Permalink
Raw Message
Post by Mat
I have thos ToC, i.e using the root tag "menu" and below it an arbitrary
number of children and grandchildren (i.e two levels below root, but not
more)
menu
- house
---House of Lannister
---House of Stark
- place
---Winterfell
---Kings Landing
- ...
I want to complete this with a listing (i.e not part of the ToC) for all
things that are NOT tagged "house", "place", "...".
Hi Mat,

Have a look here:
https://groups.google.com/forum/#!searchin/tiddlywiki/toc$20merge|sort:relevance/tiddlywiki/55zEWhzGF3c/KJsQUnFgCgAJ

I did an experimental bundle. Download it from the link.

Since it "hardcore" overwrites the core TOC macros and not everything
works, as I'd like it, I didn't create a plugin.

Feedback would be very welcome. ..

Is it worth to create a tocM plugin, out of this experiement?

have fun!
mario
--
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 ***@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/a042ae64-6b3d-4ed7-b769-871bf3b3e8f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mat
2017-10-02 19:29:48 UTC
Permalink
Raw Message
PMario - appreciated, but without having looked yet at your solution I kind
of doubt it will solve my question above since the general point of my
question is about filters or filter operators rather than about ToC's.

That said, I do think there is much room for improvement on ToC and
actually created a thing over these past weeks (for an enhancement to the
Batch Manipulator) that I might present at some later point. Who knows,
maybe your solution solves a problem I have with my variant.

<:-)
--
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 ***@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/9e066e01-493c-428b-a37b-cd4dd4c499ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
PMario
2017-10-02 23:34:50 UTC
Permalink
Raw Message
.. but without having looked yet at your solution
hmm, ... The OP says:

I want to complete this with a listing (i.e not part of the ToC) for all
things that are NOT tagged "house", "place", "...".
IMO this can easily be achieved with my proposal. With a simple "out of the
box" filter and a merged toc.
You just would have to have a look at the implementation.

I kind of doubt it will solve my question above since the general point of
my question is about filters or filter operators rather than about ToC's.
IMO it's not a filtering problem. It's a problem how the existing toc
builds the structure. With the experiment you can combine as may filters as
you want.

-m
--
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 ***@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/0bd0753e-9111-4426-b25b-4ed0e8dace2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Mark S.' via TiddlyWiki
2017-10-02 20:33:43 UTC
Permalink
Raw Message
Hi Mat,

As long as you are content with a solution where you have to know the
number of generations in advance, then I think this will work.

What I did for my test was to take "HelloThere" and everything that
descended from it and put it into an empty TW. Then I untagged some of the
tiddlers.

Here's the code:

<$list filter="[all[tiddlers]!is[system]!title[HelloThere]sort[]]">
<$list filter="[[HelloThere]] -[<currentTiddler>tags[]] -[<currentTiddler>tags[]tags[]]
-[<currentTiddler>tags[]tags[]tags[]]" variable="tag">
<$view field="title"/><br/>
</$list>
</$list>

In the outer loop I find all eligible tiddlers that are not "HelloThere".
In the inner loop, I insert "HelloThere" in the filter and then look at
each passed tiddler. For each passed tiddler I subtract it's tags, then
it's tag's tags, then it's tags' tag's tags etc. If there is anything left,
then that means "HelloThere" was not subtracted out and so the tiddler is
not in the tree and it gets listed.

Hopefully the logic holds up ;-)

Good luck!
Mark
Post by Mat
I have thos ToC, i.e using the root tag "menu" and below it an arbitrary
number of children and grandchildren (i.e two levels below root, but not
more)
menu
- house
---House of Lannister
---House of Stark
- place
---Winterfell
---Kings Landing
- ...
I want to complete this with a listing (i.e not part of the ToC) for all
things that are NOT tagged "house", "place", "...".
<$set name=listed filter="[tag[menu]]" >
<<list-links "[is[tiddler]!is[system]] +[!tag<listed>]">>
</$set>
...hoping for "!tag" to distribute to all elements in 'listed'. OK, I'm
not surprised it doesn't work, but what should I do?
Thanks!
<:-)
Background, mostly off-topic: I almost never watch TV and especially avoid
TV-series for fear of getting addicted. My brother insisted I watch GoT
(Game of Thrones) ... and I managed to concoct an excuse for myself that
"GoT is now part of todays common knowledge", much like classical plays
once were. (Actually, most old "classics" are today more of an intellectual
oddity than common knowledge or general knowledge. A left over from a time
when intellectual food was scarce. That is not to say they are bad... but
most would not stand a chance had they been produced today.) Anyway, it
turns out GoT is fantastic - *but* *had it not been for a TiddlyWiki to
note things in*, I would frankly not have been *capable *of following it.
There are more names and places than in the Russian classics and I'd be
lost even a few episodes in.
--
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 ***@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/1453e5a7-1b83-469b-9d60-d93c0fa5d7da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
BJ
2017-10-02 21:35:28 UTC
Permalink
Raw Message
maybe like this?

\define mylist(x)
<<list-links "[is[tiddler]!is[system]] - [tag[menu]] $x$">>
\end
<$wikify name="x" text ="""<$list
filter="[tag[menu]]">-[tag[<<currentTiddler>>]]</$list>""">
<<x>>
<$macrocall $name="mylist" x=<<x>>/>
</$wikify>
Post by Mat
I have thos ToC, i.e using the root tag "menu" and below it an arbitrary
number of children and grandchildren (i.e two levels below root, but not
more)
menu
- house
---House of Lannister
---House of Stark
- place
---Winterfell
---Kings Landing
- ...
I want to complete this with a listing (i.e not part of the ToC) for all
things that are NOT tagged "house", "place", "...".
<$set name=listed filter="[tag[menu]]" >
<<list-links "[is[tiddler]!is[system]] +[!tag<listed>]">>
</$set>
...hoping for "!tag" to distribute to all elements in 'listed'. OK, I'm
not surprised it doesn't work, but what should I do?
Thanks!
<:-)
Background, mostly off-topic: I almost never watch TV and especially avoid
TV-series for fear of getting addicted. My brother insisted I watch GoT
(Game of Thrones) ... and I managed to concoct an excuse for myself that
"GoT is now part of todays common knowledge", much like classical plays
once were. (Actually, most old "classics" are today more of an intellectual
oddity than common knowledge or general knowledge. A left over from a time
when intellectual food was scarce. That is not to say they are bad... but
most would not stand a chance had they been produced today.) Anyway, it
turns out GoT is fantastic - *but* *had it not been for a TiddlyWiki to
note things in*, I would frankly not have been *capable *of following it.
There are more names and places than in the Russian classics and I'd be
lost even a few episodes in.
--
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 ***@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/97a4e5e2-bfff-47e0-aec1-80ce914e45ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
RichardWilliamSmith
2017-10-02 22:28:24 UTC
Permalink
Raw Message
Hi Mat,

I do something similar. I use this tiddler (which I call nonTOC)

<$list
filter="[!is[system]!tag[TOC]]-[[TOC]tagging[]tagging[]]-[[TOC]tagging[]tagging[]tagging[]]-[[TOC]tagging[]tagging[]tagging[]tagging[]]">
</$list>
and transclude it at the bottom of the TOC Tiddler. I just use it to show
me which ones are missing from my hierarchy.

Regard,
Richard
I have thos ToC, i.e using the root tag "menu" and below it an arbitrary
number of children and grandchildren (i.e two levels below root, but not
more)
menu
- house
---House of Lannister
---House of Stark
- place
---Winterfell
---Kings Landing
- ...
I want to complete this with a listing (i.e not part of the ToC) for all
things that are NOT tagged "house", "place", "...".
<$set name=listed filter="[tag[menu]]" >
<<list-links "[is[tiddler]!is[system]] +[!tag<listed>]">>
</$set>
...hoping for "!tag" to distribute to all elements in 'listed'. OK, I'm
not surprised it doesn't work, but what should I do?
Thanks!
<:-)
Background, mostly off-topic: I almost never watch TV and especially avoid
TV-series for fear of getting addicted. My brother insisted I watch GoT
(Game of Thrones) ... and I managed to concoct an excuse for myself that
"GoT is now part of todays common knowledge", much like classical plays
once were. (Actually, most old "classics" are today more of an intellectual
oddity than common knowledge or general knowledge. A left over from a time
when intellectual food was scarce. That is not to say they are bad... but
most would not stand a chance had they been produced today.) Anyway, it
turns out GoT is fantastic - *but* *had it not been for a TiddlyWiki to
note things in*, I would frankly not have been *capable *of following it.
There are more names and places than in the Russian classics and I'd be
lost even a few episodes in.
--
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 ***@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/309cc721-fb5a-4526-9c92-124f43834d74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...