[dokuwiki] Re: xhtml processing optimisation.

Andreas Gohr wrote:
This sounds like you're doing something on the post processing level
that you should do in syntax plugins. Can you tell us what you are
actually trying to achieve?
I have three plugins running on top of the xhtml output:

The first plugin is one that automatically turns all japanese text with phonetic guide text into XHTML 1.1 "ruby" elements. For instance, it would replace "漢字(かな)" with "<ruby><rb>漢字</rb><rp>(</rp><rt>かな </rt><rp>)</rp></ruby>". I'm not sure if that's better done as syntax plugin... on the one hand it's technically syntax, but on the other it's also just an integral action. Either way, it would seem that the amount of work is still the same, needing to run through all the text on a page.

The second operation is a glossary and index linking plugin, which runs through the text looking for {idx:indexname:term} and {gls:glossaryname:term} tags, records their position in the page, and works those positions into plugin-generated glossary and index pages. The terms are then replaced with the relevant wiki/doku.php?id=glossary:glossaryname#... and wiki/doku.php?id=index:indexname#... links. This could probably be moved to a syntax plugin, but since these tags can also appear in headings, the action plugin for this also intercepts the ToC data and rewrites it so the headers don't have {idx:...} and {gls:...} in them in the ToC nagivation area, which is something that goes beyond what a syntax plugin should do.

Third, a custom commenting system intercepts the final xhtml, and inserts "add a comment concerning this section" code under every heading, with comments linked to a heading's anchor name, which is unique (unlike the heading text itself). I couldn't find a place during the dokuwiki process before the xhtml output where unique idenfiers exist for headings, so unless I missed something I don't think I can rewrite this one to some other kind of plugin.

- Mike
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: