emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [Feature Request] - Furigana - Yomigana - Ruby


From: Suvayu Ali
Subject: Re: [O] [Feature Request] - Furigana - Yomigana - Ruby
Date: Tue, 28 May 2013 17:27:02 +0200
User-agent: Mutt/1.5.21 (2012-12-30)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]