emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [Feature Request] - Furigana - Yomigana - Ruby
Date: Tue, 28 May 2013 17:27:02 +0200	[thread overview]
Message-ID: <20130528152702.GB19186@kuru.dyndns-at-home.com> (raw)
In-Reply-To: <20130528150156.GA19186@kuru.dyndns-at-home.com>

On Tue, May 28, 2013 at 05:01:56PM +0200, Suvayu Ali wrote:
> 
> PS: Actually on second thought it is probably possible to handle this
>     with filters although I failed to find the appropriate filter.
> 
>     So you could try:
> 
>       #+MACRO: ruby <cookie><$1><$2></cookie>
> 
>     And the filter can translate the cookie to the appropriate backend
>     specific expansion.

Maybe this will work (untested): org-export-filter-paragraph-functions.  The
assumption is you will use the macro by itself in a paragraph and not on
structural elements like headlines.

  (defun sa-latex-subscript (contents backend info)
    (when (eq backend 'latex)
      (replace-regexp-in-string "<cookie><\\([^>]+\\)><\\([^>]+\\)></cookie>"
                                "\\\\ruby{\\1}{\\2}" contents))
    (when (eq backend 'html)
      (replace-regexp-in-string "<cookie><\\([^>]+\\)><\\([^>]+\\)></cookie>"
                                "<ruby>\\1<rp>(</rp><rt>\\2</rt><rp>)</rp> <\ruby>"
                                contents)))

I did not check the regular expressions at all, so please test and let us know.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

  reply	other threads:[~2013-05-28 15:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-27 22:41 [Feature Request] - Furigana - Yomigana - Ruby T.T.N.
2013-05-28 13:00 ` Torsten Wagner
2013-05-28 15:01   ` Suvayu Ali
2013-05-28 15:27     ` Suvayu Ali [this message]
2013-05-28 15:34     ` Thomas S. Dye
2013-05-29  7:20     ` Christian Moe
2013-05-29  7:30       ` Suvayu Ali
2013-05-28 15:43   ` Tristan Nakagawa
2013-05-28 17:36     ` Torsten Wagner
2013-05-29 15:20       ` Tristan Nakagawa
2013-05-29 16:46         ` Christian Moe
2013-05-29 18:15           ` Suvayu Ali
2013-05-29 18:13         ` Suvayu Ali

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=20130528152702.GB19186@kuru.dyndns-at-home.com \
    --to=fatkasuvayu+linux@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).