You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-dev@maven.apache.org by Jason van Zyl <ja...@maven.org> on 2008/01/01 19:36:09 UTC

Re: Need for onWords events (and more)?

On 31 Dec 07, at 5:10 AM 31 Dec 07, Vincent Massol wrote:

>
> On Dec 31, 2007, at 1:45 PM, Vincent Massol wrote:
>
>> Hi,
>>
>> I've been thinking about some use case we might have in XWiki and  
>> I'm wondering how to solve them using Doxia.
>>
>> Imagine we want the rendering process to automatically look for  
>> word definition on, say, wikipedia, and when found, highlight the  
>> word and make the definition appear when the mouse hover over the  
>> word.
>
> This is probably not the best use case since a better way of  
> implementing this would be with a {definition} macro.
>
> Here's another one: adding support for wikiwords and render them as  
> links.
>

I think adding word processing to the API would be a good thing.  
That's probably a pretty common use case.

> Of course if this is a core feature it can be implemented in the  
> parser itself. However in case of XWiki it's not a core feature but  
> I know some users have asked for it. The way we currently support  
> this is by allowing users to customize the rendering process by  
> adding radeox filters. The way I would expect users to do it with  
> Doxia would be by extending the XWiki Sink classes or providing  
> their own Sink. I think it would be way harder to offer hook points  
> into the parser for users.

I think if we covered all typographical formatting (bold, italic), and  
word processing I think the API would be pretty complete. If you were  
to do any sort of common processing like index a document with lucene  
you need to get at the word tokens.

>
>
>> How would we do this with Doxia since there's no onWord event?
>
> Of course it's possible for the sinks to parse the strings passed to  
> the text() event. However this is probably a job best left to the  
> parsers IMO.
>

I think making an addition to the API to allow finer grained access to  
the words would be great.

I think wiki-model might a little over the top with the things it  
gives access to. I think if we look at your cases, and the common case  
of indexing we'll find what level of granularity we need. But  
processing words I think is something valuable to add.

> WDYT?
>
>> Wikimodel does have such an event (they even have events such as  
>> onSpace and onSpecialSymbol, onEmptyLines, onEscape, etc):
>> http://tinyurl.com/yuuh2d
>
> Thanks
> -Vincent
>

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
jason at sonatype dot com
----------------------------------------------------------

Script timed out




Re: Need for onWords events (and more)?

Posted by Vincent Massol <vi...@massol.net>.
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