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

Reply via email to