Re: [xwiki-users] How do I evaluate a Velocity variable in XWiki syntax?
On Fri, Dec 14, 2012 at 12:48 PM, Eduard Moraru enygma2...@gmail.comwrote: Hi, Here is an example that illustrates your problem, in a simplified case (using an 'AppWithinMinutes.String' object): {{velocity}} This is done with a displayer: {{{ $doc.getObject('AppWithinMinutes.String').shortText }}} This is the raw value of the property: $doc.getObject('AppWithinMinutes.String').getProperty('shortText').value {{/velocity}} Basically, when you are doing $n.description you are doing $doc.display('description', $n) which renders the output based on the default displayer. To test this, you can do: {{velocity}} {{{ $doc.getObject('AppWithinMinutes.String').shortText }}} {{velocity}} A safer debug syntax is to use {{velocity wiki=false}} instead of {{{ }}} ;) and see the output (which prints the value literally with wiki='false' and which was not what you were expecting to see): {{html clean=false wiki=false}}[[linkMain.WebHome]]{{/html}} You just need to be aware of this and decide when you want to use a displayer and when you actually want the raw value of the object property. Thanks, Eduard On Fri, Dec 14, 2012 at 2:54 AM, crocket crockabisc...@gmail.com wrote: Below is the velocity macro that displays the XWiki link syntax in a variable literally. $n.description contains a link, and it is not displayed as a link but displayed literally in the XWiki syntax. {{velocity}} #set($nsrv=$doc.getObjects(Private.NetworkServices)) #if($nsrv) $services.objectsort.getInstance().sortByProps($nsrv, [firewalled:desc, port]) |=Firewalled|=Port|=Protocol|=Service|=Application|=Description #foreach ( $n in $nsrv ) |$n.firewalled|$n.port|$n.protocol|$n.service|$n.application|$n.description #end #else There is no network service defined. #end {{/velocity}} On Sun, Dec 9, 2012 at 6:36 PM, crocket crockabisc...@gmail.com wrote: Suppose str is set by #set($str=[[labelSpace.Page]]) How do I render $str as a link in a Velocity macro? ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] How do I evaluate a Velocity variable in XWiki syntax?
Hi, Here is an example that illustrates your problem, in a simplified case (using an 'AppWithinMinutes.String' object): {{velocity}} This is done with a displayer: {{{ $doc.getObject('AppWithinMinutes.String').shortText }}} This is the raw value of the property: $doc.getObject('AppWithinMinutes.String').getProperty('shortText').value {{/velocity}} Basically, when you are doing $n.description you are doing $doc.display('description', $n) which renders the output based on the default displayer. To test this, you can do: {{velocity}} {{{ $doc.getObject('AppWithinMinutes.String').shortText }}} {{velocity}} and see the output (which prints the value literally with wiki='false' and which was not what you were expecting to see): {{html clean=false wiki=false}}[[linkMain.WebHome]]{{/html}} You just need to be aware of this and decide when you want to use a displayer and when you actually want the raw value of the object property. Thanks, Eduard On Fri, Dec 14, 2012 at 2:54 AM, crocket crockabisc...@gmail.com wrote: Below is the velocity macro that displays the XWiki link syntax in a variable literally. $n.description contains a link, and it is not displayed as a link but displayed literally in the XWiki syntax. {{velocity}} #set($nsrv=$doc.getObjects(Private.NetworkServices)) #if($nsrv) $services.objectsort.getInstance().sortByProps($nsrv, [firewalled:desc, port]) |=Firewalled|=Port|=Protocol|=Service|=Application|=Description #foreach ( $n in $nsrv ) |$n.firewalled|$n.port|$n.protocol|$n.service|$n.application|$n.description #end #else There is no network service defined. #end {{/velocity}} On Sun, Dec 9, 2012 at 6:36 PM, crocket crockabisc...@gmail.com wrote: Suppose str is set by #set($str=[[labelSpace.Page]]) How do I render $str as a link in a Velocity macro? ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] How do I evaluate a Velocity variable in XWiki syntax?
Thanks for your advise. It now works. On Fri, Dec 14, 2012 at 8:48 PM, Eduard Moraru enygma2...@gmail.com wrote: Hi, Here is an example that illustrates your problem, in a simplified case (using an 'AppWithinMinutes.String' object): {{velocity}} This is done with a displayer: {{{ $doc.getObject('AppWithinMinutes.String').shortText }}} This is the raw value of the property: $doc.getObject('AppWithinMinutes.String').getProperty('shortText').value {{/velocity}} Basically, when you are doing $n.description you are doing $doc.display('description', $n) which renders the output based on the default displayer. To test this, you can do: {{velocity}} {{{ $doc.getObject('AppWithinMinutes.String').shortText }}} {{velocity}} and see the output (which prints the value literally with wiki='false' and which was not what you were expecting to see): {{html clean=false wiki=false}}[[linkMain.WebHome]]{{/html}} You just need to be aware of this and decide when you want to use a displayer and when you actually want the raw value of the object property. Thanks, Eduard On Fri, Dec 14, 2012 at 2:54 AM, crocket crockabisc...@gmail.com wrote: Below is the velocity macro that displays the XWiki link syntax in a variable literally. $n.description contains a link, and it is not displayed as a link but displayed literally in the XWiki syntax. {{velocity}} #set($nsrv=$doc.getObjects(Private.NetworkServices)) #if($nsrv) $services.objectsort.getInstance().sortByProps($nsrv, [firewalled:desc, port]) |=Firewalled|=Port|=Protocol|=Service|=Application|=Description #foreach ( $n in $nsrv ) |$n.firewalled|$n.port|$n.protocol|$n.service|$n.application|$n.description #end #else There is no network service defined. #end {{/velocity}} On Sun, Dec 9, 2012 at 6:36 PM, crocket crockabisc...@gmail.com wrote: Suppose str is set by #set($str=[[labelSpace.Page]]) How do I render $str as a link in a Velocity macro? ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] How do I evaluate a Velocity variable in XWiki syntax?
I already tried, but [[labelSpace.Page]] was displayed literally. On Wed, Dec 12, 2012 at 7:44 PM, Eduard Moraru enygma2...@gmail.com wrote: Hi, Why not just try it out and see if it works? {{velocity}} #set($str=[[labelSpace.Page]]) Here is the link: $str {{/velocity}} Thanks, Eduard On Sun, Dec 9, 2012 at 11:36 AM, crocket crockabisc...@gmail.com wrote: #set($str=[[labelSpace.Page]]) ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] How do I evaluate a Velocity variable in XWiki syntax?
I just tried on XE 4.1, syntax 2.1, and as expected link is correctly displayed as a link ... ? Only reason why you would get that IMO would be if you had wiki syntax not interpreted inside velocity macro, so you could try: {{velocity wiki=true}} #set($str=[[labelSpace.Page]]) Here is the link: $str {{/velocity}} ... though it should be the default. BR, Jeremie 2012/12/13 crocket crockabisc...@gmail.com I already tried, but [[labelSpace.Page]] was displayed literally. On Wed, Dec 12, 2012 at 7:44 PM, Eduard Moraru enygma2...@gmail.com wrote: Hi, Why not just try it out and see if it works? {{velocity}} #set($str=[[labelSpace.Page]]) Here is the link: $str {{/velocity}} Thanks, Eduard On Sun, Dec 9, 2012 at 11:36 AM, crocket crockabisc...@gmail.com wrote: #set($str=[[labelSpace.Page]]) ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] How do I evaluate a Velocity variable in XWiki syntax?
On 12/13/2012 04:39 AM, Jeremie BOUSQUET wrote: I just tried on XE 4.1, syntax 2.1, and as expected link is correctly displayed as a link ... ? Only reason why you would get that IMO would be if you had wiki syntax not interpreted inside velocity macro, so you could try: Those are not the only cases. Here are two more: - Not inside a wiki document, but a filesystem template - The document is not using one of the xwiki/2.x syntaxes {{velocity wiki=true}} #set($str=[[labelSpace.Page]]) Here is the link: $str {{/velocity}} ... though it should be the default. BR, Jeremie 2012/12/13 crocket crockabisc...@gmail.com I already tried, but [[labelSpace.Page]] was displayed literally. On Wed, Dec 12, 2012 at 7:44 PM, Eduard Moraru enygma2...@gmail.com wrote: Hi, Why not just try it out and see if it works? {{velocity}} #set($str=[[labelSpace.Page]]) Here is the link: $str {{/velocity}} Thanks, Eduard On Sun, Dec 9, 2012 at 11:36 AM, crocket crockabisc...@gmail.com wrote: #set($str=[[labelSpace.Page]]) -- Sergiu Dumitriu http://purl.org/net/sergiu/ ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] How do I evaluate a Velocity variable in XWiki syntax?
Below is the velocity macro that displays the XWiki link syntax in a variable literally. $n.description contains a link, and it is not displayed as a link but displayed literally in the XWiki syntax. {{velocity}} #set($nsrv=$doc.getObjects(Private.NetworkServices)) #if($nsrv) $services.objectsort.getInstance().sortByProps($nsrv, [firewalled:desc, port]) |=Firewalled|=Port|=Protocol|=Service|=Application|=Description #foreach ( $n in $nsrv ) |$n.firewalled|$n.port|$n.protocol|$n.service|$n.application|$n.description #end #else There is no network service defined. #end {{/velocity}} On Sun, Dec 9, 2012 at 6:36 PM, crocket crockabisc...@gmail.com wrote: Suppose str is set by #set($str=[[labelSpace.Page]]) How do I render $str as a link in a Velocity macro? ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] How do I evaluate a Velocity variable in XWiki syntax?
Hi, Why not just try it out and see if it works? {{velocity}} #set($str=[[labelSpace.Page]]) Here is the link: $str {{/velocity}} Thanks, Eduard On Sun, Dec 9, 2012 at 11:36 AM, crocket crockabisc...@gmail.com wrote: #set($str=[[labelSpace.Page]]) ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users