Element | Required | Optional | Purpose |
<px:if> | test="cond" | | Conditional inclusion of element’s children |
<px:elif> | test="cond" | |
<px:anif> | test="cond" | |
<px:orif> | test="cond" | |
<px:else> | | |
<px:for> | in="list" or
range="range" | item="l-value"
index="l-value" | Include repeated copies of element’s children |
<px:while> | test="cond" | min="num"
index="l-value" |
<px:def> | fn="l-value" | args="argdefs" | Define subtemplate |
<px:call> | fn="func" | args="arglist" | Call subtemplate |
<px:import> | src="uri" | as="l-value"
type="str"
globals="dict" | Get and run external template |
<px:none> | | | Element that is always replaced |
|
Attribute | Purpose |
px:if="cond" | Conditional inclusion of this element only (children always included) |
px:elif="cond" |
px:anif="cond" |
px:orif="cond" |
px:else="" |
px:tagname="str" | Change element’s tag name |
px:attr="dict" | Add/replace/remove attributes on element |
px:space="bool" | Control excess whitespace removal |
px:doctype="tuple" | Set doctype and output method (root element only) |
px:future="features" | Use features from future Python versions (root element only) |
|
PI | Shortcut | Purpose |
<?px_text expr ?> | <?_ expr ?> | Include as normal text |
<?px_upar expr ?> | | Include in URL parameter |
<?px_cstr expr ?> | | Include in CSS string literal |
<?px_jstr expr ?> | | Include in JavaScript string literal |
<?px_name expr ?> | | Include in a name/ID |
<?px_mark expr ?> | | Include as raw markup |
<?px_note text ?> | <?__ text ?> | Comment, not included in output |
<?px_code statement ?> | <?px statement ?> | Execute a line of Python code |
<?px_code : statements ?> | <?px : statements ?> | Execute a block of Python code |
|
Pseudo-PI | Shortcut | Purpose |
{?px_text expr ?} | {?_ expr ?} | Include as normal text |
{?px_upar expr ?} | | Include in URL parameter |
{?px_cstr expr ?} | | Include in CSS string literal |
{?px_jstr expr ?} | | Include in JavaScript string literal |
{?px_name expr ?} | | Include in a name/ID |
{?px_note text ?} | {?__ text ?} | Comment, not included in output |
{?px_if cond ?} | | Conditionally include the attribute this is in |
{?} | | Literal ‘{?’ |
|