Helma Logo
main list history
previous version  overview  next version

Version 29 by hannes on 13. July 2006, 01:10

== Spec ==

# Macros in skins are delimited by <% %>.
# Macros can contain both named and unnamed parameters, in any combination (see Notes for implementation details).
# Named parameters are denoted as name=value, unnamed parameters are denoted as value.
# The following types are supported as parameter values:
## strings: "foo"
## numbers: 13
## boolean false|true
## object literals: {foo: bar, x: y}
## array literals: [1, 2, "drei"]
# For string values, single or double quotes are optional unless the value contains whitespace characters.
# Round brackets ( ) can be used to group macro parameters.
# <strike>Macro parameter values wrappedn in {{ }} are interpreted as nested skins.</strike>
# Helma provides scanning/parsing features, but skins and macros are implemented in JavaScript.
# <strike>Nested skins and macros are passed to macros as skin and macro objects, respectively. In other words, macro evaluation and skin rendering is up to the containing macro.</strike>
# Standard macros such as if/else, foreach, equals, greaterThan are implemented as plain macros in JS.

Macro parameters are passed in a way that allows sequential value lookup, sequential name lookup access for unnamed parameters and keyed access for named lookup:parameters:

    var param = {
      next: function() {
          /\* provide iterator style access to unnamed parameters */
      byName: {
          /\* provide access to named parameters */

== Examples ==

I removed the old examples since they didn't match the renewed spec anymore. Generally speaking, all kinds of macro syntax can be implemented based on the features discribed in this proposals, as long as they use &lt;% %&gt as macro delimiters.

== Comments ==

I removed Jürg's comments as well, for the same reason.