[TW5] Some Custom Operator Helps

109 views
Skip to first unread message

Penguinlay

unread,
Jan 26, 2017, 5:58:41 AM1/26/17
to TiddlyWiki
Operators to filter:
  1. Whether tiddlers which has hard links to other tiddlers (Not links operator. I want to use links operator only on tiddlers that has at least one hard link to others).
  2. All tiddlers including system which is an orphan, and all tiddlers including system which is not an orphan (is[orphan] does not include system orphan tiddlers, and its negation includes all system tiddlers).

Tobias Beer

unread,
Jan 26, 2017, 1:43:25 PM1/26/17
to TiddlyWiki
Hi Penguinlay,

I'm afraid this time you haven't made your request all too clear.

Whether tiddlers which has hard links to other tiddlers (Not links operator. I want to use links operator only on tiddlers that has at least one hard link to others).

I didn't understand what you want here. If it's not the links operator you're after, perhaps it's the backlinks operator? 

All tiddlers including system which is an orphan, and all tiddlers including system which is not an orphan (is[orphan] does not include system orphan tiddlers, and its negation includes all system tiddlers).

Why would you want a list of orphaned system tiddlers? Possibly create a ticket on GitHub for it.

One way to perhaps implement it could be...

is[orphan:system]

Best wishes,

Tobias.

Penguinlay

unread,
Jan 26, 2017, 8:31:09 PM1/26/17
to TiddlyWiki
Thank you for reply, Tobias! Sorry for confusing question.


I'm afraid this time you haven't made your request all too clear.

Whether tiddlers which has hard links to other tiddlers (Not links operator. I want to use links operator only on tiddlers that has at least one hard link to others).

I didn't understand what you want here. If it's not the links operator you're after, perhaps it's the backlinks operator? 

  1. It is neither links nor backlinks operator.
  2. I want to make myself a warning with custom view template whenever a tiddler has hard links to other tiddlers.
  3. But, I only want to show the warning if there exists hard links to other tiddlers in the current tiddler. In other words, I want to show warning to myself only if the results by using links operator is not empty.
  4. So, what I want is to check if there are hard links to other tiddlers in current tiddlers (the same idea as those times when I only want to deal with tiddlers that have a particular tag or a particular field, etc.).
  5. If there are hardlinks, then show the warning! If not, do nothing.
  6. That's why I was finding a way to check conditionally. (is operator does not have option for it.)
 
All tiddlers including system which is an orphan, and all tiddlers including system which is not an orphan (is[orphan] does not include system orphan tiddlers, and its negation includes all system tiddlers).

Why would you want a list of orphaned system tiddlers? Possibly create a ticket on GitHub for it.

One way to perhaps implement it could be...

is[orphan:system]
  1. In fact, it is not particularly a list of orphaned system tiddlers that I am interested in.
  2. I want a list of all the possible tiddlers there in TW that is not orphan.
  3. So, I am dealing with a list of orphaned system tiddlers, which then be negated to get what I want.
  4. Again, I am planning to write a custom view template like the above, a warning, but this time is about tiddlers getting from backlinks operator.
  5. I want to make myself a warning with custom view template whenever a tiddler has been linked from other tiddlers so that I don't accidently change the tiddler name if there are hard links to current tiddler.
  6. But, I only want to show the warning if there exists hard links from other tiddlers to current tiddler. In other words, I want to show warning to myself only if the results by using backlinks operator is not empty.
  7. This is exactly where I want to use "not orphan", but the only problem is the use of orphan is only limited to non-system tiddlers, and in turn, limit the filter of "not orphan".
  8. Since orphan filters all non-system tiddlers, negation of orphan results in a list of tiddlers which include non orphan non system tiddlers along with all the system tiddlers excluding shadow tiddlers.
  9. So, my intention is to check all tiddlers (including created, system and shadow) and if there are any hard links to those, give myself a warning so that I can open all those tiddlers which has hard links to current tiddlers and edit ahead.

Tobias Beer

unread,
Jan 27, 2017, 1:35:00 AM1/27/17
to TiddlyWiki
Hi Penguinlay,

It's very important to try to communicate why you want what behavior
rather than only how you think it seems to not work.

Only your goals and based on that your requirements / intentions reveal whether
you're on the right track with the solution you envisioned or not.

So, "ViewTemplate" and "current Tiddler" are crucial to what you want to achieve.

Anyway, to see if the current tiddler has links, you use the links operator indeed and all[current]:..

<$list filter="[all[current]links[]limit[1]]">

These are the links...

{{{ [all[current]links[]sort[title]] }}}
</$list>

As for the current tiddler not not being an orphan then it's...

<$list filter="[all[current]!is[orphan]!is[system]]">

This is neither an orphan (nor a "false non-orphan"
in the form of a system tiddler)...
</$list>


Best wishes,

Tobias.
Reply all
Reply to author
Forward
0 new messages