Changeset 5370:db5bec991e14 in livinglogic.python.xist

Show
Ignore:
Timestamp:
03/04/13 11:44:16 (7 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Document template/function behaviour with/without <?return?> tag.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • NEWS.rst

    r5367 r5370  
    1 Changes in 4.10 (released ??/??/2013) 
     1Changes in 4.10 (released 03/04/2013) 
    22------------------------------------- 
    33 
     
    1010        84 
    1111 
     12    It's also possible to call a template as a function inside another template:: 
     13 
     14        >>> from ll import ul4c 
     15        >>> t = ul4c.Template("<?def x?><?return 42?><?end def?><?print x()?>") 
     16        >>> t.renders() 
     17        '42' 
     18 
    1219    Normal output of the template will be ignored if it is used as a function. 
     20 
     21    If the template runs through to the end without encountering a ``<?return?>`` 
     22    tag, ``None`` will be returned if the template is used as a function. 
     23 
     24    If the template is used as a template and a ``<?return?>`` tag is encountered 
     25    executing the template will be terminated (the return value will be ignored). 
    1326 
    1427*   The UL4 tag ``<?code?>`` may now contain not only variable assigments, but