Common Lisp Package: NET.COMMON-LISP.PROJECT.BESE.TAL.CORE

An HTML template authoring library.

README:

FUNCTION

Public

CONTENT (TAG)

ATTRIBUTE-HANDLER: Replaces the content of the tag with the evaluated value of the attribute. This tag escapes its content to be html-safe. Example: <div tal:content='$foo' class='jack'/> Gets output as <div class='jack'> |Whatever was in $foo| </div>

DEF (TAG)

TAG-HANDLER: creates an inline sub-template available for the duration of the templates execution. The template should be named by the tal:name attribute or by tal:name-expression if it should be evaluated. Example: <tal:def tal:name='deffed-template'> <div> <span tal:when='$selected'>*</span> <span tal:content='$label'</span> </div> </tal> tal:def can also be used to create string constants when used with tal:type="string" Example: <tal:def tal:name='deffed-string' tal:type='string'>This is my string</tal> results in a let binding (deffed-string "This is my string")

IN-PACKAGE (TAG)

ATTRIBUTE-HANDLER: sets the package in which lisp evaluation happens.

INCLUDE (TAG)

TAG-HANDLER: includes another template at this point in the file. The template should be named by the tal:name attribute or by tal:name-expression if it should be evaluated. The path to the referenced template should be relative to the location of the template it is included in. The environment can be extended by including attributes in the parameter namespace, or immediate children in the parameter namespace. Example: <tal:include tal:name-expression='$tal-name' param:foo='foo' /> <tal:include tal:name='other-template.tal' param:foo='foo'> <param:contents> <div> <span tal:when='$selected'>*</span> <span tal:content='$label'</span> </div> </param:contents> </tal> The template other-template.tal will be evaluated with the additional parameters of 'foo' and 'contents'.

LOOP (TAG)

TAG-HANDLER: Loop across a list and repeat the children. On each iteration the environment is extended with the value tal:list should evaluate to a list tal:constant-list is parsed as a comma separated string <tal:loop tal:var='class' tal:list='$efficiencies'> <label class='map-control-item'> <img class='marker-icon ${$class}' /> <span class='text' tal:content='$class'/> <input type='checkbox' name='filter-efficiency' item-type='${$class}' /> </label> </tal:loop> assuming that $efficiencies resolves to the list {foo,bar}. <label class='map-control-item'> <img class='marker-icon foo' /> <span class='text' tal:content='foo'/> <input type='checkbox' name='filter-efficiency' item-type='foo' /> </label> <label class='map-control-item'> <img class='marker-icon bar' /> <span class='text' tal:content='bar'/> <input type='checkbox' name='filter-efficiency' item-type='bar' /> </label>

REPLACE (TAG)

ATTRIBUTE-HANDLER: Replaces the content of the tag with the evaluated value of the attribute. Whether the content is escaped depends upon the sibling attribute 'tal:escape-html Example: <div tal:replace='$foo' class='jack'/> Gets output as: |Whatever was in $foo|

WHEN (TAG)

ATTRIBUTE-HANDLER: Causes this tag to only appear when the evaluated value of the attribute is not nil.

Undocumented

TAL (TAG)

Private

CONTENT-AS-IS (TAG)

ATTRIBUTE-HANDLER: Replaces the content of the tag with the evaluated value of the attribute. This tag does not escape the content. Example: <div tal:content-as-is='$foo' class='jack'/> Gets output as <div class='jack'> |Whatever was in $foo| </div>

DESCRIBE-HANDLER (TAG)

TAG-HANDLER: Describes (in an comment) the tag or attribute handler named by the attribute tal:name

DESCRIBE-HANDLERS (TAG)

TAG-HANDLER: Describes (in an comment), all tags and attribute handlers that are known (in *tal-attribute-handlers* or *tal-tag-handlers*)

LET (TAG)

ATTRUBTE-HANDLER: Extend environment with a given list of bindings, as for LET* form. Example: <div tal:let='foo 3'><div tal:content='$foo'/></div> Goes to: <div><div>3</div></div>

LISP (TAG)

TAG-HANDLER: evaluate the body of the tag as lisp code.

PLIST-ATTRS (TAG)

Convert a plist returned from the value of this attribute into attributes on this tag.

UNLESS (TAG)

ATTRIBUTE-HANDLER: Causes this tag to only appear when the evaluated value of the attribute is nil.

Undocumented

TALABLE-STRINGS (TAG)

WITHOUT-READER (TAG)