<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>A</kbd>
\define key(text: "Shift") <kbd>$text$</kbd>
<<key Ctrl>>
\define combo2(key1: "Ctrl", key2: "x") <kbd>$key1$</kbd>+<kbd>$key2$</kbd>
\define combo3(key1: "Ctrl", key2: "Shift", key3: "x") <kbd>$key1$</kbd>+<kbd>$key2$</kbd>+<kbd>$key3$</kbd>
<<combo3 Ctrl Shift A>>
Macros themselves don't require that all arguments are actually used. If all are needed depends only on the logic that you create inside the macro.
\define foo(bar, baz) $bar$ and $baz$
<<foo YO>> -------> YO andHowever be careful because the first argument that you put in the macrocall is interpreted as the first parameter. So you must either specify which parameter:
<<foo bar:"YO">> ---------> and YO
(in this particular case, because there are no spaces in YO, it could actually be merely bar:YO )or give an empty argument
<<foo "" YO>> ---------> and YO<:-)
I often use the kbd tag for showing (keyboard) keys in my TiddlyWiki, like that:
\define combo3(key1: "Ctrl", key2: "Shift", key3: "x") <kbd>$key1$</kbd>+<kbd>$key2$</kbd>+<kbd>$key3$</kbd>So I can write:
<<combo3 Ctrl Shift A>>
Is is possible to create a single macro that works for either one, two or three keys?
\define key(key1,key2,key3)
\whitespace trim
<kbd>$key1$</kbd>
<$reveal text="$key2$" type="nomatch" default="">+<kbd>$key2$</kbd></$reveal>
<$reveal text="$key3$" type="nomatch" default="">+<kbd>$key3$</kbd></$reveal>
\end
<<key Ctrl>>
<<key Ctrl Shift>>
<<key Ctrl Shift A>>
\define keys(string delim:" " sep:"+")
<$list filter="[[$string$]split[$delim$]first[]]"><kbd><<currentTiddler>></kbd></$list>
<$list filter="[[$string$]split[$delim$]rest[]]"> $sep$ <kbd><<currentTiddler>></kbd></$list>
\end
<<keys "Ctrl Shift A B C D E F G">>
<<keys "Ctrl-Alt Del">>
<<keys "Control Panel, Keyboard Shortcuts" delim:"," ">" >>
<<keys "$:/editions/tw5.com/download-empty" delim:"/" " ">>
<<keys "$:/editions/tw5.com/download-empty" delim:"/" "/">>
\define kbd(string delim:" " sep:"+")
<$list filter="[[$string$]split[$delim$]first[]]"><kbd><<currentTiddler>></kbd></$list>
<$list filter="[[$string$]split[$delim$]rest[]]"> $sep$ <kbd><<currentTiddler>></kbd></$list>
\end
\define dummy-button(string delim:" " sep:" ")
<$list filter="[[$string$]split[$delim$]first[]]"><$button tooltip="demonstration button only"><<currentTiddler>></$button></$list>
<$list filter="[[$string$]split[$delim$]rest[]]"> $sep$ <$button tooltip="demonstration button only"><<currentTiddler>></$button></$list>
\end
<<kbd "Ctrl Shift A B C D E F G">> <<dummy-button "OK">>
<<kbd "Ctrl-Alt Del">>
<<kbd "Control Panel, Keyboard Shortcuts" delim:"," ">" >>
<<kbd "$:/editions/tw5.com/download-empty" delim:"/" " ">>
<<kbd "$:/editions/tw5.com/download-empty" delim:"/" "/">>
<<dummy-button "Ctrl Shift A B C D E F G">>
<<dummy-button "Ctrl-Alt Del">>
<<dummy-button "Control Panel, Keyboard Shortcuts" delim:"," ">" >>
<<dummy-button "$:/editions/tw5.com/download-empty" delim:"/" " ">>
<<dummy-button "$:/editions/tw5.com/download-empty" delim:"/" "/">>
An increasing number know it well, everyone in this thread are arguably experts. Its beauty is its flexibility. In reality macros are a very simple extensions of wiki text and widgets. Although its strength is in filters but these are very powerful and needs new concepts for many.
Those who have taken this journey and the gurus are paving the way for the next generation through support and development.
Enjoy the virtuose circle.
Regards
Tony
I write as many of my macros I can using current tiddler so they can be used in different ways and depend on less parameters.
When you generate a list in a filter they are considered tiddler titles and use current Tiddler unless you set variable=varname.
Macros based on current tiddler are often valid in others lists.
Regards
Tony
Why do you use currentTiddler as variable?