"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "docs/dev_guide/inheritanceEtc.rst" between
cheetah3-3.1.0.tar.gz and cheetah3-3.2.0.tar.gz

About: Cheetah3 is a template engine and code generation tool for e.g. for Web development or Java, SQL, LaTeX, form email ... (written in Python).

inheritanceEtc.rst  (cheetah3-3.1.0):inheritanceEtc.rst  (cheetah3-3.2.0)
Directives: Import, Inheritance, Declaration and Assignment Directives: Import, Inheritance, Declaration and Assignment
=========================================================== ===========================================================
(inheritanceEtc)
#import and #from #import and #from
----------------- -----------------
(inheritanceEtc.import)
The template: The template:
:: ::
#import math #import math
This construct does not produce any output. This construct does not produce any output.
The generated module, at the bottom of the import section: The generated module, at the bottom of the import section:
:: ::
import math import math
#extends #extends
-------- --------
(inheritanceEtc.extends)
The template: The template:
:: ::
#extends SomeClass #extends SomeClass
The generated import (skipped if {SomeClass} has already been The generated import (skipped if {SomeClass} has already been
imported): imported):
:: ::
skipping to change at line 52 skipping to change at line 46
The generated class: The generated class:
:: ::
class x(SomeClass): class x(SomeClass):
#implements #implements
----------- -----------
(inheritanceEtc.implements)
The template: The template:
:: ::
#implements doOutput #implements doOutput
In the generated class, the main method is {.doOutput} instead of In the generated class, the main method is {.doOutput} instead of
{.respond}, and the attribute naming this method is: {.respond}, and the attribute naming this method is:
:: ::
_mainCheetahMethod_for_x2= 'doOutput' _mainCheetahMethod_for_x2= 'doOutput'
#set and #set global #set and #set global
-------------------- --------------------
(inheritanceEtc.set)
The template: The template:
:: ::
#set $namesList = ['Moe','Larry','Curly'] #set $namesList = ['Moe','Larry','Curly']
$namesList $namesList
#set global $toes = ['eeny', 'meeny', 'miney', 'moe'] #set global $toes = ['eeny', 'meeny', 'miney', 'moe']
$toes $toes
The output: The output:
skipping to change at line 107 skipping to change at line 97
6 write('\n') 6 write('\n')
{globalSetVars} is a local variable referencing {.\_globalSetVars}. {globalSetVars} is a local variable referencing {.\_globalSetVars}.
Writes go into it directly, but reads take advantage of the fact Writes go into it directly, but reads take advantage of the fact
that {.\_globalSetVars} is on the searchList. (In fact, it's the that {.\_globalSetVars} is on the searchList. (In fact, it's the
very first namespace.) very first namespace.)
#del #del
---- ----
(inheritanceEtc.del)
The template: The template:
:: ::
#set $a = 1 #set $a = 1
#del $a #del $a
#set $a = 2 #set $a = 2
#set $arr = [0, 1, 2] #set $arr = [0, 1, 2]
#del $a, $arr[1] #del $a, $arr[1]
skipping to change at line 132 skipping to change at line 120
1 a = 1 1 a = 1
2 del a 2 del a
3 a = 2 3 a = 2
4 arr = [0, 1, 2] 4 arr = [0, 1, 2]
5 del a, arr[1] 5 del a, arr[1]
#attr #attr
----- -----
(inheritanceEtc.attr)
The template: The template:
:: ::
#attr $namesList = ['Moe', 'Larry', 'Curly'] #attr $namesList = ['Moe', 'Larry', 'Curly']
In the generated class: In the generated class:
:: ::
## GENERATED ATTRIBUTES ## GENERATED ATTRIBUTES
namesList = ['Moe', 'Larry', 'Curly'] namesList = ['Moe', 'Larry', 'Curly']
#def #def
---- ----
(inheritanceEtc.def)
The template: The template:
:: ::
#def printArg($arg) #def printArg($arg)
The argument is $arg. The argument is $arg.
#end def #end def
My method returned $printArg(5). My method returned $printArg(5).
The output: The output:
skipping to change at line 221 skipping to change at line 205
else: else:
return "" return ""
When {.printArg} is called from a placeholder, only the arguments When {.printArg} is called from a placeholder, only the arguments
the user supplied are passed. The other arguments retain their the user supplied are passed. The other arguments retain their
default values. default values.
#block #block
------ ------
(inheritanceEtc.block)
The template: The template:
:: ::
#block content #block content
This page is under construction. This page is under construction.
#end block #end block
The output: The output:
 End of changes. 9 change blocks. 
18 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)