[xwiki-users] Fw : Re: Fw : Re: Fw : Include & Co board effect
--- En date de : Lun 14.9.15, Thomas Mortagne <[email protected]> a écrit :
De: Thomas Mortagne <[email protected]> Objet: Re: [xwiki-users] Fw : Re: Fw : Include & Co board effect À: "Pascal BASTIEN" <[email protected]>, "XWiki Users" <[email protected]> Cc: "[email protected]" <[email protected]> Date: Lundi 14 septembre 2015, 16h40 On Mon, Sep 14, 2015 at 4:02 PM, Pascal BASTIEN <[email protected]> wrote:
Ok thxs for your answer, but in fact I (try to) explain 2 problems with include functions with velocity: - main problem with include: in a main doc you can not call a custom velocity macro (ie foo) with include if this macro is declared in another page.
Main doc containing something like this:
{{include reference="BacASable.PageWithACustomMacro" /}}
#foo('blue'') doesn't work
Why do you need to include this page inside the {{velocity}} macro ? If it's just some definition of velocity macros you should include it before the {{velocity}} macro.
Yes you are right this code working well :-) {{include reference="BacASable.PageWithACustomMacro" /}} {{velocity}} #foo('Red') {{/velocity}} I put include in my velocity code because this include is in an #if #then #else condition (because I have another stuff in my child doc included) but anyway I can cut/separate my code. and fill a distinct doc with all my not'so'nice macros :-) Thxs Pascal B
BacASable.PageWithACustomMacro containing:
#macro( foo $color)
My Color is $color
#end
In old doc: https://network.xwiki.com/xwiki/bin/view/DocXE31Fr/IncludeInVelocity you recommanded #includeInContext but new doc recommand include instead.
- second "problem" , when I want to avoid main problem with #includeInContext Main doc containing something like this:
$xwiki.includeForm("BacASable.PageWithACustomMacro")
## or #includeInContext("BacASable.PageWithACustomMacro") {{html}}
#foo('blue'') work well
{{/html}}
BacASable.PageWithACustomMacro containing:
#macro( foo $color)
My Color is $color
#end
I though wrongly then that #includeInContext working like #parse... and doesn't render the content.
Thxs
Pascal B.
--------------------------------------------
En date de : Lun 14.9.15, [email protected] <[email protected]> a écrit :
Objet: Re: Fw : Re: [xwiki-users] Fw : Include & Co board effect
À: "XWiki Users" <[email protected]> Cc: [email protected] Date: Lundi 14 septembre 2015, 15h15
On 14 Sep 2015 at 15:02:40, Pascal BASTIEN ([email protected](mailto:[email protected])) wrote:
> Nope: both method doesn't work with velocity macro... > Do you want a nice xar to check? Then where I can upload it? in Jira?
In your example below you were not inside a
velocity macro!
You
said:
> Then to obtain what I want I must user > html tag:
> {{html}} > #includeInContext("mySpace.myPage") > {{/html}}
The {{html}} macro cannot work inside a velocity macro…
Now, #include* macros all render the content, which is why you get HTML.
Thanks -Vincent
> --- En date de : Lun 14.9.15, [email protected] a écrit :
> > De: [email protected]
> > Objet: Re: [xwiki-users] Fw : Include & Co board effect > > À: "XWiki Users" > > Cc: [email protected] > > Date: Lundi 14 septembre 2015, 14h00
#yiv5668446636 > > body{font-family:Helvetica, > > Arial;font-size:13px;}Hi Pascal, > You should use {{include}} > for transclusions and {{display}} for inserting the result > > of the execution of some page. > > Thanks-Vincent
> > On 10 Sep 2015 at 11:26:25, > > Pascal BASTIEN ([email protected]) > > wrote: NB: new > > include function {{include > > reference="BacASable.Page" > > type="document" /}} doesn't work well when > > target page contains a velocity macro > > > > If target page contains a macro velocity
(#macro( foo $color ), the main page containing > > "include reference" can't call foo macro. > > > > (with includeInContext it's working)
> >
> >
--- En date de : Jeu 10.9.15, Pascal > > BASTIEN a écrit : > > > > > > > De: Pascal BASTIEN >
> >
Objet: [xwiki-users] Include & Co > board effect > > > > > À: "XWiki Users" > > >
> > > Date: Jeudi 10 septembre 2015, 10h33 > > >
Hello, > > > >
>
> > > In my velocity script I try to include > > some velocity code > > > > > from another page. > > > > > I want similare function like > > "source" in bash, it's like > > >
> copy/paste some code in main script > > from another file. > > > > > I read > > https://network.xwiki.com/xwiki/bin/view/DocXE31Fr/IncludeInVelocity > > >
and use > > #includeInContext("mySpace.myPage") but there > > > are board effect: > > > > > #includeInContext return HTML code > > like this > > > > > I call > MyMacro
My color is > > > > > Red
... > > >
Then to obtain what I want I must user > html tag: > > > > > {{html}} > > > > > > > #includeInContext("mySpace.myPage") > > >
{{/html}} > > > > > >
> > Is it normal? > > > > >
> > > > > >
Thxs, > > > >
>
> > > Pascal B
_______________________________________________
users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
participants (1)
-
Pascal BASTIEN