From b322a70b866656900d50dd617539cd15241115eb Mon Sep 17 00:00:00 2001 From: pmario Date: Thu, 1 Feb 2024 21:51:53 +0100 Subject: [PATCH] toc - replace reveal with conditional if --- core/wiki/macros/toc.tid | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/core/wiki/macros/toc.tid b/core/wiki/macros/toc.tid index fb3008c26..e3b982619 100644 --- a/core/wiki/macros/toc.tid +++ b/core/wiki/macros/toc.tid @@ -8,7 +8,8 @@ tags: $:/tags/Macro \procedure toc-closed-icon() $:/core/images/right-arrow -\function tf.toc-stateTitle() [[$:/state/toc]addsuffixaddsuffix[/]addsuffix] +\function tf.toc-stateTitle() [[$:/state/toc]] [] "/" [] +[join[]] + \function tf.toc-newPath() [addsuffix[/]addsuffix] @@ -63,22 +64,21 @@ This macro is _not_ used by other toc-macros If a toc-item should not show a link, the toc-caption is part of the button. So it can be clicked to open / close the branch --> \procedure toc-item(isUnlinked:"") - <$reveal type="nomatch" stateTitle=<> text="open"> - <$button setTitle=<> setTo="open" class="tc-btn-invisible tc-popup-keep"> + <% if [get[text]else[close]match[close]] %> + <$button setTitle=<> setTo="open" class="tc-btn-invisible tc-popup-keep" tooltip=<>> <$transclude tiddler=<> /> <% if [match[yes]] %> <> <% endif %> - - <$reveal type="match" stateTitle=<> text="open"> - <$button setTitle=<> setTo="close" class="tc-btn-invisible tc-popup-keep"> + <% elseif [get[text]match[open]] %> + <$button setTitle=<> setTo="close" class="tc-btn-invisible tc-popup-keep" tooltip=<>> <$transclude tiddler=<> /> <% if [match[yes]] %> <> <% endif %> - + <% endif %> \end \procedure toc-linked-expandable-body(tag,sort:"",itemClassFilter,exclude,path) @@ -88,12 +88,13 @@ This macro is _not_ used by other toc-macros <> <> - <$reveal type="match" stateTitle=<> text="open"> + + <% if [get[text]match[open]] %> <$macrocall $name="toc-expandable" tag=<> sort=<> itemClassFilter=<> exclude=<> path=<> /> - + <% endif %> \end @@ -102,12 +103,13 @@ This macro is _not_ used by other toc-macros <$qualify name="toc-state" title=<>>
  • >> <> - <$reveal type="match" stateTitle=<> text="open"> + + <% if [get[text]match[open]] %> <$macrocall $name="toc-expandable" tag=<> sort=<> itemClassFilter=<> exclude=<> path=<> /> - + <% endif %>
  • \end @@ -151,12 +153,13 @@ Shows an expandable toc. Item always have an open/close chevron <% endif %> <> - <$reveal type="match" stateTitle=<> text="open"> + + <% if [get[text]match[open]] %> <$macrocall $name="toc-selective-expandable" tag=<> sort=<> itemClassFilter=<> exclude=<> path=<> /> - + <% endif %> \end @@ -174,12 +177,13 @@ Shows an expandable toc. Item always have an open/close chevron <> <% endif %> - <$reveal type="match" stateTitle=<> text="open"> + + <% if [get[text]match[open]] %> <$macrocall $name="toc-selective-expandable" tag=<> sort=<> itemClassFilter=<> exclude=<> path=<> /> - + <% endif %> \end