"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "docs/dev_guide/output.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).

output.rst  (cheetah3-3.1.0):output.rst  (cheetah3-3.2.0)
Directives: Output Directives: Output
================== ==================
(output)
#echo #echo
----- -----
(output.echo)
The template: The template:
:: ::
Here is my #echo ', '.join(['silly']*5) # example Here is my #echo ', '.join(['silly']*5) # example
The output: The output:
:: ::
skipping to change at line 34 skipping to change at line 30
:: ::
write('Here is my ') write('Here is my ')
write(filter(', '.join(['silly']*5) )) write(filter(', '.join(['silly']*5) ))
write(' example\n') write(' example\n')
#silent #silent
------- -------
(output.silent)
The template: The template:
:: ::
Here is my #silent ', '.join(['silly']*5) # example Here is my #silent ', '.join(['silly']*5) # example
The output: The output:
:: ::
skipping to change at line 62 skipping to change at line 56
write('Here is my ') write('Here is my ')
', '.join(['silly']*5) ', '.join(['silly']*5)
write(' example\n') write(' example\n')
OK, it's not quite covert because that extra space gives it away, OK, it's not quite covert because that extra space gives it away,
but it almost succeeds. but it almost succeeds.
#raw #raw
---- ----
(output.raw)
The template: The template:
:: ::
Text before raw. Text before raw.
#raw #raw
Text in raw. $alligator. $croc.o['dile']. #set $a = $b + $c. Text in raw. $alligator. $croc.o['dile']. #set $a = $b + $c.
#end raw #end raw
Text after raw. Text after raw.
skipping to change at line 99 skipping to change at line 91
''') ''')
So we see that {#raw} is really like a quoting mechanism. It says So we see that {#raw} is really like a quoting mechanism. It says
that anything inside it is ordinary text, and Cheetah joins a that anything inside it is ordinary text, and Cheetah joins a
{#raw} section with adjacent string literals rather than generating {#raw} section with adjacent string literals rather than generating
a separate {write} call. a separate {write} call.
#include #include
-------- --------
(output.include)
The main template: The main template:
:: ::
#include "y.tmpl" #include "y.tmpl"
The included template y.tmpl: The included template y.tmpl:
:: ::
skipping to change at line 130 skipping to change at line 120
The generated code: The generated code:
:: ::
write(self._includeCheetahSource("y.tmpl", trans=trans, includeFrom="file", write(self._includeCheetahSource("y.tmpl", trans=trans, includeFrom="file",
raw=0)) raw=0))
#include raw #include raw
~~~~~~~~~~~~ ~~~~~~~~~~~~
(output.include.raw)
The main template: The main template:
:: ::
#include raw "y.tmpl" #include raw "y.tmpl"
The shell command and output: The shell command and output:
:: ::
skipping to change at line 157 skipping to change at line 145
:: ::
write(self._includeCheetahSource("y.tmpl", trans=trans, includeFrom="fil write(self._includeCheetahSource("y.tmpl", trans=trans, includeFrom="fil
e", raw=1)) e", raw=1))
That last argument, {raw}, makes the difference. That last argument, {raw}, makes the difference.
#include from a string or expression (eval) #include from a string or expression (eval)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(output.include.expression)
The template: The template:
:: ::
#attr $y = "Let's go $voom!" #attr $y = "Let's go $voom!"
#include source=$y #include source=$y
#include raw source=$y #include raw source=$y
#include source="Bam! Bam!" #include source="Bam! Bam!"
The output: The output:
skipping to change at line 195 skipping to change at line 181
Later in the generated class: Later in the generated class:
:: ::
y = "Let's go $voom!" y = "Let's go $voom!"
#slurp #slurp
------ ------
(output.slurp)
The template: The template:
:: ::
#for $i in range(5) #for $i in range(5)
$i $i
#end for #end for
#for $i in range(5) #for $i in range(5)
$i #slurp $i #slurp
#end for #end for
skipping to change at line 238 skipping to change at line 222
write(filter(i)) # generated from '$i' at line 5, col 1. write(filter(i)) # generated from '$i' at line 5, col 1.
write(' ') write(' ')
write('Line after slurp.\n') write('Line after slurp.\n')
The space after each number is because of the space before {#slurp} The space after each number is because of the space before {#slurp}
in the template definition. in the template definition.
#filter #filter
------- -------
(output.filter)
The template: The template:
:: ::
#attr $ode = ">> Rubber Ducky, you're the one! You make bathtime so much fu n! <<" #attr $ode = ">> Rubber Ducky, you're the one! You make bathtime so much fu n! <<"
$ode $ode
#filter WebSafe #filter WebSafe
$ode $ode
#filter MaxLen #filter MaxLen
${ode, maxlen=13} ${ode, maxlen=13}
 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)