[dokuwiki] syntax plugin for content and ToC

  • From: Michiel Kamermans <pomax@xxxxxxxxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 18 Jun 2010 13:35:37 -0700

Hi,

I wrote the xhtmlruby plugin a while ago (http://www.dokuwiki.org/plugin:xhtmlruby), which turns Japanese with phonetic guide text in parentheses into xhtml1.1 ruby markup, but I'd like to clean it up a little now that I actually have a summer vacation. The problem I ran into back when I wrote it was that it needed to apply the transformation to both the main text, as well as section headings, and consequently ToC entries, but that it should not lead to anchor text being treated. The problem is the following:

Any visible on-page text that is of the form \p{han}+(\p{kana}+) needs to be converted to <ruby><rb>han</rb><rt>kana</rt></ruby>, but invisible text such as anchors and hrefs should remain untouched.

Using a syntax plugin, I can get this to happen for the main text, but not for headings, and thus not for ToC entries. Using a preprocess action plugin I can do an integral replace on the finished page, but then the anchor text and ToC link text need special treatment, which would make it really slow.

Are there alternatives to effect this syntax replacing in page text and headings?

- Mike "Pomax" Kamermans
nihongoresources.com
--
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: