On Thu, Mar 18, 2010 at 19:38, 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") );
> 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
>
> no surprise. However, If i put the same page body int the page
> GroovyTestExternal the output is
>
> /xwiki/bin/download/Macros/GrovvyTestExternal/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
>
>
> On Thu, Mar 18, 2010 at 12:14 PM, Alaina <[email protected]> wrote:
>> Hi everyone,
>>
>> Thanks so much for your quick answer on my previous question.
>>
>> I am trying to write a bibliography/cite macro (I am happy to share
>> once it dies something useful). I am writing the macro in a wiki page
>> and I am using groovy as scripting language.
>>
>> I would like to have access to the URL of an attachment of the page
>> the macro is used on. I am doing so by using
>>
>> doc.getAttachmentURL( <name> );
>>
>> however, the URL uses the page the Macro is saved in, not the page the
>> macro is used on. I think I managed this before using velocity.
>> So my question: what would be the right way of accessing the Document
>> of the page the macro is placed on?
>>
>>
>> Thanks for your help,
>> --Alaina
>>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
>
--
Thomas Mortagne
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users