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: Thomas S. Dye
Subject: Re: [O] [Feature Request] - Furigana - Yomigana - Ruby
Date: Tue, 28 May 2013 05:34:53 -1000

Suvayu Ali <address@hidden> writes:

> On Tue, May 28, 2013 at 03:00:40PM +0200, Torsten Wagner wrote:
>> 
>> However, I believe that for many users, the special cases are not very
>> frequent and complex. Might it be possible to create a very simple syntax
>> for exporting rules which could be either in those above modules or
>> directly within the file written by the user themself?
>> 
>> #+HTML_USER_RULE \ruby{$1}{$2}, <ruby> $1
>> <rp>(</rp><rt>$2</rt><rp>)</rp> <\ruby>
>
> Isn't this very similar to a #+MACRO definition but with a different
> syntax and only for the HTML backend?
>
> Maybe we could allow backend specific macro expansion definitions.
> Something like:
>
>   #+HTML_MACRO: ruby <ruby> $1 <rp>(</rp><rt>$2</rt><rp>)</rp> <\ruby>
>   #+LATEX_MACRO: ruby \ruby{$1}{$2}
>
>   Then {{{ruby(東,ひがし)}}} will be expanded appropriately for
>   different backends.
>
> What do you think?
>
> Cheers,
>
> 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.

Another option would be a link:

  (org-add-link-type
   "ruby" nil
   (lambda (path desc format)
     (cond
      ((eq format 'html)
       (format "<ruby> %s <rp>(</rp><rt>%s</rt><rp>)</rp> <\ruby>" path desc))
      ((memq format '(beamer latex))
           (format "\\ruby{%s}{%s}" path desc)))))


[[ruby:東][ひがし]]

(untested)

All the best,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com



reply via email to

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