felixhayashi / TW5-TiddlyMap

Map drawing and topic visualization for your wiki

Home Page:http://tiddlymap.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Evaluate $list filters before [[tw-body:link]]

dagelf opened this issue · comments

I have a bunch of nodes with complex $list filter evaluations that add links to specific other nodes based on complex tag interactions, inside templates. Even if I copy these out of the templates, they still do not evaluate.

First prize for me would be if the Edge-type filter [[tw-body:link]] would show all the links generated like this and not just hard coded links. Currently it sees almost none of my links - as most all dynamically generated like that.

A simple example, on a node I have:

<$list filter="[tag[MySite]tag[Router]]">
<$link to={{!!title}}>
<$view field="title"/><br/>
</$link>
</$list>

That lists all the routers tagged with both at MySite and Router. as links in a list. [[tw-body:link]] do not pick up links generated like this.

I am sure I am missing something trivial - but my question is - if it's possible, how? If it's not currently possible, how much work would it be to run these evaluations before [[tw-body:link]] looks for links? I would be happy to jump into the code if necessary.

(I know this is pretty late. I'm working through some backlogged issues.)

$tw.wiki.getTiddlerLinks is a core method which only examines the parseTree of the tiddlers. It's always been a limitation of that core method that it doesn't determine links for each iteration of $list widgets. This same limitation is also evident in the side-panel "missing" and "orphan" and the TiddlerInfo tabs, not just in TiddlyMap. It'd be a request to the core TiddlyWiki project to have getTiddlerLinks to consider $list widgets. They probably won't, because that would only work some of the time. Between $vars $set $let $tiddler, and indirect references, there are a million ways to create links to tiddlers that aren't immediately evident in the parseTreeNode. The only surefire way to find them all would be to do everything short of rendering the tiddler, which is expensive.

For your case (assuming you even still care), I'd recommend making a tw-filter:links edge type which looks identical to the tw-body:link type. You can put your $list widget filters in there, and then have something like the following:

<$list filter={{!!links}}>
<$link><$view field="title"/><br/></$link>
</$list>

Tiddlymap will show your links that way.