Updated New Macro name and a button one as well
\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:"/" "/">> On Monday, April 20, 2020 at 10:41:12 AM UTC+10, TonyM wrote: > > Max, > > Personally I have a different approach to this; and it is more general in > use. Paste this onto Tiddlywiki.com > > - If you are only making use of space delimiters anyway, do it > yourself in a single parameter > - This below defaults to space delimiter and + separator as you wish > - By using comma you can do the same for multiple words > - By using "/" you can make a system tiddler easier to read > > > \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:"/" "/">> > > Need any more features? > > Regards > Tony > > On Monday, April 20, 2020 at 1:05:31 AM UTC+10, MaxGyver wrote: >> >> Hi all, >> >> I often use the *kbd* tag for showing (keyboard) keys in my TiddlyWiki, >> like that: >> >> <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>A</kbd> >> >> Typing this a lot is no fun, so I made a macro: >> >> \define key(text: "Shift") <kbd>$text$</kbd> >> >> It can be used this way: >> >> <<key Ctrl>> >> >> Now I could call this macro two or three times for creating a key >> combination. But it's even easier with additional macros: >> >> \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> >> >> So I can write: >> >> <<combo3 Ctrl Shift A>> >> >> which generates the key combination of my example at top. >> >> Just for curiosity: >> Is is possible to create a single macro that works for either one, two or >> three keys? >> >> Best regards, >> Max >> > -- 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 tiddlywiki+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/0d2d6c02-f5b9-4aff-a1ad-2af2d768a71b%40googlegroups.com.