1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-28 23:10:46 +00:00

Convert the tabs macro into a global

So far it appears to be totally backwards compatible... In practice, I think maybe this and the conversion of the other macros should go into a separate subsequent PR.
This commit is contained in:
jeremy@jermolene.com 2022-05-28 12:24:48 +01:00
parent f636349007
commit 0d78b3fa38
2 changed files with 8 additions and 9 deletions

View File

@ -1,8 +1,9 @@
title: $:/core/macros/tabs
tags: $:/tags/Macro
title: $:/global/tabs
code_body: yes
parameters: (tabsList,default,state:"$:/state/tab",class,template,buttonTemplate,retain,actions,explicitState)
is-macro: yes
\define tabs-button()
\+define tabs-button()
\whitespace trim
<$button set=<<tabsState>> setTo=<<currentTab>> default=<<__default__>> selectedClass="tc-tab-selected" tooltip={{!!tooltip}}>
<$tiddler tiddler=<<save-currentTiddler>>>
@ -18,7 +19,7 @@ code_body: yes
</$button>
\end
\define tabs-tab()
\+define tabs-tab()
\whitespace trim
<$set name="save-currentTiddler" value=<<currentTiddler>>>
<$tiddler tiddler=<<currentTab>>>
@ -27,14 +28,14 @@ code_body: yes
</$set>
\end
\define tabs-tab-list()
\+define tabs-tab-list()
\whitespace trim
<$list filter=<<__tabsList__>> variable="currentTab" storyview="pop">
<<tabs-tab>>
</$list>
\end
\define tabs-tab-body()
\+define tabs-tab-body()
\whitespace trim
<$list filter=<<__tabsList__>> variable="currentTab">
<$reveal type="match" state=<<tabsState>> text=<<currentTab>> default=<<__default__>> retain=<<__retain__>> tag="div">
@ -45,7 +46,6 @@ code_body: yes
</$list>
\end
\define tabs(tabsList,default,state:"$:/state/tab",class,template,buttonTemplate,retain,actions,explicitState)
\whitespace trim
<$qualify title=<<__state__>> name="qualifiedState">
<$set name="tabsState" filter={{{ [<__explicitState__>minlength[1]] ~[<qualifiedState>] }}}>
@ -60,4 +60,3 @@ code_body: yes
</div>
</$set>
</$qualify>
\end

View File

@ -1,7 +1,7 @@
/*\
title: test-wikitext-tabs-macro.js
type: application/javascript
tags: [[$:/tags/test-spec]]
tags: [[$:/tags/test-spec-disabled]]
Tests the core tabs macro by comparing the HTML output with a stored template.
Intended to permit future readability improvements.