emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>,
	Org Mode List <emacs-orgmode@gnu.org>
Cc: Oleh Krehel <oleh@oremacs.com>
Subject: Re: [RFC] New "kbd" macro?
Date: Wed, 13 Sep 2017 14:03:53 +0000	[thread overview]
Message-ID: <CAFyQvY3mLEyaC4v-WSpVhiuHm=Qw5STCT-H8y0jbk4W5n25ZpA@mail.gmail.com> (raw)
In-Reply-To: <87377qpwc7.fsf@nicolasgoaziou.fr>

[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]

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!


> 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 <SPC>
>

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

<kbd>v <span class="key">SPC</span></kbd>

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 <SPC>" 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 <SPC>~
>
>   {{{kbd(v SPC,verbatim)}}}  =>  =v <SPC>=
>

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

[-- Attachment #2: Type: text/html, Size: 2782 bytes --]

  reply	other threads:[~2017-09-13 14:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13 13:22 [RFC] New "kbd" macro? Nicolas Goaziou
2017-09-13 14:03 ` Kaushal Modi [this message]
2017-09-13 14:05   ` Kaushal Modi
2017-09-13 19:25   ` Nicolas Goaziou
2017-09-14  4:45   ` Marcin Borkowski
2017-09-14 13:49   ` Oleh Krehel
2017-09-13 19:24 ` Eric S Fraga
2017-09-14  8:07 ` Rasmus
2017-09-14 22:02   ` Nicolas Goaziou
2017-09-15  7:36     ` Rasmus
2017-09-15 10:16       ` Nicolas Goaziou
2017-09-15 11:20         ` Rasmus
2017-09-15 11:52           ` Nicolas Goaziou
2017-09-15 12:54     ` Kaushal Modi
2017-09-15 13:08       ` Kaushal Modi
2017-09-15 15:53         ` Nicolas Goaziou
2017-09-17  7:20           ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY3mLEyaC4v-WSpVhiuHm=Qw5STCT-H8y0jbk4W5n25ZpA@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --cc=oleh@oremacs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).