Hi
For starters, you could replace the 3 $set widgets with a $vars widget:
\define d()
$:/temp/$(currentTiddler)$!!$(a)$
\end
\define toggle-body(a,b,c)
<$vars a="""$a$""" b="""$b$""" c="""$c$""">
<$reveal type="match" state=<<d>> text="">
<$button set=<<d>> setTo=<<b>> class="tc-btn-invisible">
<$transclude tiddler=<<a>> />
</$button>
</$reveal>
<$reveal type="nomatch" state=<<d>> text="">
<$button set=<<d>> setTo={{$c$!!target}} class="tc-btn-invisible">
<$transclude tiddler=<<c>> />
</$button>
</$reveal>
</$vars>
\end
\define toggle(a)
<$macrocall $name="toggle-body" a=$a$ b={{$a$!!target}} c={{$:/temp/$(
currentTiddler)$!!$a$}}/>
\end
regards
On Wednesday, 21 October 2015 06:46:24 UTC+2, Andrew wrote:
>
> Is there any way to rewrite the following any more elegantly?
> \define d()
> $:/temp/$(currentTiddler)$!!$(a)$
> \end
>
> \define toggle-body(a,b,c)
> <$set name="a" value="""$a$""">
> <$set name="b" value="""$b$""">
> <$set name="c" value="""$c$""">
> <$reveal type="match" state=<<d>> text="">
> <$button set=<<d>> setTo=<<b>> class="tc-btn-invisible">
> <$transclude tiddler=<<a>> />
> </$button>
> </$reveal>
> <$reveal type="nomatch" state=<<d>> text="">
> <$button set=<<d>> setTo={{$c$!!target}} class="tc-btn-invisible">
> <$transclude tiddler=<<c>> />
> </$button>
> </$reveal>
> </$set>
> </$set>
> </$set>
> \end
>
> \define toggle(a)
> <$macrocall $name="toggle-body" a=$a$ b={{$a$!!target}}
> c={{$:/temp/$(currentTiddler)$!!$a$}}/>
> \end
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/1c2ef764-90ad-41cc-aba6-0196f8f568f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.