On Sunday, April 19, 2020 at 8:05:31 AM UTC-7, MaxGyver wrote: > > 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? >
This will do what you want: \define showkey(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 With the above macro, you can then write any of the following <<key Ctrl>> <<key Ctrl Shift>> <<key Ctrl Shift A>> Note: The <$reveal> widget usually takes a "state" parameter, which is the name of a tiddler containing a text field with the value to compare. By omitting the "state" parameter, and using the "default" parameter instead, you can use $reveal to compare two literal values, without needs a tiddler in which to store a state value. enjoy, -e -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/b27cf735-69c6-455e-90bd-3219cc01feed%40googlegroups.com.

