Hi,

I started playing with microsling yesterday and found so far two itches in the Javascript template approach used by microsling that I would like to scatch:

1) Syntax highlighting for ESP: http://weblogs.goshaky.com/weblogs/ lars/entry/esp_javascript_template_language_syntax 2) Making the Javascript objects used in ESP-templates like resource and resource.item a little bit easier to handle by wrapping them in ScriptableObjects. The ESP example could then be simplified to:

<%-- microsling ESP template example, store this as html.esp --%>
<html>
<body>
<p>This page is generated from an ESP template!</p>
<h1><%= resource.uri %></h1>
<%
  for each (var p in resource.item.properties) {
    %>
      <p>
        <%= p.name %>
        =
        <strong><%= p.string %></strong>
      </p>
    <%
  }
%>
</body>
</html>

Other ways of accessing a property could be:
resource.item.properties.foo
resource.item.properties["foo"]
resource.item.properties[1]

and the same API could apply to children. The idea is to expose the Resource (and the wrapped Node) as a JSON object that can be processed easily.

regards,

Lars

Reply via email to