Hi,
On Jul 21, 8:28 am, Nilima Chavan <[email protected]> wrote:
> most likely goal 1.
Sadly, I haven't found any Server-side JavaScript engines (such as
V8CGI) that feature embedded code blocks (with the exception of
Microsoft's .NET JavaScript runtime).
I've noticed that you've been active on the V8CGI project some. Do you
think it would be worthwhile to ask about embedded code block
preprocessing?
For example, I'd assume that this preprocessor:
var script = readAsString("script.js");
//This would need to handle line breaks also...
script = script.replace(/\?>([^<\?js]+)<\?js/, "print(\"$1\");");
script = script.replace("<?js", '');
script = script.replace("?>", '');
eval(script);//perhaps?
...Would work on this:
<?js for (var i = 0; i < 1000000; i++) { ?>
let's say something
<?js } ?>
...to create this:
for (var i = 0; i < 1000000; i++) { print("let's say something"); }
Of course, this might create an issue (it would need work to make it
work right):
<?js for (var i = 0; i < 1000000; i++) { ?>
let's say something <?js print (i); /* This might be sent as-is to the
browser. */ ?>
<?js } ?>
It would create (I'm just testing here):
for (var i = 0; i < 1000000; i++) { print("
let's say something "); print (i); /* This might be sent as-is to the
browser. */ print("
"); }
Actually, that's not so bad. (I hope you don't mind me testing/
talking).
So, my suggestion is to:
1. Find a CommonJS engine that supports embedded code blocks (I
couldn't find any),
2. Create an "enhancement"/suggestion (?) bug ticket for V8CGI (if you
like it a lot) and suggest that they add support for embedded code
blocks (as in PHP's <?php ?>), or...
3. (Worst-case scenario?) "Check-out" V8CGI's code via SVN and add
this functionality manually.
Sorry if this sounds bad,
pikpik
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users