[xwiki-devs] [Proposal/New Rendering] HTML in Velocity macro
Hi, Contrary to what is described here http://dev.xwiki.org/xwiki/bin/view/Design/NewRenderingArchitecture#HA6Intro... I'd like to propose instead to use a nested {xhtml} macro whenever you want your velocity script to generate XHTML. So the example would be transformed into: {velocity}{xhtml} <div> <h1>Hello $customer.Name!</h1> <table> #foreach( $mud in $mudsOnSpecial ) #if ( $customer.hasPurchased($mud) ) <tr> <td> * [link>$flogger.getPromo( $mud )] </td> </tr> #end #end </table> </div> {/xhtml}{/velocity} It seems to me much more logical to do it this way, especially since we allow nested macros. Note1: that it'll work because the velocity macro supports wiki syntax and {xhtml} is wiki syntax. Note2: This is not equivalent to writing {xhtml}{velocity}... since the xhtml macro only accepts valid XHTML. This is valid though: {xhtml} <div> <a href="...">{somemacro/}</a> </div> {/xhtml} WDYT? Is it ok with you? Thanks -Vincent
On Thu, Jul 24, 2008 at 2:41 PM, Vincent Massol <[email protected]> wrote:
Contrary to what is described here http://dev.xwiki.org/xwiki/bin/view/Design/NewRenderingArchitecture#HA6Intro... I'd like to propose instead to use a nested {xhtml} macro whenever you want your velocity script to generate XHTML.
{velocity}{xhtml} [snip] {/xhtml}{/velocity}
Fine with me, being as consistent as we can with macros handling sounds like a good rule. -- Jean-Vincent Drean
On Fri, Jul 25, 2008 at 11:23 AM, Jean-Vincent Drean <[email protected]> wrote:
On Thu, Jul 24, 2008 at 2:41 PM, Vincent Massol <[email protected]> wrote:
Contrary to what is described here http://dev.xwiki.org/xwiki/bin/view/Design/NewRenderingArchitecture#HA6Intro... I'd like to propose instead to use a nested {xhtml} macro whenever you want your velocity script to generate XHTML.
{velocity}{xhtml} [snip] {/xhtml}{/velocity}
Fine with me, being as consistent as we can with macros handling sounds like a good rule.
Sounds good to me too.
-- Jean-Vincent Drean _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
It seems a bit more painfull to write.. But it's ok Ludovic Vincent Massol wrote:
Hi,
Contrary to what is described here http://dev.xwiki.org/xwiki/bin/view/Design/NewRenderingArchitecture#HA6Intro... I'd like to propose instead to use a nested {xhtml} macro whenever you want your velocity script to generate XHTML.
So the example would be transformed into:
{velocity}{xhtml} <div> <h1>Hello $customer.Name!</h1> <table> #foreach( $mud in $mudsOnSpecial ) #if ( $customer.hasPurchased($mud) ) <tr> <td> * [link>$flogger.getPromo( $mud )] </td> </tr> #end #end </table> </div> {/xhtml}{/velocity}
It seems to me much more logical to do it this way, especially since we allow nested macros.
Note1: that it'll work because the velocity macro supports wiki syntax and {xhtml} is wiki syntax.
Note2: This is not equivalent to writing {xhtml}{velocity}... since the xhtml macro only accepts valid XHTML. This is valid though:
{xhtml} <div> <a href="...">{somemacro/}</a> </div> {/xhtml}
WDYT? Is it ok with you?
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Ludovic Dubost Blog: http://blog.ludovic.org/ XWiki: http://www.xwiki.com Skype: ldubost GTalk: ldubost
participants (4)
-
Jean-Vincent Drean -
Ludovic Dubost -
Thomas Mortagne -
Vincent Massol