Hi  Lee,

This was a bug. I've just fixed it, see http://jira.xwiki.org/jira/browse/XWIKI-1526

What happened was that the mimetypeimg macro is a velocity macro so it gets rendered first like this:

<img src="$xwiki.getSkinFile("mimetypes/word.png")" alt="[doc]" title="[doc]"/>

Then the Radeox parser executes and thinks [doc] are links and thus generate HTML for links...

The fix will be available in XWiki 1.1M4 (planned for the 6th of August)

Thanks
-Vincent

On Jul 16, 2007, at 6:18 PM, Lee Meador wrote:

I found something like this on the xWiki web site but it doesn't quite work.

This is what I put on the page.

#set($attachment=$doc.getAttachment("MyFile.doc"))
#mimetypeimg($attachment.getMimeType().toLowerCase() $attachment.getFilename().toLowerCase())


"MyFile.doc" is an attached MS Word document. (Attached to that page.)

The funny thing about it is that when the page displays it shows the ICON followed by some extra stuff that looks like this:

doc?" title=" doc?"/>

The problem seems to lie in the html where the code generated by the Velocity stuff above looks like this:

<img src="/xwiki/skins/albatross/mimetypes/word.png"
alt="<a class="wikicreatelink" href= "/xwiki/bin/edit/WARS/doc?parent=WARS.2005&editor=wysiwyg"><span class="wikicreatelinktext" >doc</span><span class="wikicreatelinkqm">?</ span></a>" title="<a class="wikicreatelink" href="/xwiki/bin/edit/WARS/doc?parent=WARS.2005&editor=wysiwyg"><span class= "wikicreatelinktext">doc</span><span class="wikicreatelinkqm" >?</span></a>"
/>

I first looked at xWiki last Thursday so I don't know much about what's going on. But that looks to me like some sort of text substitution is taking place where the contents of the "alt" is expanded into something containing a double-quote that ends the "alt" before its time. That makes the funny stuff display when it should only create an "alt" message for the image. The class "wikicreatelink" makes me suspicious as well.

So ... am I doing something wrong in the Velocity code above when I try to create the interesting icon on the page?
Or ... is something in the xwiki application messing it up? (And, if so, is there some workaround.)

Thanks.

--
-- Lee Meador