~ubuntu-branches/debian/lenny/epydoc/lenny

« back to all changes in this revision

Viewing changes to doc/api/epydoc.docwriter.html-module.html

  • Committer: Bazaar Package Importer
  • Author(s): Kenneth J. Pronovici
  • Date: 2008-02-03 13:22:12 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080203132212-u2uohl6rswmlz2ra
Tags: 3.0.1-1
* New upstream release.
* Removed #! from top of epydoc/gui.py
* Got rid of version mangling in debian/watch.

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>epydoc.docwriter.html</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="epydoc-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="http://epydoc.sourceforge.net">epydoc 3.0.1</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="epydoc-module.html">Package&nbsp;epydoc</a> ::
 
46
        <a href="epydoc.docwriter-module.html">Package&nbsp;docwriter</a> ::
 
47
        Module&nbsp;html
 
48
      </span>
 
49
    </td>
 
50
    <td>
 
51
      <table cellpadding="0" cellspacing="0">
 
52
        <!-- hide/show private -->
 
53
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
 
54
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
 
55
        <tr><td align="right"><span class="options"
 
56
            >[<a href="frames.html" target="_top">frames</a
 
57
            >]&nbsp;|&nbsp;<a href="epydoc.docwriter.html-module.html"
 
58
            target="_top">no&nbsp;frames</a>]</span></td></tr>
 
59
      </table>
 
60
    </td>
 
61
  </tr>
 
62
</table>
 
63
<!-- ==================== MODULE DESCRIPTION ==================== -->
 
64
<h1 class="epydoc">Module html</h1><p class="nomargin-top"><span class="codelink"><a href="epydoc.docwriter.html-pysrc.html">source&nbsp;code</a></span></p>
 
65
<p>The HTML output generator for epydoc.  The main interface provided by 
 
66
  this module is the <a href="epydoc.docwriter.html.HTMLWriter-class.html" 
 
67
  class="link">HTMLWriter</a> class.</p>
 
68
 
 
69
<hr />
 
70
<div class="fields">      <p><strong>To Do:</strong>
 
71
        Add a cache to <a 
 
72
    href="epydoc.docwriter.html.HTMLWriter-class.html#url" 
 
73
    class="link">HTMLWriter.url()</a>?
 
74
      </p>
 
75
</div><!-- ==================== CLASSES ==================== -->
 
76
<a name="section-Classes"></a>
 
77
<table class="summary" border="1" cellpadding="3"
 
78
       cellspacing="0" width="100%" bgcolor="white">
 
79
<tr bgcolor="#70b0f0" class="table-header">
 
80
  <td colspan="2" class="table-header">
 
81
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
 
82
      <tr valign="top">
 
83
        <td align="left"><span class="table-header">Classes</span></td>
 
84
        <td align="right" valign="top"
 
85
         ><span class="options">[<a href="#section-Classes"
 
86
         class="privatelink" onclick="toggle_private();"
 
87
         >hide private</a>]</span></td>
 
88
      </tr>
 
89
    </table>
 
90
  </td>
 
91
</tr>
 
92
<tr>
 
93
    <td width="15%" align="right" valign="top" class="summary">
 
94
      <span class="summary-type">&nbsp;</span>
 
95
    </td><td class="summary">
 
96
        <a href="epydoc.docwriter.html.HTMLWriter-class.html" class="summary-name">HTMLWriter</a>
 
97
    </td>
 
98
  </tr>
 
99
<tr class="private">
 
100
    <td width="15%" align="right" valign="top" class="summary">
 
101
      <span class="summary-type">&nbsp;</span>
 
102
    </td><td class="summary">
 
103
        <a href="epydoc.docwriter.html._HTMLDocstringLinker-class.html" class="summary-name" onclick="show_private();">_HTMLDocstringLinker</a>
 
104
    </td>
 
105
  </tr>
 
106
</table>
 
107
<!-- ==================== FUNCTIONS ==================== -->
 
108
<a name="section-Functions"></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 colspan="2" class="table-header">
 
113
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
 
114
      <tr valign="top">
 
115
        <td align="left"><span class="table-header">Functions</span></td>
 
116
        <td align="right" valign="top"
 
117
         ><span class="options">[<a href="#section-Functions"
 
118
         class="privatelink" onclick="toggle_private();"
 
119
         >hide private</a>]</span></td>
 
120
      </tr>
 
121
    </table>
 
122
  </td>
 
123
</tr>
 
124
<tr>
 
125
    <td width="15%" align="right" valign="top" class="summary">
 
126
      <span class="summary-type">&nbsp;</span>
 
127
    </td><td class="summary">
 
128
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
 
129
        <tr>
 
130
          <td><span class="summary-sig"><a href="epydoc.docwriter.html-module.html#compile_template" class="summary-sig-name">compile_template</a>(<span class="summary-sig-arg">docstring</span>,
 
131
        <span class="summary-sig-arg">template_string</span>,
 
132
        <span class="summary-sig-arg">output_function</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">out</code><code class="variable-quote">'</code></span>,
 
133
        <span class="summary-sig-arg">debug</span>=<span class="summary-sig-default">True</span>)</span><br />
 
134
      Given a template string containing inline python source code, return 
 
135
      a python function that will fill in the template, and output the 
 
136
      result.</td>
 
137
          <td align="right" valign="top">
 
138
            <span class="codelink"><a href="epydoc.docwriter.html-pysrc.html#compile_template">source&nbsp;code</a></span>
 
139
            <br /><span class="codelink"><a href="javascript:void(0);" onclick="toggleCallGraph('call_graph_for_compile_templat-summary-div');return false;">call&nbsp;graph</a></span>&nbsp;
 
140
          </td>
 
141
        </tr>
 
142
      </table>
 
143
      <div style="display:none" id="call_graph_for_compile_templat-summary-div"><center>
 
144
<table border="0" cellpadding="0" cellspacing="0">
 
145
  <tr><td><center>  <map id="call_graph_for_compile_templat" name="call_graph_for_compile_templat">
 
146
<area shape="rect" href="epydoc.docwriter.html&#45;module.html#compile_template" title="compile_template()" alt="" coords="5,6,173,38" />
 
147
<area shape="rect" href="epydoc.docwriter.html&#45;module.html#strip_indent" title="strip_indent()" alt="" coords="221,6,344,38" />
 
148
</map>
 
149
  <img src="call_graph_for_compile_templat.gif" alt='' usemap="#call_graph_for_compile_templat" ismap="ismap" class="graph-without-title" />
 
150
</center></td></tr>
 
151
  <tr><th>Call Graph</th></tr>
 
152
</table><br />
 
153
</center></div>
 
154
 
 
155
    </td>
 
156
  </tr>
 
157
<tr>
 
158
    <td width="15%" align="right" valign="top" class="summary">
 
159
      <span class="summary-type">&nbsp;</span>
 
160
    </td><td class="summary">
 
161
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
 
162
        <tr>
 
163
          <td><span class="summary-sig"><a name="strip_indent"></a><span class="summary-sig-name">strip_indent</span>(<span class="summary-sig-arg">s</span>)</span><br />
 
164
      Given a multiline string <code>s</code>, find the minimum indentation
 
165
      for all non-blank lines, and return a new string formed by stripping 
 
166
      that amount of indentation from all lines in <code>s</code>.</td>
 
167
          <td align="right" valign="top">
 
168
            <span class="codelink"><a href="epydoc.docwriter.html-pysrc.html#strip_indent">source&nbsp;code</a></span>
 
169
            <br /><span class="codelink"><a href="javascript:void(0);" onclick="toggleCallGraph('call_graph_for_strip_indent-summary-div');return false;">call&nbsp;graph</a></span>&nbsp;
 
170
          </td>
 
171
        </tr>
 
172
      </table>
 
173
      <div style="display:none" id="call_graph_for_strip_indent-summary-div"><center>
 
174
<table border="0" cellpadding="0" cellspacing="0">
 
175
  <tr><td><center>  <map id="call_graph_for_strip_indent" name="call_graph_for_strip_indent">
 
176
<area shape="rect" href="epydoc.docwriter.html&#45;module.html#compile_template" title="compile_template()" alt="" coords="5,6,173,38" />
 
177
<area shape="rect" href="epydoc.docwriter.html&#45;module.html#strip_indent" title="strip_indent()" alt="" coords="221,6,344,38" />
 
178
</map>
 
179
  <img src="call_graph_for_strip_indent.gif" alt='' usemap="#call_graph_for_strip_indent" ismap="ismap" class="graph-without-title" />
 
180
</center></td></tr>
 
181
  <tr><th>Call Graph</th></tr>
 
182
</table><br />
 
183
</center></div>
 
184
 
 
185
    </td>
 
186
  </tr>
 
187
</table>
 
188
<!-- ==================== FUNCTION DETAILS ==================== -->
 
189
<a name="section-FunctionDetails"></a>
 
190
<table class="details" border="1" cellpadding="3"
 
191
       cellspacing="0" width="100%" bgcolor="white">
 
192
<tr bgcolor="#70b0f0" class="table-header">
 
193
  <td colspan="2" class="table-header">
 
194
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
 
195
      <tr valign="top">
 
196
        <td align="left"><span class="table-header">Function Details</span></td>
 
197
        <td align="right" valign="top"
 
198
         ><span class="options">[<a href="#section-FunctionDetails"
 
199
         class="privatelink" onclick="toggle_private();"
 
200
         >hide private</a>]</span></td>
 
201
      </tr>
 
202
    </table>
 
203
  </td>
 
204
</tr>
 
205
</table>
 
206
<a name="compile_template"></a>
 
207
<div>
 
208
<table class="details" border="1" cellpadding="3"
 
209
       cellspacing="0" width="100%" bgcolor="white">
 
210
<tr><td>
 
211
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
 
212
  <tr valign="top"><td>
 
213
  <h3 class="epydoc"><span class="sig"><span class="sig-name">compile_template</span>(<span class="sig-arg">docstring</span>,
 
214
        <span class="sig-arg">template_string</span>,
 
215
        <span class="sig-arg">output_function</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">out</code><code class="variable-quote">'</code></span>,
 
216
        <span class="sig-arg">debug</span>=<span class="sig-default">True</span>)</span>
 
217
  </h3>
 
218
  </td><td align="right" valign="top"
 
219
    ><span class="codelink"><a href="epydoc.docwriter.html-pysrc.html#compile_template">source&nbsp;code</a></span>&nbsp;
 
220
    <br /><span class="codelink"><a href="javascript:void(0);" onclick="toggleCallGraph('call_graph_for_compile_templat-div');return false;">call&nbsp;graph</a></span>&nbsp;</td>
 
221
  </tr></table>
 
222
  <div style="display:none" id="call_graph_for_compile_templat-div"><center>
 
223
<table border="0" cellpadding="0" cellspacing="0">
 
224
  <tr><td><center>  <map id="call_graph_for_compile_templat" name="call_graph_for_compile_templat">
 
225
<area shape="rect" href="epydoc.docwriter.html&#45;module.html#compile_template" title="compile_template()" alt="" coords="5,6,173,38" />
 
226
<area shape="rect" href="epydoc.docwriter.html&#45;module.html#strip_indent" title="strip_indent()" alt="" coords="221,6,344,38" />
 
227
</map>
 
228
  <img src="call_graph_for_compile_templat.gif" alt='' usemap="#call_graph_for_compile_templat" ismap="ismap" class="graph-without-title" />
 
229
</center></td></tr>
 
230
  <tr><th>Call Graph</th></tr>
 
231
</table><br />
 
232
</center></div>
 
233
 
 
234
  <p>Given a template string containing inline python source code, return a
 
235
  python function that will fill in the template, and output the result.  
 
236
  The signature for this function is taken from the first line of 
 
237
  <code>docstring</code>.  Output is generated by making repeated calls to 
 
238
  the output function with the given name (which is typically one of the 
 
239
  function's parameters).</p>
 
240
  <p>The templating language used by this function passes through all text 
 
241
  as-is, with three exceptions:</p>
 
242
  <ul>
 
243
    <li>
 
244
      If every line in the template string is indented by at least <i 
 
245
      class="math">x</i> spaces, then the first <i class="math">x</i> 
 
246
      spaces are stripped from each line.
 
247
    </li>
 
248
    <li>
 
249
      Any line that begins with '&gt;&gt;&gt;' (with no indentation) should
 
250
      contain python code, and will be inserted as-is into the 
 
251
      template-filling function.  If the line begins a control block (such 
 
252
      as 'if' or 'for'), then the control block will be closed by the first
 
253
      '&gt;&gt;&gt;'-marked line whose indentation is less than or equal to
 
254
      the line's own indentation (including lines that only contain 
 
255
      comments.)
 
256
    </li>
 
257
    <li>
 
258
      In any other line, any expression between two '$' signs will be 
 
259
      evaluated and inserted into the line (using <code>str()</code> to 
 
260
      convert the result to a string).
 
261
    </li>
 
262
  </ul>
 
263
  <p>Here is a simple example:</p>
 
264
<pre class="py-doctest">
 
265
<span class="py-prompt">&gt;&gt;&gt; </span>TEMPLATE = <span class="py-string">''</span>'
 
266
<span class="py-more">... </span>&lt;book&gt;
 
267
<span class="py-more">... </span>  &lt;title&gt;$book.title$&lt;/title&gt;
 
268
<span class="py-more">... </span>  &lt;pages&gt;$book.count_pages()$&lt;/pages&gt;
 
269
<span class="py-more">... </span>&gt;&gt;&gt; <span class="py-keyword">for</span> chapter <span class="py-keyword">in</span> book.chapters:
 
270
<span class="py-more">... </span>    &lt;chaptername&gt;$chapter.name$&lt;/chaptername&gt;
 
271
<span class="py-more">... </span>&gt;&gt;&gt; <span class="py-comment">#endfor</span>
 
272
<span class="py-more">... </span>&lt;/book&gt;
 
273
<span class="py-prompt">&gt;&gt;&gt; </span>write_book = compile_template(<span class="py-string">'write_book(out, book)'</span>, TEMPLATE)</pre>
 
274
  <dl class="fields">
 
275
  </dl>
 
276
<div class="fields">      <p><strong>Acknowledgements:</strong>
 
277
        The syntax used by <code>compile_template</code> is loosely based 
 
278
        on Cheetah.
 
279
      </p>
 
280
</div></td></tr></table>
 
281
</div>
 
282
<br />
 
283
<!-- ==================== NAVIGATION BAR ==================== -->
 
284
<table class="navbar" border="0" width="100%" cellpadding="0"
 
285
       bgcolor="#a0c0ff" cellspacing="0">
 
286
  <tr valign="middle">
 
287
  <!-- Home link -->
 
288
      <th>&nbsp;&nbsp;&nbsp;<a
 
289
        href="epydoc-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
 
290
 
 
291
  <!-- Tree link -->
 
292
      <th>&nbsp;&nbsp;&nbsp;<a
 
293
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
 
294
 
 
295
  <!-- Index link -->
 
296
      <th>&nbsp;&nbsp;&nbsp;<a
 
297
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
 
298
 
 
299
  <!-- Help link -->
 
300
      <th>&nbsp;&nbsp;&nbsp;<a
 
301
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
 
302
 
 
303
  <!-- Project homepage -->
 
304
      <th class="navbar" align="right" width="100%">
 
305
        <table border="0" cellpadding="0" cellspacing="0">
 
306
          <tr><th class="navbar" align="center"
 
307
            ><a class="navbar" target="_top" href="http://epydoc.sourceforge.net">epydoc 3.0.1</a></th>
 
308
          </tr></table></th>
 
309
  </tr>
 
310
</table>
 
311
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
 
312
  <tr>
 
313
    <td align="left" class="footer">
 
314
    <a href="epydoc-log.html">Generated by Epydoc
 
315
    3.0.1 on Wed Jan 30 14:06:37 2008</a>
 
316
    </td>
 
317
    <td align="right" class="footer">
 
318
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
 
319
        >http://epydoc.sourceforge.net</a>
 
320
    </td>
 
321
  </tr>
 
322
</table>
 
323
 
 
324
<script type="text/javascript">
 
325
  <!--
 
326
  // Private objects are initially displayed (because if
 
327
  // javascript is turned off then we want them to be
 
328
  // visible); but by default, we want to hide them.  So hide
 
329
  // them unless we have a cookie that says to show them.
 
330
  checkCookie();
 
331
  // -->
 
332
</script>
 
333
</body>
 
334
</html>