Example - Includes
Velocity template
#include( "greeting.vm" ) #include( "test1/method.vm" ) #foreach( $greeting in $greetings ) #include( "greeting2.vm" ) #end #if #set ($dyna = 'dynatest1.vm') #else #set ($dyna = 'dynatest2.vm') #end #include( $dyna )
Generated Javascript
function v2js_include(context) { var text = new StringCat(); text.push( v2js_greeting(context)); text.push( v2js_test1_method(context)); text.push('<table border="1">'); for (var i1=0; i1<context.greetings.length; i1++) { var greeting = context.greetings[i1]; text.push(' '); context.greeting=greeting; text.push( v2js_greeting2(context)); } text.push('</table>'); if (context.world.name == 'WORLD') { var dyna = "v2js_dyna1"; } else { var dyna = "v2js_dyna2"; } context.greeting=greeting; context.dyna=dyna; text.push( eval(dyna+'(context)')); return text.toString(); }