|
||||||||||||
|
|
||||||||||||
Tag librariesXXX. An import tag specifies the location of file containing specification of taglib in xml format and name of tag namespace used when searching for custom tags. If namespace is left empty then tag appear in default namespace; wihtout any prefix. Specification
<taglib name="library-name">
<version>library-version</version>
<info>library-info</info>
( <tag name="tag-name">
( <attribute name="attr-name">
<type>(boolean|int|double|string|expr)</type>
<required>(false|true)</required>
</attribute> )*
<hascontent>(false|true)</hascontent>
<inithandler>name-of-handler-function</inithandler>
[ <starthandler>name-of-handler-function</starthandler>
| <startmethod>name-of-handler-method</startmethod> ]
[ <endhandler>name-of-handler-function</endhandler>
| <endmethod>name-of-handler-method</endmethod> ]
[ <releasehandler>name-of-handler-function</releasehandler>
| <releasemethod>name-of-handler-method</releasemethod> ]
</tag> )*
</taglib>
Specification tags
Compilation with function handlers
// first parameter contains the context of
// enclosing custom tag, or undefined if
// there is no such tag.
// second parameter is name of tag as NS:NAME
// third parameter contains array with attributes evaluted
// and mapped to their names, given in specification.
var ctx = taglib.<<initHandler>>(anvil.lang.context(), tagname, attributes);
// if starthandler, endhandler and releasehandler
// are not given, following statements do not apply
try {
// while(true) if starthandler not given
while(taglib.<<startHandler>>(ctx)) {
// contained statements here
// following is omitted, if endhandler not given
if (!taglib.<<endHandler>>(ctx)) {
break;
}
}
} finally {
//omitted if releasehandler not given
taglib.<<releaseHandler>>(ctx);
}
Compilation with method handlers
var ctx = taglib.<<initHandler>>(anvil.lang.context(), tagname, attributes);
try {
// while(true) if startmethod not given
while(ctx.<<startmethod>()) {
// contained statements here
// following is omitted, if endmethod not given
if (!ctx.<<endmethod>>()) {
break;
}
}
} finally {
//omitted if releasemethod not given
ctx.<<releasemethod>>();
}
Function and method handlers may be used together. A call to anvil.lang.context() returns the context of current tag (i.e. return value from inithandler)
|
||||||||||||
|
|
||||||||||||