Hi Vincent,

First of all I don't know why do we need to wrap the anchor in a span 
and not put the "wikilink" class directly on the anchor. I see there are 
no CSS rules attached to it so I guess is has a semantic purpose. 
Furthermore, what do you think about using custom attributes on the 
anchor, like xwiki:doc="Main.WebHome"?

Anyway, I'll be able to detect/inset if it's either span or comment or 
custom attributes. One note though: in the case of span or comment I'll 
have to take care when I'm inserting other DOM nodes so the link DOM 
fragment is taken as a unit. For instance, I shouldn't inset strong or 
em between the span and the anchor.

Vincent Massol wrote:
> Hi,
> 
> Since recognizing links to be xwiki links is hard (not even always  
> possible) we need to add some extra information when we render wiki  
> syntax content into XHTML (for the WYSIWYG editor for ex) so that we  
> can convert it back to wiki syntax.
> 
> We have 2 solutions I can think of:
> 
> 1) Using a span with a class value:
> 
> <span class="wikilinkplaceholder wikilink"><! 
> [CDATA[Space.ExistingPage]]><a href="/xwiki/bin/view/Space/ 
> ExistingPage">Space.ExistingPage</a></span>
> 
> 2) Using a comment:
> 
> <!-- startwikilink:Space.Existing --><span class="wikilink"><a href="/ 
> xwiki/bin/view/Space/ExistingPage">Space.ExistingPage</a></span><!--  
> stopwikilink -->
> 
> Pros and cons:
> 
> * 2) allows not generating visible content in XHTML so that if someone  
> copy/paste our generated XHTML he won't have to add some CSS rule to  
> prevent it from being visible. BTW I'm not even sure we can find a CSS  
> rule to do that in solution 1) so we might need to have 2 spans as in:
> <span class="startwikilink"><![CDATA[Space.ExistingPage]]></span><span  
> class="wikilinkplaceholder wikilink"><a href="/xwiki/bin/view/Space/ 
> ExistingPage">Space.ExistingPage</a></span><span class="stopwikilink"/>
> 
> * 1) is harder to code since it requires using a SAX2 LexicalHandler,  
> which btw is not supported by all XML parsers:
> "This is an optional extension handler for SAX2 to provide lexical  
> information about an XML document, such as comments and CDATA section  
> boundaries. XML readers are not required to recognize this handler,  
> and it is not part of core-only SAX2 distributions."
> It also requires that I make some modifications to wikimodel since  
> wikimodel currently ignores comments.
> 
> 
> Solution 2) seems slightly better to me but as it's quite more complex  
> to implement I'd like to be sure that it's the best solution.
> 
> WDYT?
> 
> Thanks
> -Vincent
> 
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to