Hi Vincent, Vincent Massol wrote: > Hi Lucien, > > On May 15, 2009, at 6:07 PM, [email protected] wrote: > >> Hi all, >> >> Since annotation prototype seems to be stable enough, > > great! > >> I'm proposing you >> to add it to myxwiki.org in order to test it and to get feed back >> about >> bugs and UI improvements. >> >> >> *Annotation location retrieval system* >> >> We chose to use a typographic alteration system in order to map a >> selection from html document to the xwiki source which had generated >> it. >> So, each non alphanumeric character is deleted whereas others becomes >> uppercase. After matching the altered selection in the altered source, >> we are enable to deduce real ''offsets'' from ''altered'' offsets >> (having previously filled a hash map). > > Could you elaborate on why do you have to remove non-alphanumeric > chars? Does it mean the annotation doesn't work with > internationalization? (like chinese chars, etc)?
see http://dev.xwiki.org/xwiki/bin/view/Design/AnnotationFeature (solution n°3) The prototype character filter only accept roman alphabet characters and numbers. Indeed this is bad because it hurts internationalization. I simply forget this aspect, so I propose that the DefaultCharacterFilter only refuse characters that has a special meaning for the wiki syntax concerned and separators characters. > > Same for why do you also have to transform all chars in uppercase? The prototype also uppercase all characters, I don't remember why I added this process, I can't justify this choice now, so I will remove it. > > Maybe the best would be if you could update the Annotations page on > http://dev.xwiki.org/xwiki/bin/view/Design/AnnotationFeature > >> *Rendering* >> In order to produce an annotated html code we inject in the document >> xwiki source marks and render it. > > When you say wiki source do you mean wiki syntax? > If so what are the markers and how do you make this work independently > of the syntax used (creole, confluence, etc even HTML input syntax)? First of all I precise that the marks are not inserted definitely in the document content. The wiki document content is not modified. Prototype insert marks in a copy of the document content string, and then trigger a rendering on obtained string. The marks aren't related to a wiki syntax they are symbolic and they only make sens inside annotation plugin ( so I don't use (% param=value %) ). The marks should not be interpreted by any parser because they allow us to retrieve the selection limit after the rendering has been processed. So it's important to retrieve them after the rendering exactly in the same state that we inserted them. So the system works independently of the synthax used. Almost in fact because we supposed that syntaxes use non alphanumeric characters for formatting information. > > The only solution I can think of is for you to use the XDOM and only > support source syntaxes for which we have a syntax renderer. Is that > what you are doing? Indeed a more elegant solution should be to use the XDOM by inserting the annotation in it, but this require to associate to offset and length of the selection in the wiki document content a couple of node (initial / final) and related offsets. According to me this is impossible (or hard to maintain) because current rendering system do not integrate offset concept, so we are not able to determine where a given character in the wiki document content is located in the XDOM (node + offset inside the node). By the way, it would be great to add this capability to XWiki Babel specs. :) > > For xwiki 2.0 syntax I guess you're using (% param=value %) for > markers right? How do you manage to do this across document elements > (for example if your selection encompasses both a header + a paragraph)? In order to fix this problem I split the span if needed. <h1><span></h1><p></span></p> becomes <h1><span></span></h1><p><span></span></p> > >> Then we replace marks by span markups. > > hmm does this mean you have written your own XHTML renderer? Why not > use the default XHTML renderer (since this is what it does for > FormatBlocks)? > Symbolic marks are replaced by span markups. Theses span aims to highlight the selection range. This not done by a new renderer but simply by a pattern replacement on the rendering string result. >> In order to avoid ''tag crossing'' (<c><d></c></d>) annotation zone >> can >> be splited in several span tags. >> >> *Architecture and Installation* >> >> This feature implementation can be divided in three modules : >> >> http://svn.xwiki.org/svnroot/xwiki/sandbox/xwiki-plugin-annotation/ >> This plugin provide the logic side of the feature: >> - determining annotation location >> - adding annotation to the document >> - rendering and injection of span > > hmmm I think this would be written as components using the new > architecture. Why do you need a plugin for? And if you need a plugin > the 3 features you've listed should be done as components IMO. Yes of course I explained it wrong, these 3 features are located in the same plugin. Moreover there is no need for a plugin, so I agree to make it a component. > >> it require a standard plugin installation process. >> >> http://svn.xwiki.org/svnroot/xwiki/sandbox/xwiki-rest-annotation/ >> This module provide a rest interface in order to communication with >> plugin. >> >> Communication is done using this rest resource : >> http://{host}/xwiki/rest/wikis/xwiki/spaces/{space}/pages{page}/ >> annotation >> >> A GET request returns generated and annotated html and the set of >> annotations in the page. >> >> A PUT request aims to add an annotation to resource. >> >> To install it, web.xml must be modified: >> <!-- RESTful API Restlet servlet --> >> <servlet> >> <servlet-name>RestletServlet</servlet-name> >> <servlet-class> >> org.xwiki.rest.XWikiRestletServlet >> </servlet-class> >> <init-param> >> <param-name>resources</param-name> >> <param-value> >> ... >> com.xpn.xwiki.rest.annotation.AnnotationService; >> </param-value> >> </init-param> >> ... > > It's too complex for the users and not dynamic enough IMO. I suggest > you work with Fabio to provide a generic REST servlet that can be > extended internally using components when we need to add new REST APIs. Ok, I will see that. > >> http://svn.xwiki.org/svnroot/xwiki/sandbox/xwiki-application-annotation/ >> >> This is the client side of the feature, it use rest interface in order >> to request an annotation, retrieve html annotated content and put in >> the >> DOM. >> it's a xar package which must be imported. >> >> *Prototype usage* >> Just select a non dynamique data in page content, an annotation >> edition >> box should appear, fill it and validate. >> To display annotation just click on Annotations > Show annotations >> menu >> item. > > Annotation is a great feature for XWiki. What you've done sounds good > and I'm very eager that we work together from now on to integrate this > into XWiki core/XE. Thank you for your support! > > 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

