Hi,
Yes, and make sure to restore the context document (generally in a finally
block) once your service finishes with the conversions.
Thanks,
Eduard
On Fri, Oct 9, 2015 at 9:51 AM, Peter Huisman <p.huisman(a)ximm.nl> wrote:
Hi,
That is what I expected. I am however calling a java service for this
where I’m going through a list of documents and doing the conversion. I
expect that I have to set the document in the context from within the
service?
Thanks for the answers,
Peter
On 8 Oct 2015 at 16:23:51, Eduard Moraru (enygma2002(a)gmail.com <mailto:
enygma2002@gmail.com>(mailto:enygma2002@gmail.com <mailto:
enygma2002(a)gmail.com>)) 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.
BTW Edy, we have a {{context}} macro for doing this :)
See
http://extensions.xwiki.org/xwiki/bin/view/Extension/Context+Macro <
http://extensions.xwiki.org/xwiki/bin/view/Extension/Context+Macro>
Thanks
-Vincent
Hope this helps,
Eduard
On Wed, Oct 7, 2015 at 12:38 PM, Peter Huisman 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
> users(a)xwiki.org <mailto:users@xwiki.org>
>
http://lists.xwiki.org/mailman/listinfo/users <
http://lists.xwiki.org/mailman/listinfo/users>
_______________________________________________
users mailing list
users(a)xwiki.org <mailto:users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users <
http://lists.xwiki.org/mailman/listinfo/users>
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users