tabs macro buttonTemplate

275 views
Skip to first unread message

A Gloom

unread,
Feb 4, 2020, 6:42:58 AM2/4/20
to TiddlyWiki

I assume this is how to do a basic buttonTemplate for the tabs macro -- I looked at the tab content currentTiddler template shown on the tiddlywiki documentation and postulated that same approach would work for a basic buttonTemplate.  (The example showed wrapping a transclusion in the macro in a tiddler widget.)

the buttonTemplate code:


@@.ragsfiledisplay
<$transclude tiddler=<<currentTab>> field="caption">
<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>
</$transclude>
@@



I didn't need a full blown custom template...
I just duplicated the macro's transclusion that was nested in the macro's buttonTemplate' transclusion *(hard to tell if the nested translusion was a fall-back or not), so I can wrap it in a css class for small caps font-variant-- adding the class to the tabs macro class parameter is not desired because I don't want it also being applied to the tabs' contents.

It works as far as I can tell...

I asssume this kind of basic template would allow me to create templates to change the caption transclusion to any field desired-- without cloning and hacking the tabs macro.

Mark S.

unread,
Feb 4, 2020, 10:04:54 AM2/4/20
to TiddlyWiki
This puzzles me:

<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>

This means you're invoking the actual contents of the current tiddler (in a tab) as a macro. It appears to be the fallback if the caption field isn't available.

I'm wondering why it isn't just:

<$text text=<<currentTab>>/>

If it works .... ok I guess. Be sure to test your code without a caption field to see what happens.

A Gloom

unread,
Feb 4, 2020, 8:25:08 PM2/4/20
to TiddlyWiki
Mark,

Always good to hear from you...

This puzzles me:

<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>

This means you're invoking the actual contents of the current tiddler (in a tab) as a macro. It appears to be the fallback if the caption field isn't available.

I'm wondering why it isn't just:

<$text text=<<currentTab>>/>


I don't know-- i just inserted that from the tabs macro code into my buttonTemplate tiddler (similitarly to how the currentTiddler template duplicates a transclusion in the macro and wraps it in a tiddler widget)

 
If it works .... ok I guess. Be sure to test your code without a caption field to see what happens.

Thanks for the suggestion-- I tried it by removing the caption field of one of the tiddlers and it's title displayed.

I tested this buttonTemplate tiddler replacing caption with different fields and it works as a simple way to change what field the core tabs macro uses for tab titles.

A Gloom

unread,
Feb 4, 2020, 8:29:37 PM2/4/20
to TiddlyWiki
postnote

<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>
vs
<$text text=<<currentTab>>/>


this for the tab button-- the title postion of the tabs display-- not the actual tab contents-- probably to prevent the tab title area from becoming a link to the tiddler?

A Gloom

unread,
Feb 6, 2020, 5:59:04 AM2/6/20
to TiddlyWiki
This buttonTemplate tiddler places a small edit button (could also be a navigate to) for the tiddler of that tab-- I know others have made such before-- but I had to do it my way


<$transclude tiddler=<
<currentTab>> field="caption">

<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>
</$transclude>  <$button message="tm-edit-tiddler" param=<<currentTab>> tooltip="Edit"> E </$button>



Mohammad

unread,
Feb 6, 2020, 6:25:13 AM2/6/20
to TiddlyWiki
Hi A Gloom,
 Would you mind to give a working example, I can test on tiddlywiki.com?

--Mohammad

A Gloom

unread,
Feb 6, 2020, 9:46:10 PM2/6/20
to TiddlyWiki
Mohammad,


 Would you mind to give a working example, I can test on tiddlywiki.com?

Certianly-- import the 2 tiddlers below into tiddlywiki com and you'll get  a tiddler with tabs for tiddlers tagged HelloThere

the only drawback is a cosmetic one -- the bottom border of the edit button gets cut off by the margin-bottom setting of the tabs macro button css-- not an issue for me but may annoy others

Clipboardtabstplate.jpg


tabs edit buttons tplate.tid
tabs macro with edit buttons.tid

Mohammad

unread,
Feb 7, 2020, 3:08:53 AM2/7/20
to TiddlyWiki
Many thanks!

Added to TW-Scripts.

Mohammad

unread,
Feb 7, 2020, 3:14:49 AM2/7/20
to TiddlyWiki
I also recommend to have a look at Mario: link to tab plugin!


--Mohammad

Mohammad

unread,
Feb 7, 2020, 3:58:34 AM2/7/20
to TiddlyWiki
I found this template is working also:


<$tiddler tiddler=<<currentTab>> >
<$view field=caption><$view field=title/></$view>
<$button message="tm-edit-tiddler"  tooltip="Edit">E</$button>
</$tiddler>

A Gloom

unread,
Feb 10, 2020, 2:57:19 AM2/10/20
to TiddlyWiki
Mohammad,

I also recommend to have a look at Mario: link to tab plugin!

I shall, now that I did it my way : )  Figuring these things out myself before looking for other people's solutions-- first-- helps teach the wiki workings, second-- gives one a purpose (desperately needed)

I found this template is working also:

Nice application of the caption/if not then title transclusion!  Here's one that has a button that will remove a tab from the tabslist and the tabs display

<$transclude tiddler=<<currentTab>> field="caption">
<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>
</$transclude>  <$fieldmangler tiddler=<<currentTab>>><$button message="tm-remove-tag" param="HelloThere" tooltip="Remove from tabs"> X </$button></$fieldmangler>

<!-- caution best used with tag/field specifically for tabs macro tabslist filter otherwise can remove a tag from the tiddler being removed from tabslist that is also used elsewhere, use message="tm-remove-field" if using a field instead of a tag -->


"What shall judgement be?" the skies cried.
"Fury!" the raging storms thundered.
"Solace," the gentle breezes sighed.
"Introspect..." the stillness whispered.
~~ Of Rags and Shadows

Mohammad

unread,
Feb 10, 2020, 3:14:58 AM2/10/20
to TiddlyWiki
Hi A Gloom!


On Monday, February 10, 2020 at 11:27:19 AM UTC+3:30, A Gloom wrote:
Mohammad,

I also recommend to have a look at Mario: link to tab plugin!

I shall, now that I did it my way : )  Figuring these things out myself before looking for other people's solutions-- first-- helps teach the wiki workings, second-- gives one a purpose (desperately needed)

This is a TRIZ rule. This makes one to be creative!
Reply all
Reply to author
Forward
0 new messages