On Jan 1, 2008, at 7:36 PM, Jason van Zyl wrote:
[snip]
I think making an addition to the API to allow finer grained access to the words would be great.
ok great.
I think wiki-model might a little over the top with the things it gives access to.
Knowing Mikhail (author of wikimodel) I'm pretty sure he has added these events for a good reason. I'll try to ask him why he had a need for the other events.
Let's take the onSpecialSymbol() for example. Imagine the following use case: escaping all XML/HTML in the page. The way wikimodel does this is by sending events when the "<" and ">" chars are encountered.
How would we do this in Doxia? If we add the onWord event, then will it include special characters too? Let's say it does and we get "words" like "<img .../>". If we wanted to escape XML/HTML we would need to reparse each word and check for "<" and ">" chars. Is that the best way of doing it?
OTOH sending events for each special char is probably performance- consuming so you may not want to emit these events in all cases.
Maybe one solution would be to have different parsers for different needs. And to have 2 Sink interfaces. One for coarse-grained events and one for fine-grained ones.
WDYT? Thanks -Vincent