Extend the tabs macro to allow tab contents to be templated

print-window-tiddler
Jermolene 2014-07-02 12:15:52 +01:00
rodzic f43cd5ba9c
commit e18d8a8866
2 zmienionych plików z 12 dodań i 3 usunięć

Wyświetl plik

@ -1,7 +1,7 @@
title: $:/core/macros/tabs
tags: $:/tags/Macro
\define tabs(tabsList,default,state:"$:/state/tab",class)
\define tabs(tabsList,default,state:"$:/state/tab",class,template)
<div class="tw-tab-set $class$">
<div class="tw-tab-buttons $class$">
<$list filter="$tabsList$" variable="currentTab">
@ -16,7 +16,15 @@ tags: $:/tags/Macro
<$reveal type="match" state=<<qualify "$state$">> text=<<currentTab>> default="$default$">
<$transclude tiddler=<<currentTab>> mode="block"/>
<$tiddler tiddler=<<currentTab>>>
<$transclude tiddler="$template$" mode="block">
<$transclude mode="block"/>
</$transclude>
</$tiddler>
</$reveal>

Wyświetl plik

@ -1,5 +1,5 @@
created: 20131228162203521
modified: 20140509223527667
modified: 20140702113527667
tags: macros
title: TabsMacro
type: text/vnd.tiddlywiki
@ -15,6 +15,7 @@ By default the tab control arranges the tabs horizontally with the content under
|2nd |default |Name of the tiddler containing the default tab | |
|3rd |state |String to distinguish multiple tabs within the same tiddler (use of the system tiddler prefix is recommended) |''$:/state/tab'' |
|4th |class |Additional CSS classes for the three wrappers DIV of the tab | |
|5th |template |Optional template through which to render the tab content | |
! Examples