1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Add buttonTemplate parameter to tabs macro

This commit is contained in:
Jermolene 2017-11-13 13:56:13 +00:00
parent 464ef889f9
commit 2fd2ae993e
2 changed files with 6 additions and 2 deletions

View File

@ -1,15 +1,17 @@
title: $:/core/macros/tabs
tags: $:/tags/Macro
\define tabs(tabsList,default,state:"$:/state/tab",class,template)
\define tabs(tabsList,default,state:"$:/state/tab",class,template,buttonTemplate)
<div class="tc-tab-set $class$">
<div class="tc-tab-buttons $class$">
<$list filter="$tabsList$" variable="currentTab"><$set name="save-currentTiddler" value=<<currentTiddler>>><$tiddler tiddler=<<currentTab>>><$button set=<<qualify "$state$">> setTo=<<currentTab>> default="$default$" selectedClass="tc-tab-selected" tooltip={{!!tooltip}}>
<$tiddler tiddler=<<save-currentTiddler>>>
<$set name="tv-wikilinks" value="no">
<$transclude tiddler="$buttonTemplate$" mode="inline">
<$transclude tiddler=<<currentTab>> field="caption">
<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>
</$transclude>
</$transclude>
</$set></$tiddler></$button></$tiddler></$set></$list>
</div>
<div class="tc-tab-divider $class$"/>

View File

@ -1,6 +1,6 @@
caption: tabs
created: 20131228162203521
modified: 20150221211706000
modified: 20171113135543552
tags: Macros [[Core Macros]]
title: tabs Macro
type: text/vnd.tiddlywiki
@ -23,6 +23,8 @@ By default the tabs are arranged horizontally above the content. To get vertical
: Additional [[CSS|Cascading Style Sheets]] classes for the generated `div` elements. Multiple classes can be separated with spaces
;template
: Optionally, the title of a tiddler to use as a [[template|TemplateTiddlers]] for transcluding the content of the selected tab
;buttonTemplate
: Optionally, the title of a tiddler to use as a [[template|TemplateTiddlers]] for transcluding the content of the button for the selected tab
Within the template, the title of the selected tab is available in the <<.var currentTab>> variable.