By using java i want to convert javascript template (i try to make ) to pure javascript
Here is example : Input
<? function test()
{
return "Just a message";
}
if("a"=="b")
{
?>
<h1><?=test()?></h1>
<?
}
?>
<?=test()?>
</head></html>
output pure js example
out.print("<html><head>");
function test()
{
return "Just a message";
}
out.print("<h1>");
if("a"=="b")
{
out.print(test());
}
out.print("</h1>");
out.print("</head></html>");
I need a function to convert javascript template to pure javascript an eval it later . p/s a example using javascript function here http://ejohn.org/blog/javascript-micro-templating/ but i'm not sure it work perfectly when given conplex template