/usr/share/doc/epydoc-doc/doc/manual-fields.html is in epydoc-doc 3.0.1-11.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | <?xml version="1.0" encoding="ascii" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ascii" />
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
<title>Epydoc Fields</title>
<link rel="stylesheet" href="custom.css" type="text/css" />
</head>
<body>
<div class="document" id="epydoc-fields">
<h1 class="title">Epydoc Fields</h1>
<!-- $Id: manual-fields.txt 1554 2007-02-27 03:31:56Z edloper $ -->
<p>Fields are used to describe specific properties of a documented object. For
example, fields can be used to define the parameters and return value of a
function; the instance variables of a class; and the author of a module. Each
field consists of a <em>tag</em>, an optional <em>argument</em>, and a <em>body</em>.</p>
<ul class="simple">
<li>The <em>tag</em> is a case-insensitive word that indicates what kind of
documentation is given by the field.</li>
<li>The optional <em>argument</em> specifies what object, parameter, or group is
documented by the field.</li>
<li>The <em>body</em> contains the main contents of the field.</li>
</ul>
<div class="section" id="field-markup">
<h1>Field Markup</h1>
<p>Each docstring markup langauge marks fields differently. The following table
shows the basic fields syntax for each markup language. For more information,
see the definition of field syntax for each markup language.</p>
<table border="1" class="docutils">
<colgroup>
<col width="33%" />
<col width="33%" />
<col width="33%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Epytext</th>
<th class="head">reStructuredText</th>
<th class="head">Javadoc</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><pre class="first last literal-block">
@<em>tag</em>: <em>body</em>...
@<em>tag</em> <em>arg</em>: <em>body</em>...
</pre>
</td>
<td><pre class="first last literal-block">
:<em>tag</em>: <em>body</em>...
:<em>tag</em> <em>arg</em>: <em>body</em>...
</pre>
</td>
<td><pre class="first last literal-block">
@<em>tag</em> <em>body</em>...
@<em>tag</em> <em>arg</em> <em>body</em>...
</pre>
</td>
</tr>
<tr><td><a class="reference external" href="manual-epytext.html#fields">Definition of epytext fields</a></td>
<td><a class="reference external" href="http://docutils.sourceforge.net/spec/rst/reStructuredText.html#field-lists">Definition of ReStructuredText fields</a></td>
<td><a class="reference external" href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/javadoc.html#javadoctags">Definition of Javadoc fields</a></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="supported-fields">
<h1>Supported Fields</h1>
<p>The following table lists the fields that epydoc currently recognizes. Field
tags are written using epytext markup; if you are using a different markup
language, then you should adjust the markup accordingly.</p>
<div class="section" id="functions-and-methods-parameters">
<h2>Functions and Methods parameters</h2>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">@param</span></tt> <em>p</em>: ...</dt>
<dd>A description of the parameter <em>p</em> for a function or method.</dd>
<dt><tt class="docutils literal"><span class="pre">@type</span></tt> <em>p</em>: ...</dt>
<dd>The expected type for the parameter <em>p</em>.</dd>
<dt><tt class="docutils literal"><span class="pre">@return</span></tt>: ...</dt>
<dd>The return value for a function or method.</dd>
<dt><tt class="docutils literal"><span class="pre">@rtype</span></tt>: ...</dt>
<dd>The type of the return value for a function or method.</dd>
<dt><tt class="docutils literal"><span class="pre">@keyword</span></tt> <em>p</em>: ...</dt>
<dd>A description of the keyword parameter <em>p</em>.</dd>
<dt><tt class="docutils literal"><span class="pre">@raise</span></tt> <em>e</em>: ...</dt>
<dd>A description of the circumstances under which a function or method
raises exception <em>e</em>.</dd>
</dl>
<p>These tags can be used to specify attributes of parameters and return value
of function and methods. These tags are usually put in the the docstring of the
function to be documented.</p>
<div class="note">
<p class="first admonition-title">Note</p>
<p><strong>constructor parameters</strong></p>
<p class="last">In C extension modules, extension classes cannot have a docstring attached
to the <tt class="docutils literal"><span class="pre">__init__</span></tt> function; consequently it is not possible to document
parameters and exceptions raised by the class constructor. To overcome this
shortcoming, the tags <tt class="docutils literal"><span class="pre">@param</span></tt>, <tt class="docutils literal"><span class="pre">@keyword</span></tt>, <tt class="docutils literal"><span class="pre">@type</span></tt>, <tt class="docutils literal"><span class="pre">@exception</span></tt>
are also allowed to appear in the class docstring. In this case they refer
to constructor parameters.</p>
</div>
<p><tt class="docutils literal"><span class="pre">@param</span></tt> fields should be used to document any explicit parameter
(including the keyword parameter). <tt class="docutils literal"><span class="pre">@keyword</span></tt> fields should only be used
for non-explicit keyword parameters:</p>
<pre class="py-doctest">
<span class="py-keyword">def</span> <span class="py-defname">plant</span>(seed, *tools, **options):
<span class="py-string">"""</span>
<span class="py-string"> @param seed: The seed that should be planted.</span>
<span class="py-string"> @param tools: Tools that should be used to plant the seed.</span>
<span class="py-string"> @param options: Any extra options for the planting.</span>
<span class="py-string"> @keyword dig_deep: Plant the seed deep under ground.</span>
<span class="py-string"> @keyword soak: Soak the seed before planting it.</span>
<span class="py-string"> """</span>
<span class="py-comment">#[...]</span></pre>
<p>Since the <tt class="docutils literal"><span class="pre">@type</span></tt> field allows for arbitrary text, it does not
automatically create a crossreference link to the specified type, and is
not written in fixed-width font by default. If you want to create a
crossreference link to the type, or to write the type in a fixed-width
font, then you must use inline markup:</p>
<pre class="py-doctest">
<span class="py-keyword">def</span> <span class="py-defname">ponder</span>(person, time):
<span class="py-string">"""</span>
<span class="py-string"> @param person: Who should think.</span>
<span class="py-string"> @type person: L{Person} or L{Animal}</span>
<span class="py-string"> @param time: How long they should think.</span>
<span class="py-string"> @type time: C{int} or C{float}</span>
<span class="py-string"> """</span>
<span class="py-comment">#[...]</span></pre>
</div>
<div class="section" id="variables-parameters">
<h2>Variables parameters</h2>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">@ivar</span></tt> <em>v</em>: ...</dt>
<dd>A description of the class instance variable <em>v</em>.</dd>
<dt><tt class="docutils literal"><span class="pre">@cvar</span></tt> <em>v</em>: ...</dt>
<dd>A description of the static class variable <em>v</em>.</dd>
<dt><tt class="docutils literal"><span class="pre">@var</span></tt> <em>v</em>: ...</dt>
<dd>A description of the module variable <em>v</em>.</dd>
<dt><tt class="docutils literal"><span class="pre">@type</span></tt> <em>v</em>: ...</dt>
<dd>The type of the variable <em>v</em>.</dd>
</dl>
<p>These tags are usually put in a module or class docstring. If the sources can
be parsed by Epydoc it is also possible to document the variable in their own
docstrings: see <a class="reference external" href="manual-docstring.html#variable-docstrings">variable docstrings</a></p>
<p>Epydoc considers class variables the ones defined directly defined in the
class body. A common Python idiom is to create instance variables settings
their default value in the class instead of the constructor (hopefully if the
default is immutable...).</p>
<p>If you want to force Epydoc to classify as instance variable one whose default
value is set at class level, you can describe it using the tag <tt class="docutils literal"><span class="pre">@ivar</span></tt> in the
context of a variable docstring:</p>
<pre class="py-doctest">
<span class="py-keyword">class</span> <span class="py-defname">B</span>:
y = 42
<span class="py-string">"""@ivar: This is an instance variable."""</span></pre>
</div>
<div class="section" id="properties-parameters">
<h2>Properties parameters</h2>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">@type</span></tt>: ...</dt>
<dd>The type of the property.</dd>
</dl>
<p>The <tt class="docutils literal"><span class="pre">@type</span></tt> tag can be attached toa property docstring to specify its type.</p>
</div>
<div class="section" id="grouping-and-sorting">
<h2>Grouping and Sorting</h2>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">@group</span></tt> <em>g</em>: <em>c1,...,cn</em></dt>
<dd>Organizes a set of related children of a module or class into a group.
<em>g</em> is the name of the group; and <em>c1,...,cn</em> are the names of the
children in the group. To define multiple groups, use multiple group
fields.</dd>
<dt><tt class="docutils literal"><span class="pre">@sort</span></tt>: <em>c1,...,cn</em></dt>
<dd>Specifies the sort order for the children of a module or class.
<em>c1,...,cn</em> are the names of the children, in the order in which they
should appear. Any children that are not included in this list will
appear after the children from this list, in alphabetical order.</dd>
</dl>
<p>These tags can be used to present groups of related items in a logical way.
They apply to modules and classes docstrings.</p>
<p>For the <tt class="docutils literal"><span class="pre">@group</span></tt> and <tt class="docutils literal"><span class="pre">@sort</span></tt> tags, asterisks (<tt class="docutils literal"><span class="pre">*</span></tt>) can be used to
specify multiple children at once. An asterisk in a child name will match
any substring:</p>
<pre class="py-doctest">
<span class="py-keyword">class</span> <span class="py-defname">widget</span>(size, weight, age):
<span class="py-string">"""</span>
<span class="py-string"> @group Tools: zip, zap, *_tool</span>
<span class="py-string"> @group Accessors: get_*</span>
<span class="py-string"> @sort: get_*, set_*, unpack_*, cut</span>
<span class="py-string"> """</span>
<span class="py-comment">#[...]</span></pre>
<div class="note">
<p class="first admonition-title">Note</p>
<p><strong>group markers</strong></p>
<p>It is also possible to group set of related items enclosing them
into special comment starting with the <em>group markers</em> '<tt class="docutils literal"><span class="pre">#{</span></tt>' and '<tt class="docutils literal"><span class="pre">#}</span></tt>'
The group title can be specified after the opening group marker. Example:</p>
<pre class="py-doctest">
<span class="py-comment">#{ Database access functions</span>
<span class="py-keyword">def</span> <span class="py-defname">read</span>(id):
<span class="py-comment">#[...]</span>
<span class="py-keyword">def</span> <span class="py-defname">store</span>(item):
<span class="py-comment">#[...]</span>
<span class="py-keyword">def</span> <span class="py-defname">delete</span>(id):
<span class="py-comment">#[...]</span>
<span class="py-comment"># groups can't be nested, so a closing marker is not required here.</span>
<span class="py-comment">#{ Web publish functions</span>
<span class="py-keyword">def</span> <span class="py-defname">get</span>(request):
<span class="py-comment">#[...]</span>
<span class="py-keyword">def</span> <span class="py-defname">post</span>(request):
<span class="py-comment">#[...]</span>
<span class="py-comment">#}</span></pre>
</div>
</div>
<div class="section" id="notes-and-warnings">
<h2>Notes and Warnings</h2>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">@note</span></tt>: ...</dt>
<dd>A note about an object. Multiple note fields may be used to list
separate notes.</dd>
<dt><tt class="docutils literal"><span class="pre">@attention</span></tt>: ...</dt>
<dd>An important note about an object. Multiple attention fields may be
used to list separate notes.</dd>
<dt><tt class="docutils literal"><span class="pre">@bug</span></tt>: ...</dt>
<dd><p class="first">A description of a bug in an object. Multiple bug fields may be used to
report separate bugs.</p>
<div class="note last">
<p class="first admonition-title">Note</p>
<p class="last">If any <tt class="docutils literal"><span class="pre">@bug</span></tt> field is used, the HTML writer will generate a the page
<tt class="docutils literal"><span class="pre">bug-index.html</span></tt>, containing links to all the items tagged with
the field.</p>
</div>
</dd>
<dt><tt class="docutils literal"><span class="pre">@warning</span></tt>: ...</dt>
<dd>A warning about an object. Multiple warning fields may be used to
report separate warnings.</dd>
</dl>
</div>
<div class="section" id="status">
<h2>Status</h2>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">@version</span></tt>: ...</dt>
<dd>The current version of an object.</dd>
<dt><tt class="docutils literal"><span class="pre">@todo</span></tt> [<em>ver</em>]: ...</dt>
<dd><p class="first">A planned change to an object. If the optional argument ver is given,
then it specifies the version for which the change will be made.
Multiple todo fields may be used if multiple changes are planned.</p>
<div class="note last">
<p class="first admonition-title">Note</p>
<p class="last">If any <tt class="docutils literal"><span class="pre">@todo</span></tt> field is used, the HTML writer will generate a the
page <tt class="docutils literal"><span class="pre">todo-index.html</span></tt>, containing links to all the items tagged
with the field.</p>
</div>
</dd>
<dt><tt class="docutils literal"><span class="pre">@deprecated</span></tt>: ...</dt>
<dd>Indicates that an object is deprecated. The body of the field describe
the reason why the object is deprecated.</dd>
<dt><tt class="docutils literal"><span class="pre">@since</span></tt>: ...</dt>
<dd>The date or version when an object was first introduced.</dd>
<dt><tt class="docutils literal"><span class="pre">@status</span></tt>: ...</dt>
<dd>The current status of an object.</dd>
<dt><tt class="docutils literal"><span class="pre">@change</span></tt>: ...</dt>
<dd>A change log entry for this object.</dd>
<dt><tt class="docutils literal"><span class="pre">@permission</span></tt>: ...</dt>
<dd>The object access permission, for systems such Zope/Plone supporting
this concept. It may be used more than once to specify multiple
permissions.</dd>
</dl>
</div>
<div class="section" id="formal-conditions">
<h2>Formal Conditions</h2>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">@requires</span></tt>: ...</dt>
<dd>A requirement for using an object. Multiple requires fields may be
used if an object has multiple requirements.</dd>
<dt><tt class="docutils literal"><span class="pre">@precondition</span></tt>: ...</dt>
<dd>A condition that must be true before an object is used. Multiple
precondition fields may be used if an object has multiple preconditions.</dd>
<dt><tt class="docutils literal"><span class="pre">@postcondition</span></tt>: ...</dt>
<dd>A condition that is guaranteed to be true after an object is used.
Multiple postcondition fields may be used if an object has multiple
postconditions.</dd>
<dt><tt class="docutils literal"><span class="pre">@invariant</span></tt>: ...</dt>
<dd>A condition which should always be true for an object. Multiple
invariant fields may be used if an object has multiple invariants.</dd>
</dl>
</div>
<div class="section" id="bibliographic-information">
<h2>Bibliographic Information</h2>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">@author</span></tt>: ...</dt>
<dd>The author(s) of an object. Multiple author fields may be used if an
object has multiple authors.</dd>
<dt><tt class="docutils literal"><span class="pre">@organization</span></tt>: ...</dt>
<dd>The organization that created or maintains an object.</dd>
<dt><tt class="docutils literal"><span class="pre">@copyright</span></tt>: ...</dt>
<dd>The copyright information for an object.</dd>
<dt><tt class="docutils literal"><span class="pre">@license</span></tt>: ...</dt>
<dd>The licensing information for an object.</dd>
<dt><tt class="docutils literal"><span class="pre">@contact</span></tt>: ...</dt>
<dd>Contact information for the author or maintainer of a module, class,
function, or method. Multiple contact fields may be used if an object
has multiple contacts.</dd>
</dl>
</div>
<div class="section" id="other-fields">
<h2>Other fields</h2>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">@summary</span></tt>: ...</dt>
<dd>A summary description for an object. This description overrides the
default summary (which is constructed from the first sentence of the
object's description).</dd>
<dt><tt class="docutils literal"><span class="pre">@see</span></tt>: ...</dt>
<dd>A description of a related topic. see fields typically use
documentation crossreference links or external hyperlinks that link to
the related topic.</dd>
</dl>
</div>
</div>
<div class="section" id="fields-synonyms">
<h1>Fields synonyms</h1>
<p>Several fields have <em>synonyms</em>, or alternate tags. The following table lists
all field synonyms. Field tags are written using epytext markup; if you are
using a different markup language, then you should adjust the markup
accordingly.</p>
<table border="1" class="docutils">
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Name</th>
<th class="head">Synonims</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal"><span class="pre">@param</span></tt> <em>p</em>: ...</td>
<td><div class="first last line-block">
<div class="line"><tt class="docutils literal"><span class="pre">@parameter</span></tt> <em>p</em>: ...</div>
<div class="line"><tt class="docutils literal"><span class="pre">@arg</span></tt> <em>p</em>: ...</div>
<div class="line"><tt class="docutils literal"><span class="pre">@argument</span></tt> <em>p</em>: ...</div>
</div>
</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@return</span></tt>: ...</td>
<td><tt class="docutils literal"><span class="pre">@returns</span></tt>: ...</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@rtype</span></tt>: ...</td>
<td><tt class="docutils literal"><span class="pre">@returntype</span></tt>: ...</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@raise</span></tt> <em>e</em>: ...</td>
<td><div class="first last line-block">
<div class="line"><tt class="docutils literal"><span class="pre">@raises</span></tt> <em>e</em>: ...</div>
<div class="line"><tt class="docutils literal"><span class="pre">@except</span></tt> <em>e</em>: ...</div>
<div class="line"><tt class="docutils literal"><span class="pre">@exception</span></tt> <em>e</em>: ...</div>
</div>
</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@keyword</span></tt> <em>p</em>: ...</td>
<td><div class="first last line-block">
<div class="line"><tt class="docutils literal"><span class="pre">@kwarg</span></tt> <em>p</em>: ...</div>
<div class="line"><tt class="docutils literal"><span class="pre">@kwparam</span></tt> <em>p</em>: ...</div>
</div>
</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@ivar</span></tt> <em>v</em>: ...</td>
<td><tt class="docutils literal"><span class="pre">@ivariable</span></tt> <em>v</em>: ...</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@cvar</span></tt> <em>v</em>: ...</td>
<td><tt class="docutils literal"><span class="pre">@cvariable</span></tt> <em>v</em>: ...</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@var</span></tt> <em>v</em>: ...</td>
<td><tt class="docutils literal"><span class="pre">@variable</span></tt> <em>v</em>: ...</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@see</span></tt>: ...</td>
<td><tt class="docutils literal"><span class="pre">@seealso</span></tt>: ...</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@warning</span></tt>: ...</td>
<td><tt class="docutils literal"><span class="pre">@warn</span></tt>: ...</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@requires</span></tt>: ...</td>
<td><div class="first last line-block">
<div class="line"><tt class="docutils literal"><span class="pre">@require</span></tt>: ...</div>
<div class="line"><tt class="docutils literal"><span class="pre">@requirement</span></tt>: ...</div>
</div>
</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@precondition</span></tt>: ...</td>
<td><tt class="docutils literal"><span class="pre">@precond</span></tt>: ...</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@postcondition</span></tt>: ...</td>
<td><tt class="docutils literal"><span class="pre">@postcond</span></tt>: ...</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@organization</span></tt>: ...</td>
<td><tt class="docutils literal"><span class="pre">@org</span></tt>: ...</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@copyright</span></tt>: ...</td>
<td><tt class="docutils literal"><span class="pre">@(c)</span></tt>: ...</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@change</span></tt>: ...</td>
<td><tt class="docutils literal"><span class="pre">@changed</span></tt>: ...</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="module-metadata-variables">
<h1>Module metadata variables</h1>
<p>Some module variables are commonly used as module metadata. Epydoc can use the
value provided by these variables as alternate form for tags. The following
table lists the recognized variables and the tag they replace. Customized
metadata variables can be added using the method described in <a class="reference external" href="manual-fields.html#adding-new-fields">Adding New
Fields</a>.</p>
<table border="1" class="docutils">
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Tag</th>
<th class="head">Variable</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal"><span class="pre">@author</span></tt></td>
<td><tt class="docutils literal"><span class="pre">__author__</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@authors</span></tt></td>
<td><tt class="docutils literal"><span class="pre">__authors__</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@contact</span></tt></td>
<td><tt class="docutils literal"><span class="pre">__contact__</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@copyright</span></tt></td>
<td><tt class="docutils literal"><span class="pre">__copyright__</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@license</span></tt></td>
<td><tt class="docutils literal"><span class="pre">__license__</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@deprecated</span></tt></td>
<td><tt class="docutils literal"><span class="pre">__deprecated__</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@date</span></tt></td>
<td><tt class="docutils literal"><span class="pre">__date__</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">@version</span></tt></td>
<td><tt class="docutils literal"><span class="pre">__version__</span></tt></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="adding-new-fields">
<h1>Adding New Fields</h1>
<p>New fields can be defined for the docstrings in a module using the special
<tt class="docutils literal"><span class="pre">@newfield</span></tt> tag (or its synonym, <tt class="docutils literal"><span class="pre">@deffield</span></tt>). This tag has the following
syntax:</p>
<blockquote>
<pre class="literal-block">
@newfield <em>tag</em>: <em>label</em> [, <em>plural</em> ]
</pre>
</blockquote>
<p>Where <em>tag</em> is the new tag that's being defined; <em>label</em> is a string that will
be used to mark this field in the generated output; and plural is the plural form
of label, if different.</p>
<p>New fields can be defined in any Python module. If they are defined in a
package, it will be possible to use the newly defined tag from every package
submodule.</p>
<p>Each new field will also define a <a class="reference external" href="manual-fields.html#module-metadata-variables">metadata variable</a> which can be used
to set the field value instead of the tag. For example, if a <em>revision</em>
tag has been defined with:</p>
<pre class="literal-block">
@newfield revision: Revision
</pre>
<p>then it will be possible to set a value for the field using a module variable:</p>
<pre class="py-doctest">
__revision__ = <span class="py-string">"1234"</span></pre>
<p>The following example illustrates how the @newfield can be used:
Docstring Input Rendered Output</p>
<table border="1" class="docutils">
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Docstring Input</th>
<th class="head">Rendered Output</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><pre class="py-doctest">
<span class="py-string">"""</span>
<span class="py-string">@newfield corpus: Corpus, Corpora</span>
<span class="py-string">"""</span>
<span class="py-keyword">def</span> <span class="py-defname">example</span>():
<span class="py-string">"""</span>
<span class="py-string"> @corpus: Bob's wordlist.</span>
<span class="py-string"> @corpus: The British National Corpus.</span>
<span class="py-string"> """</span>
[...]</pre>
</td>
<td><p class="first"><strong>Corpora:</strong></p>
<ul class="last simple">
<li>Bob's wordlist.</li>
<li>The British National Corpus.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">The module-level variable <tt class="docutils literal"><span class="pre">__extra_epydoc_fields__</span></tt> is deprecated;
use <tt class="docutils literal"><span class="pre">@newfield</span></tt> instead.</p>
</div>
</div>
</div>
<table width="100%" class="navbox" cellpadding="1" cellspacing="0">
<tr>
<a class="nav" href="index.html">
<td align="center" width="20%" class="nav">
<a class="nav" href="index.html">
Home</a></td></a>
<a class="nav" href="installing.html">
<td align="center" width="20%" class="nav">
<a class="nav" href="installing.html">
Installing Epydoc</a></td></a>
<a class="nav" href="using.html">
<td align="center" width="20%" class="nav">
<a class="nav" href="using.html">
Using Epydoc</a></td></a>
<a class="nav" href="epytext.html">
<td align="center" width="20%" class="nav">
<a class="nav" href="epytext.html">
Epytext</a></td></a>
<td align="center" width="20%" class="nav">
<A href="http://sourceforge.net/projects/epydoc">
<IMG src="sflogo.png"
width="88" height="26" border="0" alt="SourceForge"
align="top"/></A></td>
</tr>
</table>
</body>
</html>
|