-----Original Message----- From: wikitext-l-bounces@lists.wikimedia.org [mailto:wikitext-l-bounces@lists.wikimedia.org] On Behalf Of Daniel Kinzler Sent: 13 February 2008 14:57 To: Wikitext-l Subject: Re: [Wikitext-l] Draft 10 published
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.
Your not going to get 100% compatibility moving from the multiple search/replace method into a single parse.
Hooks embedded within the parser, like InternalParseBeforeLinks, ParserBeforeTidy become impossible to do.
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.
Agreed, the grammar should know how to pass and correct tag soup style HTML/XML that gets handed off to deal with.
Jared