xmeta / asciidoc

Automatically exported from code.google.com/p/asciidoc
Other
0 stars 0 forks source link

Add key macro to identify a key reference or key combination #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
A very common need for computer-related documentation is to reference a key or 
key combination on a keyboard. These references are often styled in the output 
to appear as keys on a keyboard. Without proper semantics in an AsciiDoc 
document, it's not possible to identify this information in the output.

I propose adding an inline key macro that recognizes the following syntax:

key:[Enter]
key:[Ctrl+Shift+T]
key:[Ctrl+N]

I'm also considering using the target slot for a single key reference:

key:Enter[]

We could consider using the attributes for the modifiers and the target for the 
final key, as in:

key:N[Ctrl]

...however, I'm quite certain documentation writers won't find that intuitive.

In the docbook backend, each key character is mapped to <keycap> and multiple 
keys are wrapped in <keycombo>.

<keycap>Enter</keycap>
<keycombo><keycap>Ctrl</keycap><keycap>N</keycap></keycombo>

In the html backend, these element names become class names on <span> elements.

I've included an implementation and a page that shows examples in a gist:

https://gist.github.com/mojavelinux/4736691

Original issue reported on code.google.com by dan.j.allen on 8 Feb 2013 at 5:11

GoogleCodeExporter commented 9 years ago
Btw, I've thought about making two macros, one for key and one for keycombo, 
but the beauty of AsciiDoc is in it's inference. It can imply that multiple key 
entries must symbolize a key combination. There's no other reasonable 
conclusion.

Original comment by dan.j.allen on 8 Feb 2013 at 5:12

GoogleCodeExporter commented 9 years ago
The implementation also includes support for the shorthand syntax:

<Ctrl><Shift>T
<Ctrl>F5

Original comment by dan.j.allen on 8 Feb 2013 at 5:21

GoogleCodeExporter commented 9 years ago
Correct to the example. It should be:

key:[Ctrl,Shift,T]

(Notice the use of comma instead of +)

Original comment by dan.j.allen on 8 Feb 2013 at 7:58