<html>
  <head>
    <script type="text/javascript" src="../eXo.js"></script>
    <script type="text/javascript" src="../eXo/core/Util.js"></script>
    <script type="text/javascript" src="../eXo/core/DOMUtil.js"></script>
    <script type="text/javascript" src="../eXo/core/Browser.js"></script>
    <script type="text/javascript" src="../eXo/core/TemplateEngine.js"></script>
  </head>

  <body>
    <h3>Test ExoTemplateEngine</h3>
    <script type="text/javascript">
     var context = {value: 'test  param', test: {nested: 'nested value'}} ;
     var template = 
       "<%\n" +
       "  function blockcode(param) { \n" +
       "    return 'call blockcode with param' + param;\n" +
       "  }\n" +
       "%>\n" +

       "<%function myfunc(param) { %>\n" +
       "<%  return 'call myfunc with param' + param; %>\n" +
       "<%}%>\n" +
       
       "<html>\n" +
       "  <body>\n" +
       "    <%for(var i = 0 ; i < 10; i++) {  %>\n" +
       "    <%  var mytest = 'test variable' ;%>\n" +
       "      this is a test <%=context.value%> html\n\r" +
       "      <%=context.value%> , nested test <%=context.test.nested%>\n" +
       "      <%=mytest%>\n" +
       "    <%}%>\n" +
       "    <%= myfunc(context.value)%>\n" +
       "    <%= blockcode(context.value)%>\n" +
       "  </body>\n" +
       "</html>"
      var html = eXo.core.TemplateEngine.toHTML(template, context) ;
      alert(html) ;
      
      html = eXo.core.TemplateEngine.merge("../eXo/core/TemplateEngine.jstmpl", context) ;
      alert(html) ;
    </script>
  </body>
</html>
