Hi,
Here's the previous example with using the rendering script service and the
effect of changing the context document seem to be what you wanted to
achieve:
{{velocity}}
$xcontext.doc
$services.rendering.render($services.rendering.parse("[[test>>test]]",
"xwiki/2.1"), "html/5.0")
$xcontext.setDoc($xwiki.getDocument('Sandbox.WebHome').document)
$services.rendering.render($services.rendering.parse("[[test>>test]]",
"xwiki/2.1"), "html/5.0")
$xcontext.doc
{{/velocity}}
Thanks,
Eduard
On Thu, Oct 8, 2015 at 5:23 PM, Eduard Moraru <[email protected]> wrote:
> Hi,
>
> You did not mention how you are doing the "conversion". Are you using the
> rendering script service?
>
> Anyway, one thing I can think of is to set the context document before
> starting the conversion process. Here is a snippet that would exemplify
> this:
>
> {{velocity}}
> $xcontext.doc
> $xcontext.setDoc($xwiki.getDocument('Sandbox.WebHome').document)
> $xcontext.doc
> {{/velocity}}
>
> Note that it requires Programming Right (on the author user) to be able to
> be executable.
>
> Hope this helps,
> Eduard
>
>
> On Wed, Oct 7, 2015 at 12:38 PM, Peter Huisman <[email protected]> wrote:
>
>> Hi,
>>
>> I am using a conversion from XWiki syntax to XHTML which is working like
>> a charm. The challenge I have however is the following:
>>
>> I am running a (test velocity) script from the Sandbox space. I am
>> converting documents in a different space (let’s say AAAA).These documents
>> contain objects with textarea’s where the references are in the form of
>> [[text>>doc:filename]] since it refers to documents in the AAAA space. The
>> conversion of XWiki links is “going down the drain” since the converter is
>> using the Sandbox space to resolve the reference to the page and generates
>> a create reference to the file.
>>
>> Is there an easy way to set the (default) space (in either Java or
>> Velocity) without having to run the script from the actual space (in this
>> case, the AAAA space)?
>>
>> Br,
>>
>> Peter
>> _______________________________________________
>> users mailing list
>> [email protected]
>> http://lists.xwiki.org/mailman/listinfo/users
>>
>
>
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users