On Thu, Oct 8, 2015 at 6:18 PM, [email protected] <[email protected]>
wrote:

>
>
>
>
>
> On 8 Oct 2015 at 17:14:39, Eduard Moraru ([email protected](mailto:
> [email protected])) wrote:
>
> > On Thu, Oct 8, 2015 at 5:33 PM, [email protected]
> > wrote:
> >
> > >
> > >
> > >
> > > On 8 Oct 2015 at 16:23:51, Eduard Moraru ([email protected](mailto:
> > > [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.
> > >
> > > BTW Edy, we have a {{context}} macro for doing this :)
> > >
> > > See
> > > http://extensions.xwiki.org/xwiki/bin/view/Extension/Context+Macro
> > >
> >
> > Did not know about this one.
> >
> > However, it seems limited to links and images, as the description says.
>
> No it’s not limited. It just uses:
>
> this.documentAccessBridge.pushDocumentInContext(backupObjects,
> docReference);
>
> + set the new source in the XDOM metadata
>
> So it should work for almost everything.
>

Ah, right. The trick is on the order of the macro usage though, since you
need to do context > velocity > code instead of velocity > context > code.
But even so, since the velocity context is isolated in that code, you can
not grab any result produced by that nested code piece to process in a
separate top level velocity macro, so it's only useful for displaying the
output of some velocity code executed *entirely* in the context of a
different page. So, at the end of the day, it's less useful, IMO.

Thanks,
Eduard

>
> Thanks
> -Vincent
>
> > Also, it is not really meant to be used programatically (i.e. velocity),
> so
> > not very useful in the current usecase, since you can`t grab the result
> in
> > velocity.
> >
> > Thanks,
> > Eduard
> >
> >
> > > 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
> > > > > [email protected]
> > > > > http://lists.xwiki.org/mailman/listinfo/users
> > > > >
> > > > _______________________________________________
> > > > users mailing list
> > > > [email protected]
> > > > http://lists.xwiki.org/mailman/listinfo/users
> > > _______________________________________________
> > > users mailing list
> > > [email protected]
> > > http://lists.xwiki.org/mailman/listinfo/users
> > >
> > _______________________________________________
> > users mailing list
> > [email protected]
> > http://lists.xwiki.org/mailman/listinfo/users
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to