On Oct 6, 2008, at 12:41 PM, Sergiu Dumitriu wrote:

> Marius Dumitru Florea wrote:
>> 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"?
>
> Does the editor support namespaces? I thought it didn't... Also, does
> wikimodel/doxia support them? If they do, then this is the way to go.

Yes it sounds nice.

Since we're using Wikimodel for the XHTML parser we would only need to  
add support for it in wikimodel and in xwiki (it doesn't support them  
right now but I can modify it).

What about macros?

Here's an example:

{{velocity}}
#set ($var = "value")
{{/velocity}}

How would that be represented in an attribute?

Like this?

xwiki:macro="{{velocity}}\n#set ($var = "value")\n{{/velocity}}"

(special chars would also be encoded)

Is it an issue that it's less readable?

Is there a size limit to attributes (Since a macro can get very long)?  
Answer: I don't think so. Probably the size limit of a Java String or  
the JVM available memory.

Thanks
-Vincent

PS: ... and it seems I lost several hours of work yesterday modifying  
wikimodel to support external comment handling... My fault for working  
on weekends...

>> 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

Reply via email to