Thanks Vincent (and sorry for the late reply!) - inlined my reply: On Sun, Mar 1, 2009 at 4:41 AM, Vincent Massol <[email protected]> wrote:
Same here, the image syntax doesn't support relative paths.
I guess we could improve the link and image syntax to support paths starting with "/" and then consider them as paths relative to the context root. However it wouldn't work for relative paths such as "../../some/path".
Right now we could easily add a XWiki API to get an absolute URL from a relative one.
Note that you can still use the old syntax using the {{velocity}} {{html}}<a href="..."...{{/html}}{{/velocity}} but that's not very nice and it would be nice if it could be written using the new syntax but was made to avoid using HTML... :)
Would recognizing references starting with "/" a good solution for you? What do others think?
I guess checking for "/" at the beginning would work, or maybe some way of flagging it as a relative path would be even better (maybe something like [[image:img.png||relative=true]]). Not sure how feasible this is, or if it would make sense to do so... This is not correct. The html macro must contain HTML. This is not the
case in your example. You need this:
{{velocity}} * this works - [[image: http://localhost:8080/$xwiki.getSkinFile('icons/black-file.png<http://localhost:8080/$xwiki.getSkinFile%28%27icons/black-file.png> ') ]] * this doesn't work - {{html}}<img src="$xwiki.getSkinFile('icons/ black-file.png')"/>{{/html}} {{/velocity}}
It seems that the HTML Macro's final filter parses this last test case as 1 BulletedListBlock and 1 XMLBlock, but I'm not sure if this the expected behavior. If this is the expected behavior, the more need to get the [[image:]] tag working...
Thanks again for the great job!
Hm... kind of makes sense but, what does the wiki=true flag do, then...? It's also a bit problematic for me since I have the following (posting everything, since this might be useful for others as well): ------------------------------------------------------------------ {{velocity}}#set($serverClassFullName = "Server.ServerClass"){{/velocity}} {{velocity}}#set($serverDocumentSQL = "select distinct doc from Document as doc, doc.object(${serverClassFullName}) as obj where obj.name <> '${serverClassFullName}Template'"){{/velocity}} {{velocity}}#set($serverDocuments = $xwiki.queryManager.xwql($serverDocumentSQL).execute()){{/velocity}} There are currently {{velocity}}**${serverDocuments.size()}**{{/velocity}} document(s) containing Server objects. {{velocity}} {{html}} <table id="serverList" class="grid sortable filterable doOddEven"> <tr class="sortHeader"> <th class="selectFilter">Space</th> <th>Class</th> <th>Server</th> <th class="unsortable noFilter">Link</th> </tr> #foreach($serverDocument in $serverDocuments) #set($serverObjectSQL = "select obj.hostname, obj.prettyName, obj.urlRoot, obj.hostName from Document as doc, doc.object(${serverClassFullName}) as obj where doc.id = ${serverDocument.id}") #set($serverObjects = $xwiki.queryManager.xwql($serverObjectSQL).execute()) <tr> <td>${serverDocument.space}</td> <td>${serverDocument.name}</td> <td> #foreach($serverObject in $serverObjects) #set($server = $listtool.get($serverObject, 0)) #set($serverPrettyName = $listtool.get($serverObject , 1)) #set($serverURLRoot = $listtool.get($serverObject, 2)) #set($serverHostName = $listtool.get($serverObject , 3)) * ${serverPrettyName} - <a href="${serverURLRoot}"><img src="$xwiki.getSkinFile('icons/black-file.png')" alt="Root URL" title="Root URL" /></a> <a href="${serverHostName}"><img src="$xwiki.getSkinFile('icons/black-rss-mini.png')" alt="Host Name" title="Host Name" /></a> #end </td> <td>[[${serverDocument.name}>>${serverDocument}]]</td> </tr> #end </table> {{/html}} {{/velocity}} ------------------------------------------------------------------ This will list out all the properties of Server.ServerClass for all documents that contain a Server.ServerClass object in it. I got this to work by replacing the XWiki list syntax with: <td> <ul> #foreach($serverObject in $serverObjects) #set($server = $listtool.get($serverObject, 0)) #set($serverPrettyName = $listtool.get($serverObject , 1)) #set($serverURLRoot = $listtool.get($serverObject, 2)) #set($serverHostName = $listtool.get($serverObject , 3)) <li>${serverPrettyName} - <a href="${serverURLRoot}"><img src="$xwiki.getSkinFile('icons/black-file.png')" alt="Root URL" title="Root URL" /></a> <a href="${serverHostName}"><img src="$xwiki.getSkinFile('icons/black-rss-mini.png')" alt="Host Name" title="Host Name" /></a></li> #end </ul> </td> ... but again, not the most ideal. I also tried ending the {{html}} tag in the middle of the table, but that just became really weird. I guess custom tables like these still have to be written out in pure HTML :-( But, the new XWQL engine works veeeeeery nice :-D
Thanks -Vincent http://xwiki.com http://xwiki.org http://massol.net
Thanks again for the help :-) -- Lewis