From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: [RFC] New "kbd" macro? Date: Wed, 13 Sep 2017 14:03:53 +0000 Message-ID: References: <87377qpwc7.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="f403045da7e0ec0d2e055912a13f" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ds8Gy-0000vc-Ib for emacs-orgmode@gnu.org; Wed, 13 Sep 2017 10:04:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ds8Gr-0000w6-IV for emacs-orgmode@gnu.org; Wed, 13 Sep 2017 10:04:11 -0400 Received: from mail-yw0-x230.google.com ([2607:f8b0:4002:c05::230]:44430) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ds8Gr-0000vO-CR for emacs-orgmode@gnu.org; Wed, 13 Sep 2017 10:04:05 -0400 Received: by mail-yw0-x230.google.com with SMTP id r85so763014ywg.1 for ; Wed, 13 Sep 2017 07:04:05 -0700 (PDT) In-Reply-To: <87377qpwc7.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou , Org Mode List Cc: Oleh Krehel --f403045da7e0ec0d2e055912a13f Content-Type: text/plain; charset="UTF-8" On Wed, Sep 13, 2017 at 9:23 AM Nicolas Goaziou wrote: > Hello, > > I would like to submit a new minor macro for integration within Org: the > "kbd" macro. > Awesome! > The "kbd" macro focuses on normalizing keybinding during export. For > example, during Texinfo export, {{{kbd(v SPC)}}} becomes > > @kbd{v @key{SPC}} > > whereas in another back-end, it becomes > > v > Can we have {{{kbd(v SPC)}}} export to below for HTML? v SPC It will be tremendously useful for blog posts. At the moment, I use this hack[1] in ox-hugo.el. *Also stuff within angle brackets will hide in HTML if you choose to leave the export as "v " for HTML too!* More specifically: > > Within {{{kbd(...)}}}, the following case-sensitive keys are wrapped > within angle brackets: SPC, RET, LFD, TAB, BS, ESC, DELETE, SHIFT, > CTRL, META, up, down, left, right. > > With an optional argument, it can wrap the key-binding within verbatim > or code markup: > > {{{kbd(v SPC,code)}}} => ~v ~ > > {{{kbd(v SPC,verbatim)}}} => =v = > Looks good. Granted, this is probably only useful for Texinfo export, but defining > it as a global macro makes Org documents a bit more portable across > export back-ends. > For HTML too! :) If there is any interest in it, I will add tests and documentation. > I attach a proof of concept. > +1 Copying Oleh, as I believe he would also have some interest in this. -- Kaushal Modi --f403045da7e0ec0d2e055912a13f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Sep 13= , 2017 at 9:23 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
Hello,

I would like to submit a new minor macro for integration within Org: the "kbd" macro.

Awesome!
=C2=A0
The "kbd" macro foc= uses on normalizing keybinding during export. For
example, during Texinfo export, {{{kbd(v SPC)}}} becomes

=C2=A0 @kbd{v @key{SPC}}

whereas in another back-end, it becomes

=C2=A0 v <SPC>

Can we have {{{kbd= (v SPC)}}} export to below for HTML?

<kbd>v = <span class=3D"key">SPC</span></kbd>
=
It will be tremendously useful for blog posts. At the moment= , I use this hack[1] in ox-hugo.el.
=C2=A0
*Also st= uff within angle brackets will hide in HTML if you choose to leave the expo= rt as "v <SPC>" for HTML too!*

More specifically:

=C2=A0 Within {{{kbd(...)}}}, the following case-sensitive keys are wrapped=
=C2=A0 within angle brackets: SPC, RET, LFD, TAB, BS, ESC, DELETE, SHIFT, =C2=A0 CTRL, META, up, down, left, right.

With an optional argument, it can wrap the key-binding within verbatim
or code markup:

=C2=A0 {{{kbd(v SPC,code)}}}=C2=A0 =C2=A0 =C2=A0 =3D>=C2=A0 ~v <SPC&g= t;~

=C2=A0 {{{kbd(v SPC,verbatim)}}}=C2=A0 =3D>=C2=A0 =3Dv <SPC>=3D
=C2=A0
Looks good.

Granted, this is probably only useful for Texin= fo export, but defining
it as a global macro makes Org documents a bit more portable across
export back-ends.

For HTML too! :)

If there is any interest in = it, I will add tests and documentation.
I attach a proof of concept.

+1=C2=A0

Copying Oleh, as I believe he would also have s= ome interest in this.
--

= Kaushal Modi

--f403045da7e0ec0d2e055912a13f--