Wikipedia:

METAL

The Macro Expansion Template Attribute Language complements TAL, providing macros which allow the reuse of code across template files. Both were created for Zope but are used in other Python projects as well.


Overview

METAL complements TAL with the ability to reuse code. It allows to define and use macros, which in turn may have slots; when using a macro, variational content can be specified for a slot.

When generating XML documents, the XML namespace must be specified (xmlns:metal="http://xml.zope.org/namespaces/metal").

Attributes

The following attributes are recognised, normally requiring a „metal:“ prefix:

define-macro
creates a macro
define-slot
creates a slot inside a macro
use-macro
uses a macro (normally given via a TALES path expression)
fill-slot
when using a macro, replaces the default content of the given slot
extend-macro
since Zope v3: extends a macro, comparable to subclassing, by redefining of slots

Normally, just one of those is used at a time.

In cases when no tag is present which lends itself to take the attributes, and in special cases when more than one METAL attribute is needed, special METAL tags can be used, making the „metal:“ prefix optional. E. g. (sketched with Roundup in mind):

<html metal:define-macro="icing">
...
<metal:myslot define-slot="optional-form"/>
...
</html>

<html metal:use-macro="templates/page/macros/icing">
<form metal:fill-slot="optional-form" action="."
        tal:attributes="action context/designator">
...
</form>
</html>

Usage

TAL/TALES/METAL are used by the following projects:

Weblinks


 
 
 

Join the WikiAnswers Q&A community. Post a question or answer questions about "METAL" at WikiAnswers.

 

Copyrights:

Wikipedia. This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article "METAL" Read more

Search for answers directly from your browser with the FREE Answers.com Toolbar!  
Click here to download now. 

Get Answers your way! Check out all our free tools and products.

On this page:   E-mail   print Print  Link  

 

Keep Reading

Mentioned In: