mirror of https://gitlab.com/octtspacc/OcttKB
70 lines
2.1 KiB
Plaintext
70 lines
2.1 KiB
Plaintext
created: 20220922135257709
|
|
modified: 20220925154754580
|
|
tags: $:/tags/Macro
|
|
title: $:/Macros/ltabs
|
|
|
|
<!-- The following code is almost totally derived from [[$:/core/macros/tabs]] --->
|
|
|
|
\define ltabs-button()
|
|
\whitespace trim
|
|
<$button set=<<ltabsState>> setTo=<<currentTab>> default=<<__default__>> selectedClass="tc-tab-selected" tooltip={{!!tooltip}} role="switch">
|
|
<span> [[#|$(currentTab)$]] </span>
|
|
<$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>
|
|
<<__actions__>>
|
|
</$button>
|
|
\end
|
|
|
|
\define ltabs-tab()
|
|
\whitespace trim
|
|
<$set name="save-currentTiddler" value=<<currentTiddler>>>
|
|
<$tiddler tiddler=<<currentTab>>>
|
|
<<ltabs-button>>
|
|
</$tiddler>
|
|
</$set>
|
|
\end
|
|
|
|
\define ltabs-tab-list()
|
|
\whitespace trim
|
|
<$list filter=<<__ltabsList__>> variable="currentTab" storyview="pop">
|
|
<<ltabs-tab>>
|
|
</$list>
|
|
\end
|
|
|
|
\define ltabs-tab-body()
|
|
\whitespace trim
|
|
<$list filter=<<__ltabsList__>> variable="currentTab">
|
|
<$reveal type="match" state=<<ltabsState>> text=<<currentTab>> default=<<__default__>> retain=<<__retain__>> tag="div">
|
|
<$transclude tiddler=<<__template__>> mode="block">
|
|
<$tiddler tiddler=<<currentTab>>>
|
|
<$transclude mode="block" />
|
|
</$tiddler>
|
|
</$transclude>
|
|
</$reveal>
|
|
</$list>
|
|
\end
|
|
|
|
\define ltabs(ltabsList,default,state:"$:/state/tab",class,template,buttonTemplate,retain,actions,explicitState)
|
|
\whitespace trim
|
|
<$qualify title=<<__state__>> name="qualifiedState">
|
|
<$let ltabsState={{{ [<__explicitState__>minlength[1]] ~[<qualifiedState>] }}}>
|
|
<div class={{{ [[tc-tab-set]addsuffix[ ]addsuffix<__class__>] }}}>
|
|
<div class={{{ [[tc-tab-buttons]addsuffix[ ]addsuffix<__class__>] }}}>
|
|
<<ltabs-tab-list>>
|
|
</div>
|
|
<div class={{{ [[tc-tab-divider]addsuffix[ ]addsuffix<__class__>] }}}/>
|
|
<div class={{{ [[tc-tab-content]addsuffix[ ]addsuffix<__class__>] }}}>
|
|
<<ltabs-tab-body>>
|
|
</div>
|
|
</div>
|
|
</$let>
|
|
</$qualify>
|
|
\end
|