Helma Logo
main list history
previous version  overview  next version

Version 37 by hannes on 30. October 2006, 22:23

== Spec ==

# Macros in skins are delimited by &lt;% %&gt;<% %>.
# 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 multiple macro parameters into one. (syntactic sugar for arrays?)
# <strike>Macro parameter values wrappedn in {{ }} are interpreted as nested skins.</strike>
# Helma provides native skin 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>
# Todo: provide a feature for marking subtemplates within a skin file.

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

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

== Implementation ==

Native template scanning support is implemented in class *org.helma.template.TemplateScanner|Source/helma/trunk/src/org/helma/template/TemplateScannerTemplateScanner|Source/file/helma/trunk/src/org/helma/template/TemplateScanner.java*. You can currently test it using something like:

    var t = new Packages.org.helma.template.TemplateScanner();
    t.parse("foo <% image 'dancer.gif' {class: 'storyImage'} %> bar");

== 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.