A <ref> essentially changes the output destination of the parser.
If your building a XHTML DOM document , the ref handler just needs to switch the output destination to <li> of a references list, and lets the parser continue. </ref> resets it back to where ever it was.
And when see a <references/> tag the list is inserted into the main document.
That's how I've implemented it anyway.
Jared
This is how you can implement the extensions functionality. But that is not the goal. The goal is to provide an interface for the existing implementation of the extension to be plugged into.
That is, the grammar should NOT know about <ref>, not what it does, not even that it exists. It should simply have a facility that allows externam (php) code to handle the characters (unchanged!) between (some specific) tags.
-- Daniel