Hi Thomas, Sorry to keep asking. I was aware xcontext the point is doc and xcontext.doc give the same result. Can you please reread the comment about the test below? I think it is a bug. Thanks for your patience, --Alaina On Thu, Mar 18, 2010 at 2:38 PM, Alaina <[email protected]> wrote:
Hi Thomas,
Thanks for your comments
* doc is the current document * context.doc is the wiki macro document
Sorry context is deprecated actually and works only with velocity, it's: * doc is the current document * xcontext.doc is the wiki macro document Looks like i'm too old on XWiki :)
That is indeed the case for velocity. However if I am using groovy I get different results.
I have the following XWiki Macro groovy-test in Page GroovyTest
{{velocity}} {{/velocity}} {{velocity}} $doc.getAttachmentURL("test.dat") {{/velocity}} {{groovy}} print("{{html}}"); print( doc.getAttachmentURL("test.dat") ); print( xcontext.doc.getAttachmentURL("test.dat",xcontext.getContext()); println("{{/html}}"); {{/groovy}}
if I put {{groovy-test /}} in the body of the page I get the following output
/xwiki/bin/download/Macros/GroovyTest/test.dat /xwiki/bin/download/Macros/GroovyTest/test.dat /xwiki/bin/download/Macros/GroovyTest/test.dat
no surprise. However, If i put the same page body int the page GroovyTestExternal the output is
/xwiki/bin/download/Macros/GroovyTestExternal/test.dat /xwiki/bin/download/Macros/GroovyTest/test.dat /xwiki/bin/download/Macros/GroovyTest/test.dat
thus the difference is with the macro language. What should I use in order to get the expected output (GroovyTestExternal) in groovy?
Thanks so much, --Alaina