Hi Attila,
Like it or not, there are springing up templating libraries because
theres a need for them, and a simple addition into Rhino would make them
unnecessary.
The most efficient place to "compile" templates is within the engine
itself. The template/code only needs to be parsed once, using less memory.
Sure it wouldn't be supported by any other JavaScript runtimes, but
neither are E4X, except SpiderMonkey. And E4X has a similar purpose but
only work with XML DOM.
/ henrik
Attila Szegedi wrote:
I honestly abhor ASP/JSP, and the language within the HTML template being
JavaScript instead of Java doesn't really change my feelings. So, I wouldn't
really like to see it in the main trunk. JS template engines seem to be
springing into existence like mushrooms after rain these days anyway, and
they're all written as libraries. I think a good JS template library shouldn't
have a dependency on the JS runtime (Rhino in this case).
Attila.
--
home: http://www.szegedi.org
twitter: http://twitter.com/szegedi
weblog: http://constc.blogspot.com
On 2009.12.05., at 0:33, Henrik Lindqvist wrote:
Hi,
I'am planning on using Rhino as a replacement for JSP, soo I've hacked the
parser adding a optional feature to enable a similar syntax:
-- cut --
%><h1>Title</h1>
<ul>
<% for (var i = 1; i <= 10; i++) { %>
<li>Item #<%= i %></li>
<% } %>
</ul>
-- cut --
Now some questions:
1. Is anyone else interested is such a feature?
2. Would such a feature, properly implemented, ever be accepted to the main
trunk of the Rhino source?
3. If yes. Any tips on how to correctly implement this? I've now just added an additional token
'%>template text<%', the parser then creates AST nodes to call a "print" function
with the template text and '<%=' expression as arguments. As said, currently a quick hack.
/ henrik
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino