Conditional tempating in macro functions?

50 views
Skip to first unread message

Rick Yagodich

unread,
Oct 3, 2019, 6:28:49 PM10/3/19
to TiddlyWiki
Hi,

I've got a template that I call from the <<tabs>> macro (developed based on advice from morosanuae):

<$transclude tiddler=<<currentTab>> field="caption" />
<$button>
 <$action-navigate $to=<
<currentTab>> />
 <$action-sendmessage $message="tm-edit-tiddler" $param=<
<currentTab>> />
<i class="fas fa-pen-square"></i>
</$button>

Simply put, it adds a button (with a FontAwesome pen icon) to each tab which provides a one-click means of opens the tab's content tiddler for editing below the current tiddler.

However… I want to be able to apply a different template to one specific tab, based on the tiddler's title (i.e. Blank). How do I achieve that?

I have tried using <$reveal …> based on another question, but that didn't do what I wanted.

Any suggestion appreciated

TonyM

unread,
Oct 3, 2019, 6:41:02 PM10/3/19
to TiddlyWiki
Rick,

I suggest you stick to one template and put your logic in your existing one. 

<$list filter="[<currentTab>match[Blank]]" variable=nul>
  Template with blank
</$list>

<$list filter="[
<currentTab>!match[Blank]]" variable=nul>
  Template Not with blank
</$list>

Regards
Tony

Rick Yagodich

unread,
Oct 4, 2019, 2:18:12 AM10/4/19
to TiddlyWiki
Thanks Tony. That works - all down to the syntax.
Reply all
Reply to author
Forward
0 new messages