listmacrossidebartiddlywikitiddlywiki5

In TiddlyWiki (5) my macro works in tiddlers, except when appearing as sidebar


My global macro shows a list of all tiddlers with a certain tag. The tag is taken from the list field of the tiddler that calls the macro. The macro works fine when used in a regular tiddler, but if I set the tiddler to be a sidebar via $:/tags/SideBar, the sidebar shows the tab, but nothing inside.

My original version worked when the macro was called when I explicitly identified the tag as follows: <<activityList book>>, but what I really want is to put the tag (book) in a field and pull that: <$macrocall $name=activityList category={{!!list}} />.

I made another version that worked as follows: It used the same macro call as above, but now the list field had [book] in it, as in <<revisedActivityList [book]>>.

This is the first macro (the 3rd and 4th lines are not relevant, they are just the output):

\define activityList(category:""  tag:"tag[") 
<$list filter="[$tag$$category$]]">
&raquo; <$link to=<<currentTiddler>>><$view field=title/></$link><br>
{{||$:/core/ui/ViewTemplate/tags}}
</$list>

called by:

<$macrocall $name=activityList category={{!!list}} />

In this version, the brackets are provided by the list macro filter parameter. note the unusual second parameter (which allows me to switch from searching by tag to searching by another filter function, such as has or is). This is not really necessary, but I found it worked.

I reworked this to fix the brackets and put the brackets in the list FIELD, thinking that was the issue.

\define revisedActivityList(category:"" tag:"tag") 
<$list filter="[$tag$$category$]">
&raquo; <$link to=<<currentTiddler>>><$view field=title/></$link><br>
{{||$:/core/ui/ViewTemplate/tags}}
</$list>

Solution

  • It turns out that "tiddlers in the sidebar do not have the current tiddler set". That's the source of the problem.