From 0206759527d79ef97f4760be8927dc4eb4bd1e9b Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sun, 16 Jun 2013 22:59:06 +0300 Subject: [PATCH] experiments with document styles (WIP) --- doc/template.org | 72 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 16 deletions(-) diff --git a/doc/template.org b/doc/template.org index 5463a93..bf9b464 100644 --- a/doc/template.org +++ b/doc/template.org @@ -1,48 +1,88 @@ * Template + This document describes template language of IPF framework. + + =[ ]?= -- optional code + + =[ ]*= -- code can be repeated zero or more times. + ** Tags -*** Print +*** print Syntax: ={[modifiers]}= + Outputs expression. *** if/elseif/else - Syntax: ={if }= [ ={elseif }= ]* [ ={else}= ] ={/if}= + Syntax: ={if }= [ ={elseif }= ]* [ ={else}= ]? ={/if}= *** while Syntax: ={while }= ={/while}= -*** {foreach as [ =>] } | {/foreach} +*** foreach + Syntax: ~{foreach as [ =>]? }~ ~{/foreach}~ + Iterate over collection. - Following variables are defined inside a loop: + + Following variables are defined in a loop body: + =foreach_counter0= -- zero based iteration counter + =foreach_counter1= -- unit based iteration counter + =foreach_first= -- is true on first iteration and false on the rest ones. -*** {assign } +*** assign + Syntax: ={assign }= + Example: ~{assing $v += 1}~ -*** {literal} | {/literal} +*** literal + Syntax: ={literal}= ={/literal}= + Literally output enclosed text. Mostly used to wrap inlined JavaScript. -*** {include ""} - Include another template. Example: ={include "pagination.html"}= +*** include + Syntax: ={include ""}= + + Example: ={include "pagination.html"}= + + Substitutes another template. + +*** block + Syntax: ={block }= ={/block}= -*** {block } | {superblock} | {/block} + Defines or redefines named block. -*** {ldelim} | {rdelim} - Output '{' and '}'. +*** superblock + Syntax: ={superblock}= -** Unknown Tags + Placeholder for content of inherited block. -*** {trans} | {plural} | {blocktrans} | {/blocktrans} +*** extends + Syntax: ={extends ""}= + + Example: ={extends "base.html"}= + + Declares current template as defived one. Top level blocks are substituted into corresponding blocks of base template. + +*** ldelim, rdelim + Syntax: ={ldelim}=, ={rdelim}= + + Output '{' and '}'. + +*** trans, plural, blocktrans + No information about these tags ** Predefined custom tags -*** {url ''[, array(, ...)]} - Reverse url +*** url + Syntax: ={url ''[, array(, ...)]}= + + Examples: ={url 'Content_View_Index'}=, ={url 'Catalog_View_Products', array($product->slug)}=, ={url 'News_View_Item', array($item->date, $item->slug)}= + + Reverse url for a given view and its parameters. + +*** sql + Syntax: ={sql}= -*** {sql} Prints SQL statistics. ** Modifiers -- 2.49.0