~ubuntu-branches/ubuntu/raring/genshi/raring-proposed

« back to all changes in this revision

Viewing changes to doc/api/genshi.template.text.TextTemplate-class.html

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Fontaine
  • Date: 2007-04-16 17:49:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070416174903-x2p3n9g890v18d0m
Tags: 0.4-1
* New upstream release.
* Remove useless python-markup transition package.
* Add Provides against python-markup.
* Add doc-base.
* Add depends against python-xml.
* Add suggests to python-setuptools.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="ascii"?>
 
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
3
          "DTD/xhtml1-transitional.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<head>
 
6
  <title>genshi.template.text.TextTemplate</title>
 
7
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
 
8
  <script type="text/javascript" src="epydoc.js"></script>
 
9
</head>
 
10
 
 
11
<body bgcolor="white" text="black" link="blue" vlink="#204080"
 
12
      alink="#204080">
 
13
<!-- ==================== NAVIGATION BAR ==================== -->
 
14
<table class="navbar" border="0" width="100%" cellpadding="0"
 
15
       bgcolor="#a0c0ff" cellspacing="0">
 
16
  <tr valign="middle">
 
17
  <!-- Home link -->
 
18
      <th>&nbsp;&nbsp;&nbsp;<a
 
19
        href="genshi-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
 
20
 
 
21
  <!-- Tree link -->
 
22
      <th>&nbsp;&nbsp;&nbsp;<a
 
23
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
 
24
 
 
25
  <!-- Index link -->
 
26
      <th>&nbsp;&nbsp;&nbsp;<a
 
27
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
 
28
 
 
29
  <!-- Help link -->
 
30
      <th>&nbsp;&nbsp;&nbsp;<a
 
31
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
 
32
 
 
33
  <!-- Project homepage -->
 
34
      <th class="navbar" align="right" width="100%">
 
35
        <table border="0" cellpadding="0" cellspacing="0">
 
36
          <tr><th class="navbar" align="center"
 
37
            ><a class="navbar" target="_top" href="../index.html">Documentation Index</a></th>
 
38
          </tr></table></th>
 
39
  </tr>
 
40
</table>
 
41
<table width="100%" cellpadding="0" cellspacing="0">
 
42
  <tr valign="top">
 
43
    <td width="100%">
 
44
      <span class="breadcrumbs">
 
45
        <a href="genshi-module.html">Package&nbsp;genshi</a> ::
 
46
        <a href="genshi.template-module.html">Package&nbsp;template</a> ::
 
47
        <a href="genshi.template.text-module.html">Module&nbsp;text</a> ::
 
48
        Class&nbsp;TextTemplate
 
49
      </span>
 
50
    </td>
 
51
    <td>
 
52
      <table cellpadding="0" cellspacing="0">
 
53
        <!-- hide/show private -->
 
54
      </table>
 
55
    </td>
 
56
  </tr>
 
57
</table>
 
58
<!-- ==================== CLASS DESCRIPTION ==================== -->
 
59
<h1 class="epydoc">Class TextTemplate</h1><br /><br />
 
60
<pre class="base-tree">
 
61
   object --+    
 
62
            |    
 
63
<a href="genshi.template.base.Template-class.html">base.Template</a> --+
 
64
                |
 
65
               <strong class="uidshort">TextTemplate</strong>
 
66
</pre>
 
67
 
 
68
<hr />
 
69
<p>Implementation of a simple text-based template engine.</p>
 
70
<pre class="py-doctest">
 
71
<span class="py-prompt">&gt;&gt;&gt; </span>tmpl = TextTemplate(<span class="py-string">'''Dear $name,</span>
 
72
<span class="py-more">...</span>
 
73
<span class="py-more">... </span><span class="py-string">We have the following items for you:</span>
 
74
<span class="py-more">... </span><span class="py-string">#for item in items</span>
 
75
<span class="py-more">... </span><span class="py-string"> * $item</span>
 
76
<span class="py-more">... </span><span class="py-string">#end</span>
 
77
<span class="py-more">...</span>
 
78
<span class="py-more">... </span><span class="py-string">All the best,</span>
 
79
<span class="py-more">... </span><span class="py-string">Foobar'''</span>)
 
80
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> tmpl.generate(name=<span class="py-string">'Joe'</span>, <span class="py-builtin">items</span>=[1, 2, 3]).render(<span class="py-string">'text'</span>)
 
81
<span class="py-output">Dear Joe,</span>
 
82
<span class="py-output">&lt;BLANKLINE&gt;</span>
 
83
<span class="py-output">We have the following items for you:</span>
 
84
<span class="py-output"> * 1</span>
 
85
<span class="py-output"> * 2</span>
 
86
<span class="py-output"> * 3</span>
 
87
<span class="py-output">&lt;BLANKLINE&gt;</span>
 
88
<span class="py-output">All the best,</span>
 
89
<span class="py-output">Foobar</span></pre><br /><br />
 
90
 
 
91
<!-- ==================== NESTED CLASSES ==================== -->
 
92
<a name="section-NestedClasses"></a>
 
93
<table class="summary" border="1" cellpadding="3"
 
94
       cellspacing="0" width="100%" bgcolor="white">
 
95
<tr bgcolor="#70b0f0" class="table-header">
 
96
  <td align="left" colspan="2" class="table-header">
 
97
    <span class="table-header">Nested Classes</span></td>
 
98
</tr>
 
99
  <tr>
 
100
    <td colspan="2" class="summary">
 
101
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="genshi.template.base.Template-class.html">base.Template</a></code></b>:
 
102
      <code><a href="genshi.template.base.TemplateMeta-class.html">__metaclass__</a></code>
 
103
      </p>
 
104
    </td>
 
105
  </tr>
 
106
</table>
 
107
<!-- ==================== INSTANCE METHODS ==================== -->
 
108
<a name="section-InstanceMethods"></a>
 
109
<table class="summary" border="1" cellpadding="3"
 
110
       cellspacing="0" width="100%" bgcolor="white">
 
111
<tr bgcolor="#70b0f0" class="table-header">
 
112
  <td align="left" colspan="2" class="table-header">
 
113
    <span class="table-header">Instance Methods</span></td>
 
114
</tr>
 
115
  <tr>
 
116
    <td colspan="2" class="summary">
 
117
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="genshi.template.base.Template-class.html">base.Template</a></code></b>:
 
118
      <code><a href="genshi.template.base.Template-class.html#__init__">__init__</a></code>,
 
119
      <code><a href="genshi.template.base.Template-class.html#__repr__">__repr__</a></code>,
 
120
      <code><a href="genshi.template.base.Template-class.html#generate">generate</a></code>
 
121
      </p>
 
122
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
 
123
      <code>__delattr__</code>,
 
124
      <code>__getattribute__</code>,
 
125
      <code>__hash__</code>,
 
126
      <code>__new__</code>,
 
127
      <code>__reduce__</code>,
 
128
      <code>__reduce_ex__</code>,
 
129
      <code>__setattr__</code>,
 
130
      <code>__str__</code>
 
131
      </p>
 
132
    </td>
 
133
  </tr>
 
134
</table>
 
135
<!-- ==================== CLASS VARIABLES ==================== -->
 
136
<a name="section-ClassVariables"></a>
 
137
<table class="summary" border="1" cellpadding="3"
 
138
       cellspacing="0" width="100%" bgcolor="white">
 
139
<tr bgcolor="#70b0f0" class="table-header">
 
140
  <td align="left" colspan="2" class="table-header">
 
141
    <span class="table-header">Class Variables</span></td>
 
142
</tr>
 
143
<tr>
 
144
    <td width="15%" align="right" valign="top" class="summary">
 
145
      <span class="summary-type">&nbsp;</span>
 
146
    </td><td class="summary">
 
147
        <a href="genshi.template.text.TextTemplate-class.html#directives" class="summary-name">directives</a> = <code title="[('def', &lt;class 'genshi.template.directives.DefDirective'&gt;),
 
148
 ('when', &lt;class 'genshi.template.directives.WhenDirective'&gt;),
 
149
 ('otherwise',
 
150
  &lt;class 'genshi.template.directives.OtherwiseDirective'&gt;),
 
151
 ('for', &lt;class 'genshi.template.directives.ForDirective'&gt;),
 
152
 ('if', &lt;class 'genshi.template.directives.IfDirective'&gt;),
 
153
 ('choose', &lt;class 'genshi.template.directives.ChooseDirective'&gt;),
 
154
 ('with', &lt;class 'genshi.template.directives.WithDirective'&gt;)]"><code class="variable-group">[</code><code class="variable-group">(</code><code class="variable-quote">'</code><code class="variable-string">def</code><code class="variable-quote">'</code><code class="variable-op">, </code>&lt;class 'genshi.template.directives.DefDi<code class="variable-ellipsis">...</code></code>
 
155
    </td>
 
156
  </tr>
 
157
  <tr>
 
158
    <td colspan="2" class="summary">
 
159
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="genshi.template.base.Template-class.html">base.Template</a></code></b>:
 
160
      <code><a href="genshi.template.base.Template-class.html#EXPR">EXPR</a></code>,
 
161
      <code><a href="genshi.template.base.Template-class.html#SUB">SUB</a></code>
 
162
      </p>
 
163
    </td>
 
164
  </tr>
 
165
</table>
 
166
<!-- ==================== PROPERTIES ==================== -->
 
167
<a name="section-Properties"></a>
 
168
<table class="summary" border="1" cellpadding="3"
 
169
       cellspacing="0" width="100%" bgcolor="white">
 
170
<tr bgcolor="#70b0f0" class="table-header">
 
171
  <td align="left" colspan="2" class="table-header">
 
172
    <span class="table-header">Properties</span></td>
 
173
</tr>
 
174
  <tr>
 
175
    <td colspan="2" class="summary">
 
176
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
 
177
      <code>__class__</code>
 
178
      </p>
 
179
    </td>
 
180
  </tr>
 
181
</table>
 
182
<!-- ==================== CLASS VARIABLE DETAILS ==================== -->
 
183
<a name="section-ClassVariableDetails"></a>
 
184
<table class="details" border="1" cellpadding="3"
 
185
       cellspacing="0" width="100%" bgcolor="white">
 
186
<tr bgcolor="#70b0f0" class="table-header">
 
187
  <td align="left" colspan="2" class="table-header">
 
188
    <span class="table-header">Class Variable Details</span></td>
 
189
</tr>
 
190
</table>
 
191
<a name="directives"></a>
 
192
<div>
 
193
<table class="details" border="1" cellpadding="3"
 
194
       cellspacing="0" width="100%" bgcolor="white">
 
195
<tr><td>
 
196
  <h3 class="epydoc">directives</h3>
 
197
  
 
198
  <dl class="fields">
 
199
  </dl>
 
200
  <dl class="fields">
 
201
    <dt>Value:</dt>
 
202
      <dd><table><tr><td><pre class="variable">
 
203
<code class="variable-group">[</code><code class="variable-group">(</code><code class="variable-quote">'</code><code class="variable-string">def</code><code class="variable-quote">'</code><code class="variable-op">, </code>&lt;class 'genshi.template.directives.DefDirective'&gt;<code class="variable-group">)</code><code class="variable-op">,</code>
 
204
 <code class="variable-group">(</code><code class="variable-quote">'</code><code class="variable-string">when</code><code class="variable-quote">'</code><code class="variable-op">, </code>&lt;class 'genshi.template.directives.WhenDirective'&gt;<code class="variable-group">)</code><code class="variable-op">,</code>
 
205
 <code class="variable-group">(</code><code class="variable-quote">'</code><code class="variable-string">otherwise</code><code class="variable-quote">'</code><code class="variable-op">,</code>
 
206
  &lt;class 'genshi.template.directives.OtherwiseDirective'&gt;<code class="variable-group">)</code><code class="variable-op">,</code>
 
207
 <code class="variable-group">(</code><code class="variable-quote">'</code><code class="variable-string">for</code><code class="variable-quote">'</code><code class="variable-op">, </code>&lt;class 'genshi.template.directives.ForDirective'&gt;<code class="variable-group">)</code><code class="variable-op">,</code>
 
208
 <code class="variable-group">(</code><code class="variable-quote">'</code><code class="variable-string">if</code><code class="variable-quote">'</code><code class="variable-op">, </code>&lt;class 'genshi.template.directives.IfDirective'&gt;<code class="variable-group">)</code><code class="variable-op">,</code>
 
209
 <code class="variable-group">(</code><code class="variable-quote">'</code><code class="variable-string">choose</code><code class="variable-quote">'</code><code class="variable-op">, </code>&lt;class 'genshi.template.directives.ChooseDirective'&gt;<code class="variable-group">)</code><code class="variable-op">,</code>
 
210
 <code class="variable-group">(</code><code class="variable-quote">'</code><code class="variable-string">with</code><code class="variable-quote">'</code><code class="variable-op">, </code>&lt;class 'genshi.template.directives.WithDirective'&gt;<code class="variable-group">)</code><code class="variable-group">]</code>
 
211
</pre></td></tr></table>
 
212
</dd>
 
213
  </dl>
 
214
</td></tr></table>
 
215
</div>
 
216
<br />
 
217
<!-- ==================== NAVIGATION BAR ==================== -->
 
218
<table class="navbar" border="0" width="100%" cellpadding="0"
 
219
       bgcolor="#a0c0ff" cellspacing="0">
 
220
  <tr valign="middle">
 
221
  <!-- Home link -->
 
222
      <th>&nbsp;&nbsp;&nbsp;<a
 
223
        href="genshi-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
 
224
 
 
225
  <!-- Tree link -->
 
226
      <th>&nbsp;&nbsp;&nbsp;<a
 
227
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
 
228
 
 
229
  <!-- Index link -->
 
230
      <th>&nbsp;&nbsp;&nbsp;<a
 
231
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
 
232
 
 
233
  <!-- Help link -->
 
234
      <th>&nbsp;&nbsp;&nbsp;<a
 
235
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
 
236
 
 
237
  <!-- Project homepage -->
 
238
      <th class="navbar" align="right" width="100%">
 
239
        <table border="0" cellpadding="0" cellspacing="0">
 
240
          <tr><th class="navbar" align="center"
 
241
            ><a class="navbar" target="_top" href="../index.html">Documentation Index</a></th>
 
242
          </tr></table></th>
 
243
  </tr>
 
244
</table>
 
245
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
 
246
  <tr>
 
247
    <td align="left" class="footer">
 
248
    Generated by Epydoc 3.0beta1 on Mon Apr 16 16:02:14 2007
 
249
    </td>
 
250
    <td align="right" class="footer">
 
251
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
 
252
    </td>
 
253
  </tr>
 
254
</table>
 
255
 
 
256
<script type="text/javascript">
 
257
  <!--
 
258
  // Private objects are initially displayed (because if
 
259
  // javascript is turned off then we want them to be
 
260
  // visible); but by default, we want to hide them.  So hide
 
261
  // them unless we have a cookie that says to show them.
 
262
  checkCookie()
 
263
  // -->
 
264
</script>
 
265
  
 
266
</body>
 
267
</html>