Indo direto pra categoria “pq diabos eu nao pensei nisso antes”, JavaScript Templates:
http://trimpath.com/project/wiki/JavaScriptTemplates
[quote]JavaScript Templates let’s you do template-style programming (like PHP/ASP/JSP) completely in your web browser. It’s an open-source tool to help make writing new-fangled rich web applications easier, like OddPost/GMail/Bloglines.
Here’s a JST sample that shows off some features like expressions, for loops, forelse, and if syntax…
[code]
Hello ${customer.firstName|default:“Mr.”} ${customer.lastName}
Your recent orders are:
-
{for order in customer.getRecentOrders()}
- ${order.orderNum} - ${order.status|capitalize}: ${order.grandTotal} {if order.requestedShipDate < new Date().getTime() && order.status != "shipped"} Please contact customer service. {/if} {forelse}
- You have no orders yet. {/for}
The code within the ${…} and {for …} and {if …} markup is just standard JavaScript, so you’re not learning yet another new expression language.[/code][/quote]