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">
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>
11
<body bgcolor="white" text="black" link="blue" vlink="#204080"
13
<!-- ==================== NAVIGATION BAR ==================== -->
14
<table class="navbar" border="0" width="100%" cellpadding="0"
15
bgcolor="#a0c0ff" cellspacing="0">
18
<th> <a
19
href="epydoc-module.html">Home</a> </th>
22
<th> <a
23
href="module-tree.html">Trees</a> </th>
26
<th> <a
27
href="identifier-index.html">Indices</a> </th>
30
<th> <a
31
href="help.html">Help</a> </th>
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>
41
<table width="100%" cellpadding="0" cellspacing="0">
44
<span class="breadcrumbs">
45
<a href="epydoc-module.html">Package epydoc</a> ::
46
<a href="epydoc.docwriter-module.html">Package docwriter</a> ::
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 private</a>]</span></td></tr>
55
<tr><td align="right"><span class="options"
56
>[<a href="frames.html" target="_top">frames</a
57
>] | <a href="epydoc.docwriter.html-module.html"
58
target="_top">no frames</a>]</span></td></tr>
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 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>
70
<div class="fields"> <p><strong>To Do:</strong>
72
href="epydoc.docwriter.html.HTMLWriter-class.html#url"
73
class="link">HTMLWriter.url()</a>?
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%">
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>
93
<td width="15%" align="right" valign="top" class="summary">
94
<span class="summary-type"> </span>
95
</td><td class="summary">
96
<a href="epydoc.docwriter.html.HTMLWriter-class.html" class="summary-name">HTMLWriter</a>
100
<td width="15%" align="right" valign="top" class="summary">
101
<span class="summary-type"> </span>
102
</td><td class="summary">
103
<a href="epydoc.docwriter.html._HTMLDocstringLinker-class.html" class="summary-name" onclick="show_private();">_HTMLDocstringLinker</a>
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%">
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>
125
<td width="15%" align="right" valign="top" class="summary">
126
<span class="summary-type"> </span>
127
</td><td class="summary">
128
<table width="100%" cellpadding="0" cellspacing="0" border="0">
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
137
<td align="right" valign="top">
138
<span class="codelink"><a href="epydoc.docwriter.html-pysrc.html#compile_template">source 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 graph</a></span>
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-module.html#compile_template" title="compile_template()" alt="" coords="5,6,173,38" />
147
<area shape="rect" href="epydoc.docwriter.html-module.html#strip_indent" title="strip_indent()" alt="" coords="221,6,344,38" />
149
<img src="call_graph_for_compile_templat.gif" alt='' usemap="#call_graph_for_compile_templat" ismap="ismap" class="graph-without-title" />
151
<tr><th>Call Graph</th></tr>
158
<td width="15%" align="right" valign="top" class="summary">
159
<span class="summary-type"> </span>
160
</td><td class="summary">
161
<table width="100%" cellpadding="0" cellspacing="0" border="0">
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 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 graph</a></span>
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-module.html#compile_template" title="compile_template()" alt="" coords="5,6,173,38" />
177
<area shape="rect" href="epydoc.docwriter.html-module.html#strip_indent" title="strip_indent()" alt="" coords="221,6,344,38" />
179
<img src="call_graph_for_strip_indent.gif" alt='' usemap="#call_graph_for_strip_indent" ismap="ismap" class="graph-without-title" />
181
<tr><th>Call Graph</th></tr>
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%">
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>
206
<a name="compile_template"></a>
208
<table class="details" border="1" cellpadding="3"
209
cellspacing="0" width="100%" bgcolor="white">
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>
218
</td><td align="right" valign="top"
219
><span class="codelink"><a href="epydoc.docwriter.html-pysrc.html#compile_template">source code</a></span>
220
<br /><span class="codelink"><a href="javascript:void(0);" onclick="toggleCallGraph('call_graph_for_compile_templat-div');return false;">call graph</a></span> </td>
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-module.html#compile_template" title="compile_template()" alt="" coords="5,6,173,38" />
226
<area shape="rect" href="epydoc.docwriter.html-module.html#strip_indent" title="strip_indent()" alt="" coords="221,6,344,38" />
228
<img src="call_graph_for_compile_templat.gif" alt='' usemap="#call_graph_for_compile_templat" ismap="ismap" class="graph-without-title" />
230
<tr><th>Call Graph</th></tr>
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>
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.
249
Any line that begins with '>>>' (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
'>>>'-marked line whose indentation is less than or equal to
254
the line's own indentation (including lines that only contain
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).
263
<p>Here is a simple example:</p>
264
<pre class="py-doctest">
265
<span class="py-prompt">>>> </span>TEMPLATE = <span class="py-string">''</span>'
266
<span class="py-more">... </span><book>
267
<span class="py-more">... </span> <title>$book.title$</title>
268
<span class="py-more">... </span> <pages>$book.count_pages()$</pages>
269
<span class="py-more">... </span>>>> <span class="py-keyword">for</span> chapter <span class="py-keyword">in</span> book.chapters:
270
<span class="py-more">... </span> <chaptername>$chapter.name$</chaptername>
271
<span class="py-more">... </span>>>> <span class="py-comment">#endfor</span>
272
<span class="py-more">... </span></book>
273
<span class="py-prompt">>>> </span>write_book = compile_template(<span class="py-string">'write_book(out, book)'</span>, TEMPLATE)</pre>
276
<div class="fields"> <p><strong>Acknowledgements:</strong>
277
The syntax used by <code>compile_template</code> is loosely based
280
</div></td></tr></table>
283
<!-- ==================== NAVIGATION BAR ==================== -->
284
<table class="navbar" border="0" width="100%" cellpadding="0"
285
bgcolor="#a0c0ff" cellspacing="0">
288
<th> <a
289
href="epydoc-module.html">Home</a> </th>
292
<th> <a
293
href="module-tree.html">Trees</a> </th>
296
<th> <a
297
href="identifier-index.html">Indices</a> </th>
300
<th> <a
301
href="help.html">Help</a> </th>
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>
311
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
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>
317
<td align="right" class="footer">
318
<a target="mainFrame" href="http://epydoc.sourceforge.net"
319
>http://epydoc.sourceforge.net</a>
324
<script type="text/javascript">
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.