blob: e5b0556ea615f3702d2daf89c526bb6f187892b7 [file] [log] [blame]
Fred Drakeacffaee1999-03-16 16:09:13 +00001\documentclass{howto}
2\usepackage{ltxmarkup}
3
4\title{Documenting Python}
5
Skip Montanaro176bda4cd2002-04-19 04:50:44 +00006\makeindex
7
Fred Drakeacffaee1999-03-16 16:09:13 +00008\input{boilerplate}
9
Fred Drakec7c9a641999-04-28 18:24:02 +000010% Now override the stuff that includes author information;
11% Guido did *not* write this one!
Fred Drakeacffaee1999-03-16 16:09:13 +000012
13\author{Fred L. Drake, Jr.}
14\authoraddress{
Fred Drake8fdb6382000-10-28 04:08:38 +000015 PythonLabs \\
Fred Drake9120df32001-07-14 02:34:12 +000016 Email: \email{fdrake@acm.org}
Fred Drakeacffaee1999-03-16 16:09:13 +000017}
Fred Drakeacffaee1999-03-16 16:09:13 +000018
19
20\begin{document}
21
22\maketitle
23
24\begin{abstract}
25\noindent
Fred Drake02997492000-09-21 05:26:43 +000026The Python language has a substantial body of
Fred Drakeacffaee1999-03-16 16:09:13 +000027documentation, much of it contributed by various authors. The markup
28used for the Python documentation is based on \LaTeX{} and requires a
29significant set of macros written specifically for documenting Python.
Fred Drake5eb992b1999-06-11 14:25:45 +000030This document describes the macros introduced to support Python
31documentation and how they should be used to support a wide range of
32output formats.
Fred Drakeacffaee1999-03-16 16:09:13 +000033
34This document describes the document classes and special markup used
35in the Python documentation. Authors may use this guide, in
36conjunction with the template files provided with the
37distribution, to create or maintain whole documents or sections.
38\end{abstract}
39
40\tableofcontents
41
42
Fred Drakef1b3de82001-07-24 14:38:34 +000043\section{Introduction \label{intro}}
Fred Drakeacffaee1999-03-16 16:09:13 +000044
45 Python's documentation has long been considered to be good for a
46 free programming language. There are a number of reasons for this,
47 the most important being the early commitment of Python's creator,
48 Guido van Rossum, to providing documentation on the language and its
49 libraries, and the continuing involvement of the user community in
50 providing assistance for creating and maintaining documentation.
51
52 The involvement of the community takes many forms, from authoring to
Fred Drake7a737df1999-04-23 14:41:44 +000053 bug reports to just plain complaining when the documentation could
54 be more complete or easier to use. All of these forms of input from
55 the community have proved useful during the time I've been involved
56 in maintaining the documentation.
Fred Drakeacffaee1999-03-16 16:09:13 +000057
Fred Drake2c4e0091999-03-29 14:55:55 +000058 This document is aimed at authors and potential authors of
Fred Drake7a737df1999-04-23 14:41:44 +000059 documentation for Python. More specifically, it is for people
60 contributing to the standard documentation and developing additional
61 documents using the same tools as the standard documents. This
62 guide will be less useful for authors using the Python documentation
63 tools for topics other than Python, and less useful still for
64 authors not using the tools at all.
Fred Drakeacffaee1999-03-16 16:09:13 +000065
Fred Drake2c4e0091999-03-29 14:55:55 +000066 The material in this guide is intended to assist authors using the
67 Python documentation tools. It includes information on the source
68 distribution of the standard documentation, a discussion of the
Fred Drake7a737df1999-04-23 14:41:44 +000069 document types, reference material on the markup defined in the
70 document classes, a list of the external tools needed for processing
Fred Drake2c4e0091999-03-29 14:55:55 +000071 documents, and reference material on the tools provided with the
72 documentation resources. At the end, there is also a section
Fred Drake7a737df1999-04-23 14:41:44 +000073 discussing future directions for the Python documentation and where
74 to turn for more information.
Fred Drakeacffaee1999-03-16 16:09:13 +000075
Fred Drakef1b3de82001-07-24 14:38:34 +000076\section{Directory Structure \label{directories}}
Fred Drakeacffaee1999-03-16 16:09:13 +000077
78 The source distribution for the standard Python documentation
79 contains a large number of directories. While third-party documents
80 do not need to be placed into this structure or need to be placed
81 within a similar structure, it can be helpful to know where to look
82 for examples and tools when developing new documents using the
83 Python documentation tools. This section describes this directory
84 structure.
85
86 The documentation sources are usually placed within the Python
Fred Drake7a737df1999-04-23 14:41:44 +000087 source distribution as the top-level directory \file{Doc/}, but
88 are not dependent on the Python source distribution in any way.
Fred Drakeacffaee1999-03-16 16:09:13 +000089
90 The \file{Doc/} directory contains a few files and several
91 subdirectories. The files are mostly self-explanatory, including a
92 \file{README} and a \file{Makefile}. The directories fall into
93 three categories:
94
95 \begin{definitions}
96 \term{Document Sources}
97 The \LaTeX{} sources for each document are placed in a
Fred Drake02997492000-09-21 05:26:43 +000098 separate directory. These directories are given short
99 names which vaguely indicate the document in each:
Fred Drake2f4bebd1999-04-28 16:43:11 +0000100
101 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Document Title}
Fred Drake31edf4d2000-09-07 20:06:07 +0000102 \lineii{api/}
103 {\citetitle[../api/api.html]{The Python/C API}}
104 \lineii{dist/}
105 {\citetitle[../dist/dist.html]{Distributing Python Modules}}
106 \lineii{doc/}
107 {\citetitle[../doc/doc.html]{Documenting Python}}
108 \lineii{ext/}
109 {\citetitle[../ext/ext.html]{Extending and Embedding the Python Interpreter}}
110 \lineii{inst/}
111 {\citetitle[../inst/inst.html]{Installing Python Modules}}
112 \lineii{lib/}
113 {\citetitle[../lib/lib.html]{Python Library Reference}}
114 \lineii{mac/}
115 {\citetitle[../mac/mac.html]{Macintosh Module Reference}}
116 \lineii{ref/}
117 {\citetitle[../ref/ref.html]{Python Reference Manual}}
118 \lineii{tut/}
119 {\citetitle[../tut/tut.html]{Python Tutorial}}
Fred Drake2f4bebd1999-04-28 16:43:11 +0000120 \end{tableii}
Fred Drakeacffaee1999-03-16 16:09:13 +0000121
122 \term{Format-Specific Output}
Fred Drake2c4e0091999-03-29 14:55:55 +0000123 Most output formats have a directory which contains a
Fred Drakeacffaee1999-03-16 16:09:13 +0000124 \file{Makefile} which controls the generation of that format
125 and provides storage for the formatted documents. The only
Fred Drake2c4e0091999-03-29 14:55:55 +0000126 variations within this category are the Portable Document
127 Format (PDF) and PostScript versions are placed in the
Fred Drake7a737df1999-04-23 14:41:44 +0000128 directories \file{paper-a4/} and \file{paper-letter/} (this
129 causes all the temporary files created by \LaTeX{} to be kept
130 in the same place for each paper size, where they can be more
131 easily ignored).
Fred Drakeacffaee1999-03-16 16:09:13 +0000132
Fred Drake2f4bebd1999-04-28 16:43:11 +0000133 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Output Formats}
134 \lineii{html/}{HTML output}
135 \lineii{info/}{GNU info output}
Fred Draked6bdb072002-01-17 12:35:20 +0000136 \lineii{isilo/}{\ulink{iSilo}{http://www.isilo.com/}
137 documents (for Palm OS devices)}
Fred Drake2f4bebd1999-04-28 16:43:11 +0000138 \lineii{paper-a4/}{PDF and PostScript, A4 paper}
139 \lineii{paper-letter/}{PDF and PostScript, US-Letter paper}
140 \end{tableii}
141
Fred Drakeacffaee1999-03-16 16:09:13 +0000142 \term{Supplemental Files}
143 Some additional directories are used to store supplemental
144 files used for the various processes. Directories are
145 included for the shared \LaTeX{} document classes, the
146 \LaTeX2HTML support, template files for various document
147 components, and the scripts used to perform various steps in
148 the formatting processes.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000149
150 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Contents}
151 \lineii{perl/}{Support for \LaTeX2HTML processing}
152 \lineii{templates/}{Example files for source documents}
153 \lineii{texinputs/}{Style implementation for \LaTeX}
154 \lineii{tools/}{Custom processing scripts}
155 \end{tableii}
156
Fred Drakeacffaee1999-03-16 16:09:13 +0000157 \end{definitions}
158
Fred Drake2c4e0091999-03-29 14:55:55 +0000159
Fred Drakef1b3de82001-07-24 14:38:34 +0000160\section{Style Guide \label{style-guide}}
Fred Drake432cef02001-07-06 22:34:33 +0000161
162 The Python documentation should follow the \citetitle
163 [http://developer.apple.com/techpubs/macos8/pdf/apple_styleguide00.pdf]
164 {Apple Publications Style Guide} wherever possible. This particular
165 style guide was selected mostly because it seems reasonable and is
166 easy to get online. (Printed copies are available; see the Apple's
167 \citetitle[http://developer.apple.com/techpubs/faq.html]{Developer
168 Documentation FAQ} for more information.)
169
170 Topics which are not covered in the Apple's style guide will be
171 discussed in this document if necessary.
172
173 Many special names are used in the Python documentation, including
174 the names of operating systems, programming languages, standards
175 bodies, and the like. Many of these were assigned \LaTeX{} macros
176 at some point in the distant past, and these macros lived on long
Fred Drake9120df32001-07-14 02:34:12 +0000177 past their usefulness. In the current markup, most of these entities
178 are not assigned any special markup, but the preferred spellings are
Fred Drake432cef02001-07-06 22:34:33 +0000179 given here to aid authors in maintaining the consistency of
180 presentation in the Python documentation.
181
Fred Drake9120df32001-07-14 02:34:12 +0000182 Other terms and words deserve special mention as well; these conventions
183 should be used to ensure consistency throughout the documentation:
184
Fred Drake432cef02001-07-06 22:34:33 +0000185 \begin{description}
Fred Drake9120df32001-07-14 02:34:12 +0000186 \item[CPU]
187 For ``central processing unit.'' Many style guides say this
188 should be spelled out on the first use (and if you must use it,
189 do so!). For the Python documentation, this abbreviation should
190 be avoided since there's no reasonable way to predict which occurance
191 will be the first seen by the reader. It is better to use the
192 word ``processor'' instead.
193
194 \item[\POSIX]
Fred Drake432cef02001-07-06 22:34:33 +0000195 The name assigned to a particular group of standards. This is
Fred Drake9120df32001-07-14 02:34:12 +0000196 always uppercase. Use the macro \macro{POSIX} to represent this
197 name.
Fred Drake432cef02001-07-06 22:34:33 +0000198
199 \item[Python]
200 The name of our favorite programming language is always
201 capitalized.
202
203 \item[Unicode]
204 The name of a character set and matching encoding. This is
Fred Drake9120df32001-07-14 02:34:12 +0000205 always written capitalized.
206
207 \item[\UNIX]
208 The name of the operating system developed at AT\&T Bell Labs
209 in the early 1970s. Use the macro \macro{UNIX} to use this name.
Fred Drake432cef02001-07-06 22:34:33 +0000210 \end{description}
211
212
Fred Drakeadade921999-04-22 13:05:27 +0000213\section{\LaTeX{} Primer \label{latex-primer}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000214
Fred Drakeadade921999-04-22 13:05:27 +0000215 This section is a brief introduction to \LaTeX{} concepts and
216 syntax, to provide authors enough information to author documents
217 productively without having to become ``\TeX{}nicians.''
218
Fred Drake5eb992b1999-06-11 14:25:45 +0000219 Perhaps the most important concept to keep in mind while marking up
Fred Drake02997492000-09-21 05:26:43 +0000220 Python documentation is that while \TeX{} is unstructured, \LaTeX{} was
Fred Drake5eb992b1999-06-11 14:25:45 +0000221 designed as a layer on top of \TeX{} which specifically supports
222 structured markup. The Python-specific markup is intended to extend
223 the structure provided by standard \LaTeX{} document classes to
224 support additional information specific to Python.
225
Fred Drakeadade921999-04-22 13:05:27 +0000226 \LaTeX{} documents contain two parts: the preamble and the body.
227 The preamble is used to specify certain metadata about the document
228 itself, such as the title, the list of authors, the date, and the
229 \emph{class} the document belongs to. Additional information used
230 to control index generation and the use of bibliographic databases
Fred Drake7a737df1999-04-23 14:41:44 +0000231 can also be placed in the preamble. For most authors, the preamble
Fred Drakeadade921999-04-22 13:05:27 +0000232 can be most easily created by copying it from an existing document
233 and modifying a few key pieces of information.
234
235 The \dfn{class} of a document is used to place a document within a
236 broad category of documents and set some fundamental formatting
237 properties. For Python documentation, two classes are used: the
238 \code{manual} class and the \code{howto} class. These classes also
239 define the additional markup used to document Python concepts and
240 structures. Specific information about these classes is provided in
Fred Drake7a737df1999-04-23 14:41:44 +0000241 section \ref{classes}, ``Document Classes,'' below. The first thing
Fred Drakeadade921999-04-22 13:05:27 +0000242 in the preamble is the declaration of the document's class.
243
244 After the class declaration, a number of \emph{macros} are used to
245 provide further information about the document and setup any
Fred Drake7a737df1999-04-23 14:41:44 +0000246 additional markup that is needed. No output is generated from the
247 preamble; it is an error to include free text in the preamble
248 because it would cause output.
Fred Drakeadade921999-04-22 13:05:27 +0000249
250 The document body follows the preamble. This contains all the
Fred Drake63568aa2000-10-19 05:36:10 +0000251 printed components of the document marked up structurally. Generic
Fred Drake4c6f17a2001-04-18 05:12:47 +0000252 \LaTeX{} structures include hierarchical sections, numbered and
253 bulleted lists, and special structures for the document abstract and
254 indexes.
Fred Drakeadade921999-04-22 13:05:27 +0000255
Fred Drakef1b3de82001-07-24 14:38:34 +0000256 \subsection{Syntax \label{latex-syntax}}
Fred Drake63568aa2000-10-19 05:36:10 +0000257
Fred Drake4c6f17a2001-04-18 05:12:47 +0000258 There are some things that an author of Python documentation needs
259 to know about \LaTeX{} syntax.
Fred Drake63568aa2000-10-19 05:36:10 +0000260
261 A \dfn{comment} is started by the ``percent'' character
262 (\character{\%}) and continues through the end of the line and all
263 leading whitespace on the following line. This is a little
264 different from any programming language I know of, so an example
265 is in order:
266
267\begin{verbatim}
268This is text.% comment
269 This is more text. % another comment
270Still more text.
271\end{verbatim}
272
273 The first non-comment character following the first comment is the
274 letter \character{T} on the second line; the leading whitespace on
275 that line is consumed as part of the first comment. This means
276 that there is no space between the first and second sentences, so
277 the period and letter \character{T} will be directly adjacent in
278 the typeset document.
279
280 Note also that though the first non-comment character after the
281 second comment is the letter \character{S}, there is whitespace
282 preceding the comment, so the two sentences are separated as
283 expected.
284
285 A \dfn{group} is an enclosure for a collection of text and
286 commands which encloses the formatting context and constrains the
287 scope of any changes to that context made by commands within the
288 group. Groups can be nested hierarchically. The formatting
289 context includes the font and the definition of additional macros
290 (or overrides of macros defined in outer groups). Syntactically,
291 groups are enclosed in braces:
292
293\begin{verbatim}
294{text in a group}
295\end{verbatim}
296
Fred Drake4c6f17a2001-04-18 05:12:47 +0000297 An alternate syntax for a group using brackets, \code{[...]}, is
Fred Drake63568aa2000-10-19 05:36:10 +0000298 used by macros and environment constructors which take optional
299 parameters; brackets do not normally hold syntactic significance.
300 A degenerate group, containing only one atomic bit of content,
301 does not need to have an explicit group, unless it is required to
302 avoid ambiguity. Since Python tends toward the explicit, groups
303 are also made explicit in the documentation markup.
304
305 Groups are used only sparingly in the Python documentation, except
306 for their use in marking parameters to macros and environments.
307
Fred Drake4c6f17a2001-04-18 05:12:47 +0000308 A \dfn{macro} is usually a simple construct which is identified by
Fred Drake63568aa2000-10-19 05:36:10 +0000309 name and can take some number of parameters. In normal \LaTeX{}
310 usage, one of these can be optional. The markup is introduced
311 using the backslash character (\character{\e}), and the name is
312 given by alphabetic characters (no digits, hyphens, or
313 underscores). Required parameters should be marked as a group,
314 and optional parameters should be marked using the alternate
315 syntax for a group.
316
317 For example, a macro named ``foo'' which takes a single parameter
318 would appear like this:
319
320\begin{verbatim}
321\name{parameter}
322\end{verbatim}
323
324 A macro which takes an optional parameter would be typed like this
325 when the optional paramter is given:
326
327\begin{verbatim}
328\name[optional]
329\end{verbatim}
330
331 If both optional and required parameters are to be required, it
332 looks like this:
333
334\begin{verbatim}
335\name[optional]{required}
336\end{verbatim}
337
338 A macro name may be followed by a space or newline; a space
339 between the macro name and any parameters will be consumed, but
340 this usage is not practiced in the Python documentation. Such a
Fred Drake4c6f17a2001-04-18 05:12:47 +0000341 space is still consumed if there are no parameters to the macro,
Fred Drake63568aa2000-10-19 05:36:10 +0000342 in which case inserting an empty group (\code{\{\}}) or explicit
343 word space (\samp{\e\ }) immediately after the macro name helps to
344 avoid running the expansion of the macro into the following text.
345 Macros which take no parameters but which should not be followed
346 by a word space do not need special treatment if the following
347 character in the document source if not a name character (such as
Fred Drake4c6f17a2001-04-18 05:12:47 +0000348 punctuation).
Fred Drake63568aa2000-10-19 05:36:10 +0000349
350 Each line of this example shows an appropriate way to write text
351 which includes a macro which takes no parameters:
352
353\begin{verbatim}
354This \UNIX{} is followed by a space.
355This \UNIX\ is also followed by a space.
356\UNIX, followed by a comma, needs no additional markup.
357\end{verbatim}
358
Fred Draked097d482000-10-20 20:51:31 +0000359 An \dfn{environment} is a larger construct than a macro, and can
Fred Drake4c6f17a2001-04-18 05:12:47 +0000360 be used for things with more content than would conveniently fit
Fred Draked097d482000-10-20 20:51:31 +0000361 in a macro parameter. They are primarily used when formatting
362 parameters need to be changed before and after a large chunk of
363 content, but the content itself needs to be highly flexible. Code
364 samples are presented using an environment, and descriptions of
Fred Drake4c6f17a2001-04-18 05:12:47 +0000365 functions, methods, and classes are also marked using environments.
Fred Draked097d482000-10-20 20:51:31 +0000366
367 Since the content of an environment is free-form and can consist
368 of several paragraphs, they are actually marked using a pair of
369 macros: \macro{begin} and \macro{end}. These macros both take the
370 name of the environment as a parameter. An example is the
371 environment used to mark the abstract of a document:
372
373\begin{verbatim}
374\begin{abstract}
375 This is the text of the abstract. It concisely explains what
376 information is found in the document.
377
378 It can consist of multiple paragraphs.
379\end{abstract}
380\end{verbatim}
381
382 An environment can also have required and optional parameters of
383 its own. These follow the parameter of the \macro{begin} macro.
384 This example shows an environment which takes a single required
385 parameter:
386
387\begin{verbatim}
Fred Drake2bbc6972001-03-28 16:51:20 +0000388\begin{datadesc}{controlnames}
Fred Draked097d482000-10-20 20:51:31 +0000389 A 33-element string array that contains the \ASCII{} mnemonics for
390 the thirty-two \ASCII{} control characters from 0 (NUL) to 0x1f
391 (US), in order, plus the mnemonic \samp{SP} for the space character.
392\end{datadesc}
393\end{verbatim}
Fred Drake63568aa2000-10-19 05:36:10 +0000394
Fred Drake4c6f17a2001-04-18 05:12:47 +0000395 There are a number of less-used marks in \LaTeX{} which are used
Fred Drakee789ea12002-03-13 02:48:24 +0000396 to enter characters which are not found in \ASCII{} or which a
397 considered special, or \emph{active} in \TeX{} or \LaTeX. Given
398 that these are often used adjacent to other characters, the markup
399 required to produce the proper character may need to be followed
400 by a space or an empty group, or the markup can be enclosed in a
401 group. Some which are found in Python documentation are:
Fred Drake63568aa2000-10-19 05:36:10 +0000402
Fred Draked097d482000-10-20 20:51:31 +0000403\begin{tableii}{c|l}{textrm}{Character}{Markup}
Fred Drakee789ea12002-03-13 02:48:24 +0000404 \lineii{\textasciicircum}{\code{\e textasciicircum}}
405 \lineii{\textasciitilde}{\code{\e textasciitilde}}
406 \lineii{\textgreater}{\code{\e textgreater}}
407 \lineii{\textless}{\code{\e textless}}
Fred Draked097d482000-10-20 20:51:31 +0000408 \lineii{\c c}{\code{\e c c}}
409 \lineii{\"o}{\code{\e"o}}
410 \lineii{\o}{\code{\e o}}
411\end{tableii}
Fred Drake63568aa2000-10-19 05:36:10 +0000412
413
Skip Montanaro176bda4cd2002-04-19 04:50:44 +0000414 \subsection{Hierarchical Structure \label{latex-structure}}
Fred Drake63568aa2000-10-19 05:36:10 +0000415
Fred Draked097d482000-10-20 20:51:31 +0000416 \LaTeX{} expects documents to be arranged in a conventional,
417 hierarchical way, with chapters, sections, sub-sections,
418 appendixes, and the like. These are marked using macros rather
419 than environments, probably because the end of a section can be
420 safely inferred when a section of equal or higher level starts.
421
422 There are six ``levels'' of sectioning in the document classes
Fred Drake4c6f17a2001-04-18 05:12:47 +0000423 used for Python documentation, and the deepest two
424 levels\footnote{The deepest levels have the highest numbers in the
425 table.} are not used. The levels are:
Fred Draked097d482000-10-20 20:51:31 +0000426
427 \begin{tableiii}{c|l|c}{textrm}{Level}{Macro Name}{Notes}
428 \lineiii{1}{\macro{chapter}}{(1)}
429 \lineiii{2}{\macro{section}}{}
430 \lineiii{3}{\macro{subsection}}{}
Fred Drakeb7a52c92000-11-27 20:10:18 +0000431 \lineiii{4}{\macro{subsubsection}}{}
Fred Draked097d482000-10-20 20:51:31 +0000432 \lineiii{5}{\macro{paragraph}}{(2)}
433 \lineiii{6}{\macro{subparagraph}}{}
434 \end{tableiii}
435
436 \noindent
437 Notes:
438
439 \begin{description}
440 \item[(1)]
441 Only used for the \code{manual} documents, as described in
442 section \ref{classes}, ``Document Classes.''
443 \item[(2)]
444 Not the same as a paragraph of text; nobody seems to use this.
445 \end{description}
Fred Drake2c4e0091999-03-29 14:55:55 +0000446
447
Fred Drakeadade921999-04-22 13:05:27 +0000448\section{Document Classes \label{classes}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000449
450 Two \LaTeX{} document classes are defined specifically for use with
451 the Python documentation. The \code{manual} class is for large
452 documents which are sectioned into chapters, and the \code{howto}
453 class is for smaller documents.
454
455 The \code{manual} documents are larger and are used for most of the
456 standard documents. This document class is based on the standard
457 \LaTeX{} \code{report} class and is formatted very much like a long
Fred Drake698d5201999-11-10 15:54:57 +0000458 technical report. The \citetitle[../ref/ref.html]{Python Reference
459 Manual} is a good example of a \code{manual} document, and the
460 \citetitle[../lib/lib.html]{Python Library Reference} is a large
461 example.
Fred Drakeacffaee1999-03-16 16:09:13 +0000462
463 The \code{howto} documents are shorter, and don't have the large
464 structure of the \code{manual} documents. This class is based on
465 the standard \LaTeX{} \code{article} class and is formatted somewhat
466 like the Linux Documentation Project's ``HOWTO'' series as done
467 originally using the LinuxDoc software. The original intent for the
468 document class was that it serve a similar role as the LDP's HOWTO
469 series, but the applicability of the class turns out to be somewhat
Fred Drake02997492000-09-21 05:26:43 +0000470 broader. This class is used for ``how-to'' documents (this
Fred Drakeacffaee1999-03-16 16:09:13 +0000471 document is an example) and for shorter reference manuals for small,
472 fairly cohesive module libraries. Examples of the later use include
Fred Drake6a547c72000-09-15 22:11:24 +0000473\citetitle[http://starship.python.net/crew/fdrake/manuals/krb5py/krb5py.html]{Using
Fred Drakeacffaee1999-03-16 16:09:13 +0000474 Kerberos from Python}, which contains reference material for an
475 extension package. These documents are roughly equivalent to a
476 single chapter from a larger work.
477
478
Fred Drakef1b3de82001-07-24 14:38:34 +0000479\section{Special Markup Constructs \label{special-constructs}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000480
Fred Drake2c4e0091999-03-29 14:55:55 +0000481 The Python document classes define a lot of new environments and
482 macros. This section contains the reference material for these
483 facilities.
484
Fred Drakeaf2b7142000-09-14 20:11:05 +0000485 \subsection{Markup for the Preamble \label{preamble-info}}
486
487 \begin{macrodesc}{release}{\p{ver}}
488 Set the version number for the software described in the
489 document.
490 \end{macrodesc}
491
492 \begin{macrodesc}{setshortversion}{\p{sver}}
493 Specify the ``short'' version number of the documented software
494 to be \var{sver}.
495 \end{macrodesc}
496
Fred Drakee15956b2000-04-03 04:51:13 +0000497 \subsection{Meta-information Markup \label{meta-info}}
498
499 \begin{macrodesc}{sectionauthor}{\p{author}\p{email}}
500 Identifies the author of the current section. \var{author}
501 should be the author's name such that it can be used for
502 presentation (though it isn't), and \var{email} should be the
503 author's email address. The domain name portion of
504 the address should be lower case.
505
506 No presentation is generated from this markup, but it is used to
507 help keep track of contributions.
508 \end{macrodesc}
509
Fred Drakeacffaee1999-03-16 16:09:13 +0000510 \subsection{Information Units \label{info-units}}
511
Fred Drake2f4bebd1999-04-28 16:43:11 +0000512 XXX Explain terminology, or come up with something more ``lay.''
Fred Drakeacffaee1999-03-16 16:09:13 +0000513
Fred Drakeadade921999-04-22 13:05:27 +0000514 There are a number of environments used to describe specific
515 features provided by modules. Each environment requires
516 parameters needed to provide basic information about what is being
517 described, and the environment content should be the description.
518 Most of these environments make entries in the general index (if
519 one is being produced for the document); if no index entry is
520 desired, non-indexing variants are available for many of these
521 environments. The environments have names of the form
522 \code{\var{feature}desc}, and the non-indexing variants are named
523 \code{\var{feature}descni}. The available variants are explicitly
524 included in the list below.
525
526 For each of these environments, the first parameter, \var{name},
527 provides the name by which the feature is accessed.
528
529 Environments which describe features of objects within a module,
530 such as object methods or data attributes, allow an optional
531 \var{type name} parameter. When the feature is an attribute of
532 class instances, \var{type name} only needs to be given if the
533 class was not the most recently described class in the module; the
534 \var{name} value from the most recent \env{classdesc} is implied.
535 For features of built-in or extension types, the \var{type name}
Fred Drake7a737df1999-04-23 14:41:44 +0000536 value should always be provided. Another special case includes
537 methods and members of general ``protocols,'' such as the
538 formatter and writer protocols described for the
539 \module{formatter} module: these may be documented without any
540 specific implementation classes, and will always require the
541 \var{type name} parameter to be provided.
Fred Drakeadade921999-04-22 13:05:27 +0000542
Fred Drake7be440d2000-09-16 21:23:25 +0000543 \begin{envdesc}{cfuncdesc}{\p{type}\p{name}\p{args}}
544 Environment used to described a C function. The \var{type}
545 should be specified as a \keyword{typedef} name, \code{struct
546 \var{tag}}, or the name of a primitive type. If it is a pointer
Fred Drake02997492000-09-21 05:26:43 +0000547 type, the trailing asterisk should not be preceded by a space.
Fred Drake7be440d2000-09-16 21:23:25 +0000548 \var{name} should be the name of the function (or function-like
549 pre-processor macro), and \var{args} should give the types and
550 names of the parameters. The names need to be given so they may
551 be used in the description.
552 \end{envdesc}
553
Fred Drake1251b0e2002-04-15 20:10:23 +0000554 \begin{envdesc}{cmemberdesc}{\p{container}\p{type}\p{name}}
555 Description for a structure member. \var{container} should be
556 the \keyword{typedef} name, if there is one, otherwise if should
557 be \samp{struct \var{tag}}. The type of the member should given
558 as \var{type}, and the name should be given as \var{name}. The
559 text of the description should include the range of values
560 allowed, how the value should be interpreted, and whether the
561 value can be changed. References to structure members in text
562 should use the \macro{member} macro.
563 \end{envdesc}
564
Fred Drake79bf99c2002-04-09 20:17:42 +0000565 \begin{envdesc}{csimplemacrodesc}{\p{name}}
566 Documentation for a ``simple'' macro. Simple macros are macros
567 which are used for code expansion, but which do not take
568 arguments so cannot be described as functions. This is not to
569 be used for simple constant definitions. Examples of it's use
570 in the Python documentation include
571 \csimplemacro{PyObject_HEAD} and
572 \csimplemacro{Py_BEGIN_ALLOW_THREADS}.
573 \end{envdesc}
574
Fred Drake7be440d2000-09-16 21:23:25 +0000575 \begin{envdesc}{ctypedesc}{\op{tag}\p{name}}
576 Environment used to described a C type. The \var{name}
577 parameter should be the \keyword{typedef} name. If the type is
578 defined as a \keyword{struct} without a \keyword{typedef},
579 \var{name} should have the form \code{struct \var{tag}}.
580 \var{name} will be added to the index unless \var{tag} is
581 provided, in which case \var{tag} will be used instead.
582 \var{tag} should not be used for a \keyword{typedef} name.
583 \end{envdesc}
584
585 \begin{envdesc}{cvardesc}{\p{type}\p{name}}
586 Description of a global C variable. \var{type} should be the
587 \keyword{typedef} name, \code{struct \var{tag}}, or the name of
588 a primitive type. If variable has a pointer type, the trailing
Fred Drake02997492000-09-21 05:26:43 +0000589 asterisk should \emph{not} be preceded by a space.
Fred Drake7be440d2000-09-16 21:23:25 +0000590 \end{envdesc}
591
Fred Drakeadade921999-04-22 13:05:27 +0000592 \begin{envdesc}{datadesc}{\p{name}}
593 This environment is used to document global data in a module,
594 including both variables and values used as ``defined
595 constants.'' Class and object attributes are not documented
596 using this environment.
Fred Drakeacffaee1999-03-16 16:09:13 +0000597 \end{envdesc}
Fred Drake7a737df1999-04-23 14:41:44 +0000598 \begin{envdesc}{datadescni}{\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000599 Like \env{datadesc}, but without creating any index entries.
600 \end{envdesc}
601
Fred Drake9f2376d2001-05-11 01:01:12 +0000602 \begin{envdesc}{excclassdesc}{\p{name}\p{constructor parameters}}
603 Descibe an exception defined by a class. \var{constructor
604 parameters} should not include the \var{self} parameter or
605 the parentheses used in the call syntax. To describe an
606 exception class without describing the parameters to its
607 constructor, use the \env{excdesc} environment.
608 \end{envdesc}
609
Fred Drakeadade921999-04-22 13:05:27 +0000610 \begin{envdesc}{excdesc}{\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000611 Describe an exception. This may be either a string exception or
Fred Drake9f2376d2001-05-11 01:01:12 +0000612 a class exception. In the case of class exceptions, the
613 constructor parameters are not described; use \env{excclassdesc}
614 to describe an exception class and its constructor.
Fred Drakeacffaee1999-03-16 16:09:13 +0000615 \end{envdesc}
616
Fred Drakeadade921999-04-22 13:05:27 +0000617 \begin{envdesc}{funcdesc}{\p{name}\p{parameters}}
618 Describe a module-level function. \var{parameters} should
619 not include the parentheses used in the call syntax. Object
620 methods are not documented using this environment. Bound object
621 methods placed in the module namespace as part of the public
622 interface of the module are documented using this, as they are
623 equivalent to normal functions for most purposes.
624
625 The description should include information about the parameters
626 required and how they are used (especially whether mutable
627 objects passed as parameters are modified), side effects, and
628 possible exceptions. A small example may be provided.
Fred Drakeacffaee1999-03-16 16:09:13 +0000629 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000630 \begin{envdesc}{funcdescni}{\p{name}\p{parameters}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000631 Like \env{funcdesc}, but without creating any index entries.
632 \end{envdesc}
633
Fred Drakeadade921999-04-22 13:05:27 +0000634 \begin{envdesc}{classdesc}{\p{name}\p{constructor parameters}}
635 Describe a class and its constructor. \var{constructor
636 parameters} should not include the \var{self} parameter or
637 the parentheses used in the call syntax.
Fred Drakeacffaee1999-03-16 16:09:13 +0000638 \end{envdesc}
639
Fred Drake9f2376d2001-05-11 01:01:12 +0000640 \begin{envdesc}{classdesc*}{\p{name}}
641 Describe a class without describing the constructor. This can
642 be used to describe classes that are merely containers for
643 attributes or which should never be instantiated or subclassed
644 by user code.
645 \end{envdesc}
646
Fred Drakeadade921999-04-22 13:05:27 +0000647 \begin{envdesc}{memberdesc}{\op{type name}\p{name}}
648 Describe an object data attribute. The description should
649 include information about the type of the data to be expected
650 and whether it may be changed directly.
Fred Drakeacffaee1999-03-16 16:09:13 +0000651 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000652 \begin{envdesc}{memberdescni}{\op{type name}\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000653 Like \env{memberdesc}, but without creating any index entries.
654 \end{envdesc}
655
Fred Drakeadade921999-04-22 13:05:27 +0000656 \begin{envdesc}{methoddesc}{\op{type name}\p{name}\p{parameters}}
657 Describe an object method. \var{parameters} should not include
658 the \var{self} parameter or the parentheses used in the call
659 syntax. The description should include similar information to
660 that described for \env{funcdesc}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000661 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000662 \begin{envdesc}{methoddescni}{\op{type name}\p{name}\p{parameters}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000663 Like \env{methoddesc}, but without creating any index entries.
664 \end{envdesc}
665
666
Fred Drakef1b3de82001-07-24 14:38:34 +0000667 \subsection{Showing Code Examples \label{showing-examples}}
Fred Drake5eb992b1999-06-11 14:25:45 +0000668
669 Examples of Python source code or interactive sessions are
670 represented as \env{verbatim} environments. This environment
671 is a standard part of \LaTeX{}. It is important to only use
672 spaces for indentation in code examples since \TeX{} drops tabs
673 instead of converting them to spaces.
674
675 Representing an interactive session requires including the prompts
676 and output along with the Python code. No special markup is
Fred Drake63568aa2000-10-19 05:36:10 +0000677 required for interactive sessions. After the last line of input
678 or output presented, there should not be an ``unused'' primary
679 prompt; this is an example of what \emph{not} to do:
680
681\begin{verbatim}
682>>> 1 + 1
6832
684>>>
685\end{verbatim}
Fred Drake5eb992b1999-06-11 14:25:45 +0000686
687 Within the \env{verbatim} environment, characters special to
688 \LaTeX{} do not need to be specially marked in any way. The entire
689 example will be presented in a monospaced font; no attempt at
690 ``pretty-printing'' is made, as the environment must work for
Fred Drake63568aa2000-10-19 05:36:10 +0000691 non-Python code and non-code displays. There should be no blank
692 lines at the top or bottom of any \env{verbatim} display.
Fred Drake5eb992b1999-06-11 14:25:45 +0000693
Fred Drake66eed242001-06-18 14:59:58 +0000694 Longer displays of verbatim text may be included by storing the
695 example text in an external file containing only plain text. The
696 file may be included using the standard \macro{verbatiminput}
697 macro; this macro takes a single argument naming the file
698 containing the text. For example, to include the Python source
699 file \file{example.py}, use:
700
701\begin{verbatim}
702\verbatiminput{example.py}
703\end{verbatim}
704
705 Use of \macro{verbatiminput} allows easier use of special editing
706 modes for the included file. The file should be placed in the
707 same directory as the \LaTeX{} files for the document.
708
Fred Drake5eb992b1999-06-11 14:25:45 +0000709 The Python Documentation Special Interest Group has discussed a
710 number of approaches to creating pretty-printed code displays and
711 interactive sessions; see the Doc-SIG area on the Python Web site
712 for more information on this topic.
713
714
Fred Drakef1b3de82001-07-24 14:38:34 +0000715 \subsection{Inline Markup \label{inline-markup}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000716
Fred Drake87f768e1999-05-17 15:22:45 +0000717 The macros described in this section are used to mark just about
718 anything interesting in the document text. They may be used in
719 headings (though anything involving hyperlinks should be avoided
720 there) as well as in the body text.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000721
722 \begin{macrodesc}{bfcode}{\p{text}}
723 Like \macro{code}, but also makes the font bold-face.
724 \end{macrodesc}
725
726 \begin{macrodesc}{cdata}{\p{name}}
727 The name of a C-language variable.
728 \end{macrodesc}
729
730 \begin{macrodesc}{cfunction}{\p{name}}
731 The name of a C-language function. \var{name} should include the
732 function name and the trailing parentheses.
733 \end{macrodesc}
734
735 \begin{macrodesc}{character}{\p{char}}
736 A character when discussing the character rather than a one-byte
737 string value. The character will be typeset as with \macro{samp}.
738 \end{macrodesc}
739
Fred Drake29a710f1999-11-10 22:51:18 +0000740 \begin{macrodesc}{citetitle}{\op{url}\p{title}}
741 A title for a referenced publication. If \var{url} is specified,
742 the title will be made into a hyperlink when formatted as HTML.
743 \end{macrodesc}
744
Fred Drake2f4bebd1999-04-28 16:43:11 +0000745 \begin{macrodesc}{class}{\p{name}}
746 A class name; a dotted name may be used.
747 \end{macrodesc}
748
749 \begin{macrodesc}{code}{\p{text}}
750 A short code fragment or literal constant value. Typically, it
751 should not include any spaces since no quotation marks are
752 added.
753 \end{macrodesc}
754
755 \begin{macrodesc}{constant}{\p{name}}
756 The name of a ``defined'' constant. This may be a C-language
757 \code{\#define} or a Python variable that is not intended to be
758 changed.
759 \end{macrodesc}
760
Fred Drake79bf99c2002-04-09 20:17:42 +0000761 \begin{macrodesc}{csimplemacro}{\p{name}}
762 The name of a ``simple'' macro. Simple macros are macros
763 which are used for code expansion, but which do not take
764 arguments so cannot be described as functions. This is not to
765 be used for simple constant definitions. Examples of it's use
766 in the Python documentation include
767 \csimplemacro{PyObject_HEAD} and
768 \csimplemacro{Py_BEGIN_ALLOW_THREADS}.
769 \end{macrodesc}
770
Fred Drake2f4bebd1999-04-28 16:43:11 +0000771 \begin{macrodesc}{ctype}{\p{name}}
772 The name of a C \keyword{typedef} or structure. For structures
773 defined without a \keyword{typedef}, use \code{\e ctype\{struct
774 struct_tag\}} to make it clear that the \keyword{struct} is
775 required.
776 \end{macrodesc}
777
778 \begin{macrodesc}{deprecated}{\p{version}\p{what to do}}
779 Declare whatever is being described as being deprecated starting
780 with release \var{version}. The text given as \var{what to do}
781 should recommend something to use instead.
782 \end{macrodesc}
783
784 \begin{macrodesc}{dfn}{\p{term}}
785 Mark the defining instance of \var{term} in the text. (No index
786 entries are generated.)
787 \end{macrodesc}
788
Fred Draked1fb7791999-05-17 16:33:54 +0000789 \begin{macrodesc}{e}{}
790 Produces a backslash. This is convenient in \macro{code} and
Fred Drake31edf4d2000-09-07 20:06:07 +0000791 similar macros, and is only defined there. To create a
Fred Drake2b853412000-04-11 19:08:30 +0000792 backslash in ordinary text (such as the contents of the
793 \macro{file} macro), use the standard \macro{textbackslash} macro.
Fred Draked1fb7791999-05-17 16:33:54 +0000794 \end{macrodesc}
795
Fred Drake2f4bebd1999-04-28 16:43:11 +0000796 \begin{macrodesc}{email}{\p{address}}
797 An email address. Note that this is \emph{not} hyperlinked in
Fred Drakee15956b2000-04-03 04:51:13 +0000798 any of the possible output formats. The domain name portion of
799 the address should be lower case.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000800 \end{macrodesc}
801
802 \begin{macrodesc}{emph}{\p{text}}
803 Emphasized text; this will be presented in an italic font.
804 \end{macrodesc}
805
806 \begin{macrodesc}{envvar}{\p{name}}
807 An environment variable. Index entries are generated.
808 \end{macrodesc}
809
810 \begin{macrodesc}{exception}{\p{name}}
811 The name of an exception. A dotted name may be used.
812 \end{macrodesc}
813
814 \begin{macrodesc}{file}{\p{file or dir}}
815 The name of a file or directory. In the PDF and PostScript
816 outputs, single quotes and a font change are used to indicate
817 the file name, but no quotes are used in the HTML output.
Fred Drake64a5aaf2001-10-20 04:18:14 +0000818 \warning{The \macro{file} macro cannot be used in the
819 content of a section title due to processing limitations.}
Fred Drake2f4bebd1999-04-28 16:43:11 +0000820 \end{macrodesc}
821
822 \begin{macrodesc}{filenq}{\p{file or dir}}
823 Like \macro{file}, but single quotes are never used. This can
824 be used in conjunction with tables if a column will only contain
825 file or directory names.
Fred Drake64a5aaf2001-10-20 04:18:14 +0000826 \warning{The \macro{filenq} macro cannot be used in the
827 content of a section title due to processing limitations.}
Fred Drake2f4bebd1999-04-28 16:43:11 +0000828 \end{macrodesc}
829
830 \begin{macrodesc}{function}{\p{name}}
831 The name of a Python function; dotted names may be used.
832 \end{macrodesc}
833
Fred Drake432cef02001-07-06 22:34:33 +0000834 \begin{macrodesc}{infinity}{}
835 The symbol for mathematical infinity: \infinity. Some Web
836 browsers are not able to render the HTML representation of this
837 symbol properly, but support is growing.
838 \end{macrodesc}
839
Fred Drake2f4bebd1999-04-28 16:43:11 +0000840 \begin{macrodesc}{kbd}{\p{key sequence}}
841 Mark a sequence of keystrokes. What form \var{key sequence}
842 takes may depend on platform- or application-specific
Fred Drake07178d22001-07-12 02:08:29 +0000843 conventions. When there are no relevant conventions, the names
844 of modifier keys should be spelled out, to improve accessibility
845 for new users and non-native speakers. For example, an
846 \program{xemacs} key sequence may be marked like
847 \code{\e kbd\{C-x C-f\}}, but without reference to a specific
848 application or platform, the same sequence should be marked as
849 \code{\e kbd\{Control-x Control-f\}}.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000850 \end{macrodesc}
851
852 \begin{macrodesc}{keyword}{\p{name}}
853 The name of a keyword in a programming language.
854 \end{macrodesc}
855
Fred Drake8b3a7b52001-09-26 17:01:58 +0000856 \begin{macrodesc}{mailheader}{\p{name}}
857 The name of an \rfc{822}-style mail header. This markup does
858 not imply that the header is being used in an email message, but
859 can be used to refer to any header of the same ``style.'' This
860 is also used for headers defined by the various MIME
861 specifications. The header name should be entered in the same
862 way it would normally be found in practice, with the
863 camel-casing conventions being preferred where there is more
Fred Drake203d91a2001-09-26 18:43:20 +0000864 than one common usage. The colon which follows the name of the
865 header should not be included.
866 For example: \code{\e mailheader\{Content-Type\}}.
Fred Drake8b3a7b52001-09-26 17:01:58 +0000867 \end{macrodesc}
868
Fred Drake2f4bebd1999-04-28 16:43:11 +0000869 \begin{macrodesc}{makevar}{\p{name}}
870 The name of a \program{make} variable.
871 \end{macrodesc}
872
873 \begin{macrodesc}{manpage}{\p{name}\p{section}}
874 A reference to a \UNIX{} manual page.
875 \end{macrodesc}
876
877 \begin{macrodesc}{member}{\p{name}}
878 The name of a data attribute of an object.
879 \end{macrodesc}
880
881 \begin{macrodesc}{method}{\p{name}}
882 The name of a method of an object. \var{name} should include the
883 method name and the trailing parentheses. A dotted name may be
884 used.
885 \end{macrodesc}
886
887 \begin{macrodesc}{mimetype}{\p{name}}
Fred Drake8b3a7b52001-09-26 17:01:58 +0000888 The name of a MIME type, or a component of a MIME type (the
889 major or minor portion, taken alone).
Fred Drake2f4bebd1999-04-28 16:43:11 +0000890 \end{macrodesc}
891
892 \begin{macrodesc}{module}{\p{name}}
Fred Drake2b853412000-04-11 19:08:30 +0000893 The name of a module; a dotted name may be used. This should
894 also be used for package names.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000895 \end{macrodesc}
896
897 \begin{macrodesc}{newsgroup}{\p{name}}
Fred Drake9120df32001-07-14 02:34:12 +0000898 The name of a Usenet newsgroup.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000899 \end{macrodesc}
900
Fred Drake92350b32001-10-09 18:01:23 +0000901 \begin{macrodesc}{note}{\p{text}}
902 An especially important bit of information about an API that a
903 user should be aware of when using whatever bit of API the
904 note pertains to. This should be the last thing in the
905 paragraph as the end of the note is not visually marked in
Fred Drake64a5aaf2001-10-20 04:18:14 +0000906 any way. The content of \var{text} should be written in
907 complete sentences and include all appropriate punctuation.
Fred Drake92350b32001-10-09 18:01:23 +0000908 \end{macrodesc}
909
Fred Drake432cef02001-07-06 22:34:33 +0000910 \begin{macrodesc}{pep}{\p{number}}
911 A reference to a Python Enhancement Proposal. This generates
912 appropriate index entries. The text \samp{PEP \var{number}} is
913 generated; in the HTML output, this text is a hyperlink to an
914 online copy of the specified PEP.
915 \end{macrodesc}
916
917 \begin{macrodesc}{plusminus}{}
918 The symbol for indicating a value that may take a positive or
919 negative value of a specified magnitude, typically represented
920 by a plus sign placed over a minus sign. For example:
Fred Drake203d91a2001-09-26 18:43:20 +0000921 \code{\e plusminus 3\%{}}.
Fred Drake432cef02001-07-06 22:34:33 +0000922 \end{macrodesc}
923
Fred Drake2f4bebd1999-04-28 16:43:11 +0000924 \begin{macrodesc}{program}{\p{name}}
925 The name of an executable program. This may differ from the
926 file name for the executable for some platforms. In particular,
927 the \file{.exe} (or other) extension should be omitted for DOS
928 and Windows programs.
929 \end{macrodesc}
930
Fred Drake29a710f1999-11-10 22:51:18 +0000931 \begin{macrodesc}{programopt}{\p{option}}
Fred Drakece444982000-04-11 18:52:52 +0000932 A command-line option to an executable program. Use this only
933 for ``shot'' options, and include the leading hyphen.
934 \end{macrodesc}
935
936 \begin{macrodesc}{longprogramopt}{\p{option}}
937 A long command-line option to an executable program. This
938 should only be used for long option names which will be prefixed
939 by two hyphens; the hyphens should not be provided as part of
940 \var{option}.
Fred Drake29a710f1999-11-10 22:51:18 +0000941 \end{macrodesc}
942
Fred Drake2f4bebd1999-04-28 16:43:11 +0000943 \begin{macrodesc}{refmodule}{\op{key}\p{name}}
944 Like \macro{module}, but create a hyperlink to the documentation
945 for the named module. Note that the corresponding
946 \macro{declaremodule} must be in the same document. If the
947 \macro{declaremodule} defines a module key different from the
948 module name, it must also be provided as \var{key} to the
949 \macro{refmodule} macro.
950 \end{macrodesc}
951
952 \begin{macrodesc}{regexp}{\p{string}}
953 Mark a regular expression.
954 \end{macrodesc}
955
956 \begin{macrodesc}{rfc}{\p{number}}
957 A reference to an Internet Request for Comments. This generates
958 appropriate index entries. The text \samp{RFC \var{number}} is
959 generated; in the HTML output, this text is a hyperlink to an
960 online copy of the specified RFC.
961 \end{macrodesc}
962
963 \begin{macrodesc}{samp}{\p{text}}
964 A short code sample, but possibly longer than would be given
965 using \macro{code}. Since quotation marks are added, spaces are
966 acceptable.
967 \end{macrodesc}
968
Fred Drakeaf2b7142000-09-14 20:11:05 +0000969 \begin{macrodesc}{shortversion}{}
970 The ``short'' version number of the documented software, as
971 specified using the \macro{setshortversion} macro in the
972 preamble. For Python, the short version number for a release is
973 the first three characters of the \code{sys.version} value. For
974 example, versions 2.0b1 and 2.0.1 both have a short version of
975 2.0. This may not apply for all packages; if
976 \macro{setshortversion} is not used, this produces an empty
977 expansion. See also the \macro{version} macro.
978 \end{macrodesc}
979
Fred Drake2f4bebd1999-04-28 16:43:11 +0000980 \begin{macrodesc}{strong}{\p{text}}
981 Strongly emphasized text; this will be presented using a bold
982 font.
983 \end{macrodesc}
984
Fred Drake432cef02001-07-06 22:34:33 +0000985 \begin{macrodesc}{ulink}{\p{text}\p{url}}
986 A hypertext link with a target specified by a URL, but for which
987 the link text should not be the title of the resource. For
988 resources being referenced by name, use the \macro{citetitle}
989 macro. Not all formatted versions support arbitrary hypertext
990 links. Note that many characters are special to \LaTeX{} and
991 this macro does not always do the right thing. In particular,
992 the tilde character (\character{\~}) is mis-handled; encoding it
993 as a hex-sequence does work, use \samp{\%7e} in place of the
994 tilde character.
995 \end{macrodesc}
996
Fred Draked1fb7791999-05-17 16:33:54 +0000997 \begin{macrodesc}{url}{\p{url}}
998 A URL (or URN). The URL will be presented as text. In the HTML
999 and PDF formatted versions, the URL will also be a hyperlink.
Fred Drake432cef02001-07-06 22:34:33 +00001000 This can be used when referring to external resources without
1001 specific titles; references to resources which have titles
1002 should be marked using the \macro{citetitle} macro. See the
1003 comments about special characters in the description of the
1004 \macro{ulink} macro for special considerations.
Fred Draked1fb7791999-05-17 16:33:54 +00001005 \end{macrodesc}
1006
Fred Drake2f4bebd1999-04-28 16:43:11 +00001007 \begin{macrodesc}{var}{\p{name}}
1008 The name of a variable or formal parameter in running text.
1009 \end{macrodesc}
1010
1011 \begin{macrodesc}{version}{}
Fred Drakeaf2b7142000-09-14 20:11:05 +00001012 The version number of the described software, as specified using
1013 \macro{release} in the preamble. See also the
1014 \macro{shortversion} macro.
Fred Drake2f4bebd1999-04-28 16:43:11 +00001015 \end{macrodesc}
Fred Drakeacffaee1999-03-16 16:09:13 +00001016
Fred Drake3151f442001-04-18 05:19:06 +00001017 \begin{macrodesc}{versionadded}{\op{explanation}\p{version}}
Fred Drakec26cc912000-05-02 17:43:44 +00001018 The version of Python which added the described feature to the
Fred Drake3151f442001-04-18 05:19:06 +00001019 library or C API. \var{explanation} should be a \emph{brief}
1020 explanation of the change consisting of a capitalized sentence
1021 fragment; a period will be appended by the formatting process.
1022 This is typically added to the end of the first paragraph of the
1023 description before any availability notes. The location should
1024 be selected so the explanation makes sense and may vary as
1025 needed.
Fred Drakec26cc912000-05-02 17:43:44 +00001026 \end{macrodesc}
1027
1028 \begin{macrodesc}{versionchanged}{\op{explanation}\p{version}}
1029 The version of Python in which the named feature was changed in
1030 some way (new parameters, changed side effects, etc.).
1031 \var{explanation} should be a \emph{brief} explanation of the
Fred Drake63568aa2000-10-19 05:36:10 +00001032 change consisting of a capitalized sentence fragment; a
Fred Drakec26cc912000-05-02 17:43:44 +00001033 period will be appended by the formatting process.
1034 This is typically added to the end of the first paragraph of the
1035 description before any availability notes and after
1036 \macro{versionadded}. The location should be selected so the
1037 explanation makes sense and may vary as needed.
1038 \end{macrodesc}
1039
Fred Drake92350b32001-10-09 18:01:23 +00001040 \begin{macrodesc}{warning}{\p{text}}
1041 An important bit of information about an API that a user should
1042 be very aware of when using whatever bit of API the warning
1043 pertains to. This should be the last thing in the paragraph as
Fred Drake64a5aaf2001-10-20 04:18:14 +00001044 the end of the warning is not visually marked in any way. The
1045 content of \var{text} should be written in complete sentences
1046 and include all appropriate punctuation. This differs from
1047 \macro{note} in that it is recommended over \macro{note} for
1048 information regarding security.
Fred Drake92350b32001-10-09 18:01:23 +00001049 \end{macrodesc}
1050
Fred Drakeacffaee1999-03-16 16:09:13 +00001051
Fred Drake6ca33772001-12-14 22:50:06 +00001052 \subsection{Miscellaneous Text Markup \label{misc-text-markup}}
1053
1054 In addition to the inline markup, some additional ``block'' markup
1055 is defined to make it easier to bring attention to various bits of
1056 text. The markup described here serves this purpose, and is
1057 intended to be used when marking one or more paragraphs or other
1058 block constructs (such as \env{verbatim} environments).
1059
1060 \begin{envdesc}{notice}{\op{type}}
1061 Label some paragraphs as being worthy of additional attention from
1062 the reader. What sort of attention is warrented can be indicated
1063 by specifying the \var{type} of the notice. The only values
1064 defined for \var{type} are \code{note} and \code{warning}; these
1065 are equivalent in intent to the inline markup of the same name.
1066 If \var{type} is omitted, \code{note} is used. Additional values
1067 may be defined in the future.
1068 \end{envdesc}
1069
1070
Fred Drakef1b3de82001-07-24 14:38:34 +00001071 \subsection{Module-specific Markup \label{module-markup}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001072
1073 The markup described in this section is used to provide information
1074 about a module being documented. A typical use of this markup
1075 appears at the top of the section used to document a module. A
1076 typical example might look like this:
1077
1078\begin{verbatim}
1079\section{\module{spam} ---
1080 Access to the SPAM facility}
1081
1082\declaremodule{extension}{spam}
Fred Drake2c4e0091999-03-29 14:55:55 +00001083 \platform{Unix}
Fred Drake9120df32001-07-14 02:34:12 +00001084\modulesynopsis{Access to the SPAM facility of \UNIX.}
Fred Drake2c4e0091999-03-29 14:55:55 +00001085\moduleauthor{Jane Doe}{jane.doe@frobnitz.org}
Fred Drakeacffaee1999-03-16 16:09:13 +00001086\end{verbatim}
1087
Fred Drake7932ed02000-08-11 17:37:33 +00001088 Python packages\index{packages} --- collections of modules that can
1089 be described as a unit --- are documented using the same markup as
1090 modules. The name for a module in a package should be typed in
Fred Drake432cef02001-07-06 22:34:33 +00001091 ``fully qualified'' form (it should include the package name).
Fred Drake7932ed02000-08-11 17:37:33 +00001092 For example, a module ``foo'' in package ``bar'' should be marked as
Fred Drake203d91a2001-09-26 18:43:20 +00001093 \code{\e module\{bar.foo\}}, and the beginning of the reference
Fred Drake7932ed02000-08-11 17:37:33 +00001094 section would appear as:
1095
1096\begin{verbatim}
1097\section{\module{bar.foo} ---
1098 Module from the \module{bar} package}
1099
1100\declaremodule{extension}{bar.foo}
1101\modulesynopsis{Nifty module from the \module{bar} package.}
1102\moduleauthor{Jane Doe}{jane.doe@frobnitz.org}
1103\end{verbatim}
1104
1105 Note that the name of a package is also marked using
1106 \macro{module}.
1107
Fred Drakeadade921999-04-22 13:05:27 +00001108 \begin{macrodesc}{declaremodule}{\op{key}\p{type}\p{name}}
Fred Drake87f768e1999-05-17 15:22:45 +00001109 Requires two parameters: module type (\samp{standard},
1110 \samp{builtin}, \samp{extension}, or \samp{}), and the module
1111 name. An optional parameter should be given as the basis for the
1112 module's ``key'' used for linking to or referencing the section.
1113 The ``key'' should only be given if the module's name contains any
1114 underscores, and should be the name with the underscores stripped.
1115 Note that the \var{type} parameter must be one of the values
1116 listed above or an error will be printed. For modules which are
1117 contained in packages, the fully-qualified name should be given as
1118 \var{name} parameter. This should be the first thing after the
1119 \macro{section} used to introduce the module.
Fred Drakeacffaee1999-03-16 16:09:13 +00001120 \end{macrodesc}
1121
Fred Drakeadade921999-04-22 13:05:27 +00001122 \begin{macrodesc}{platform}{\p{specifier}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001123 Specifies the portability of the module. \var{specifier} is a
1124 comma-separated list of keys that specify what platforms the
1125 module is available on. The keys are short identifiers;
1126 examples that are in use include \samp{IRIX}, \samp{Mac},
1127 \samp{Windows}, and \samp{Unix}. It is important to use a key
Fred Drake7a737df1999-04-23 14:41:44 +00001128 which has already been used when applicable. This is used to
1129 provide annotations in the Module Index and the HTML and GNU info
1130 output.
Fred Drakeacffaee1999-03-16 16:09:13 +00001131 \end{macrodesc}
1132
Fred Drakeadade921999-04-22 13:05:27 +00001133 \begin{macrodesc}{modulesynopsis}{\p{text}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001134 The \var{text} is a short, ``one line'' description of the
1135 module that can be used as part of the chapter introduction.
Fred Drakeadade921999-04-22 13:05:27 +00001136 This is must be placed after \macro{declaremodule}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001137 The synopsis is used in building the contents of the table
1138 inserted as the \macro{localmoduletable}. No text is
1139 produced at the point of the markup.
1140 \end{macrodesc}
1141
Fred Drakeadade921999-04-22 13:05:27 +00001142 \begin{macrodesc}{moduleauthor}{\p{name}\p{email}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001143 This macro is used to encode information about who authored a
1144 module. This is currently not used to generate output, but can be
1145 used to help determine the origin of the module.
1146 \end{macrodesc}
1147
1148
Fred Drakef1b3de82001-07-24 14:38:34 +00001149 \subsection{Library-level Markup \label{library-markup}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001150
1151 This markup is used when describing a selection of modules. For
Fred Drake698d5201999-11-10 15:54:57 +00001152 example, the \citetitle[../mac/mac.html]{Macintosh Library
1153 Modules} document uses this to help provide an overview of the
1154 modules in the collection, and many chapters in the
1155 \citetitle[../lib/lib.html]{Python Library Reference} use it for
Fred Drakeacffaee1999-03-16 16:09:13 +00001156 the same purpose.
1157
1158 \begin{macrodesc}{localmoduletable}{}
Fred Drake2c4e0091999-03-29 14:55:55 +00001159 If a \file{.syn} file exists for the current
Fred Drakeacffaee1999-03-16 16:09:13 +00001160 chapter (or for the entire document in \code{howto} documents), a
1161 \env{synopsistable} is created with the contents loaded from the
1162 \file{.syn} file.
1163 \end{macrodesc}
1164
1165
Fred Drakef1b3de82001-07-24 14:38:34 +00001166 \subsection{Table Markup \label{table-markup}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001167
1168 There are three general-purpose table environments defined which
1169 should be used whenever possible. These environments are defined
1170 to provide tables of specific widths and some convenience for
1171 formatting. These environments are not meant to be general
1172 replacements for the standard \LaTeX{} table environments, but can
1173 be used for an advantage when the documents are processed using
1174 the tools for Python documentation processing. In particular, the
1175 generated HTML looks good! There is also an advantage for the
Fred Drake67f193f2001-07-09 16:04:03 +00001176 eventual conversion of the documentation to XML (see section
Fred Drake2c4e0091999-03-29 14:55:55 +00001177 \ref{futures}, ``Future Directions'').
Fred Drakeacffaee1999-03-16 16:09:13 +00001178
1179 Each environment is named \env{table\var{cols}}, where \var{cols}
1180 is the number of columns in the table specified in lower-case
1181 Roman numerals. Within each of these environments, an additional
1182 macro, \macro{line\var{cols}}, is defined, where \var{cols}
1183 matches the \var{cols} value of the corresponding table
Fred Drake2c4e0091999-03-29 14:55:55 +00001184 environment. These are supported for \var{cols} values of
1185 \code{ii}, \code{iii}, and \code{iv}. These environments are all
Fred Drakeda72b932000-09-21 15:58:02 +00001186 built on top of the \env{tabular} environment. Variants based on
1187 the \env{longtable} environment are also provided.
Fred Drakeacffaee1999-03-16 16:09:13 +00001188
Fred Drake2b853412000-04-11 19:08:30 +00001189 Note that all tables in the standard Python documentation use
1190 vertical lines between columns, and this must be specified in the
1191 markup for each table. A general border around the outside of the
1192 table is not used, but would be the responsibility of the
Fred Drakeda72b932000-09-21 15:58:02 +00001193 processor; the document markup should not include an exterior
1194 border.
1195
1196 The \env{longtable}-based variants of the table environments are
1197 formatted with extra space before and after, so should only be
1198 used on tables which are long enough that splitting over multiple
1199 pages is reasonable; tables with fewer than twenty rows should
1200 never by marked using the long flavors of the table environments.
1201 The header row is repeated across the top of each part of the
1202 table.
Fred Drake2b853412000-04-11 19:08:30 +00001203
Fred Drakeadade921999-04-22 13:05:27 +00001204 \begin{envdesc}{tableii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001205 Create a two-column table using the \LaTeX{} column specifier
1206 \var{colspec}. The column specifier should indicate vertical
1207 bars between columns as appropriate for the specific table, but
1208 should not specify vertical bars on the outside of the table
1209 (that is considered a stylesheet issue). The \var{col1font}
1210 parameter is used as a stylistic treatment of the first column
1211 of the table: the first column is presented as
1212 \code{\e\var{col1font}\{column1\}}. To avoid treating the first
Fred Drakeadade921999-04-22 13:05:27 +00001213 column specially, \var{col1font} may be \samp{textrm}. The
Fred Drakeacffaee1999-03-16 16:09:13 +00001214 column headings are taken from the values \var{heading1} and
1215 \var{heading2}.
1216 \end{envdesc}
1217
Fred Drakeda72b932000-09-21 15:58:02 +00001218 \begin{envdesc}{longtableii}{\unspecified}
1219 Like \env{tableii}, but produces a table which may be broken
1220 across page boundaries. The parameters are the same as for
1221 \env{tableii}.
1222 \end{envdesc}
1223
Fred Drakeadade921999-04-22 13:05:27 +00001224 \begin{macrodesc}{lineii}{\p{column1}\p{column2}}
Fred Drakeda72b932000-09-21 15:58:02 +00001225 Create a single table row within a \env{tableii} or
1226 \env{longtableii} environment.
Fred Drakeacffaee1999-03-16 16:09:13 +00001227 The text for the first column will be generated by applying the
1228 macro named by the \var{col1font} value when the \env{tableii}
1229 was opened.
1230 \end{macrodesc}
1231
Fred Drakeadade921999-04-22 13:05:27 +00001232 \begin{envdesc}{tableiii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001233 Like the \env{tableii} environment, but with a third column.
1234 The heading for the third column is given by \var{heading3}.
1235 \end{envdesc}
1236
Fred Drakeda72b932000-09-21 15:58:02 +00001237 \begin{envdesc}{longtableiii}{\unspecified}
1238 Like \env{tableiii}, but produces a table which may be broken
1239 across page boundaries. The parameters are the same as for
1240 \env{tableiii}.
1241 \end{envdesc}
1242
Fred Drakeadade921999-04-22 13:05:27 +00001243 \begin{macrodesc}{lineiii}{\p{column1}\p{column2}\p{column3}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001244 Like the \macro{lineii} macro, but with a third column. The
1245 text for the third column is given by \var{column3}.
1246 \end{macrodesc}
1247
Fred Drakeadade921999-04-22 13:05:27 +00001248 \begin{envdesc}{tableiv}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}\p{heading4}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001249 Like the \env{tableiii} environment, but with a fourth column.
1250 The heading for the fourth column is given by \var{heading4}.
1251 \end{envdesc}
1252
Fred Drakeda72b932000-09-21 15:58:02 +00001253 \begin{envdesc}{longtableiv}{\unspecified}
1254 Like \env{tableiv}, but produces a table which may be broken
1255 across page boundaries. The parameters are the same as for
1256 \env{tableiv}.
1257 \end{envdesc}
1258
Fred Drakeadade921999-04-22 13:05:27 +00001259 \begin{macrodesc}{lineiv}{\p{column1}\p{column2}\p{column3}\p{column4}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001260 Like the \macro{lineiii} macro, but with a fourth column. The
1261 text for the fourth column is given by \var{column4}.
1262 \end{macrodesc}
1263
Fred Drakef269e592001-07-17 23:05:57 +00001264 \begin{envdesc}{tablev}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}\p{heading4}\p{heading5}}
1265 Like the \env{tableiv} environment, but with a fifth column.
1266 The heading for the fifth column is given by \var{heading5}.
1267 \end{envdesc}
1268
1269 \begin{envdesc}{longtablev}{\unspecified}
1270 Like \env{tablev}, but produces a table which may be broken
1271 across page boundaries. The parameters are the same as for
1272 \env{tablev}.
1273 \end{envdesc}
1274
1275 \begin{macrodesc}{linev}{\p{column1}\p{column2}\p{column3}\p{column4}\p{column5}}
1276 Like the \macro{lineiv} macro, but with a fifth column. The
1277 text for the fifth column is given by \var{column5}.
1278 \end{macrodesc}
1279
Fred Drakeacffaee1999-03-16 16:09:13 +00001280
1281 An additional table-like environment is \env{synopsistable}. The
1282 table generated by this environment contains two columns, and each
1283 row is defined by an alternate definition of
Fred Drakee15956b2000-04-03 04:51:13 +00001284 \macro{modulesynopsis}. This environment is not normally used by
1285 authors, but is created by the \macro{localmoduletable} macro.
Fred Drakeacffaee1999-03-16 16:09:13 +00001286
Fred Drake0cac5f62001-08-14 21:36:19 +00001287 Here is a small example of a table given in the documentation for
1288 the \module{warnings} module; markup inside the table cells is
1289 minimal so the markup for the table itself is readily discernable.
1290 Here is the markup for the table:
1291
1292\begin{verbatim}
1293\begin{tableii}{l|l}{exception}{Class}{Description}
1294 \lineii{Warning}
1295 {This is the base class of all warning category classes. It
1296 is a subclass of \exception{Exception}.}
1297 \lineii{UserWarning}
1298 {The default category for \function{warn()}.}
1299 \lineii{DeprecationWarning}
1300 {Base category for warnings about deprecated features.}
1301 \lineii{SyntaxWarning}
1302 {Base category for warnings about dubious syntactic
1303 features.}
1304 \lineii{RuntimeWarning}
1305 {Base category for warnings about dubious runtime features.}
1306\end{tableii}
1307\end{verbatim}
1308
1309 Here is the resulting table:
1310
1311\begin{tableii}{l|l}{exception}{Class}{Description}
1312 \lineii{Warning}
1313 {This is the base class of all warning category classes. It
1314 is a subclass of \exception{Exception}.}
1315 \lineii{UserWarning}
1316 {The default category for \function{warn()}.}
1317 \lineii{DeprecationWarning}
1318 {Base category for warnings about deprecated features.}
1319 \lineii{SyntaxWarning}
1320 {Base category for warnings about dubious syntactic
1321 features.}
1322 \lineii{RuntimeWarning}
1323 {Base category for warnings about dubious runtime features.}
1324\end{tableii}
1325
1326 Note that the class names are implicitly marked using the
1327 \macro{exception} macro, since that is given as the \var{col1font}
1328 value for the \env{tableii} environment. To create a table using
1329 different markup for the first column, use \code{textrm} for the
1330 \var{col1font} value and mark each entry individually.
1331
1332 To add a horizontal line between vertical sections of a table, use
1333 the standard \macro{hline} macro between the rows which should be
1334 separated:
1335
1336\begin{verbatim}
1337\begin{tableii}{l|l}{constant}{Language}{Audience}
1338 \lineii{APL}{Masochists.}
1339 \lineii{BASIC}{First-time programmers on PC hardware.}
1340 \lineii{C}{\UNIX{} \&\ Linux kernel developers.}
1341 \hline
1342 \lineii{Python}{Everyone!}
1343\end{tableii}
1344\end{verbatim}
1345
1346 Note that not all presentation formats are capable of displaying a
1347 horizontal rule in this position. This is how the table looks in
1348 the format you're reading now:
1349
1350\begin{tableii}{l|l}{constant}{Language}{Audience}
1351 \lineii{APL}{Masochists.}
1352 \lineii{C}{\UNIX{} \&\ Linux kernel developers.}
1353 \lineii{JavaScript}{Web developers.}
1354 \hline
1355 \lineii{Python}{Everyone!}
1356\end{tableii}
1357
Fred Drakeacffaee1999-03-16 16:09:13 +00001358
1359 \subsection{Reference List Markup \label{references}}
1360
1361 Many sections include a list of references to module documentation
1362 or external documents. These lists are created using the
Fred Drake5ed35fd2001-11-30 18:09:54 +00001363 \env{seealso} or \env{seealso*} environments. These environments
1364 define some additional macros to support creating reference
1365 entries in a reasonable manner.
Fred Drakeacffaee1999-03-16 16:09:13 +00001366
Fred Drake5802e482000-07-06 05:24:41 +00001367 The \env{seealso} environment is typically placed in a section
1368 just before any sub-sections. This is done to ensure that
1369 reference links related to the section are not hidden in a
Fred Drake5ed35fd2001-11-30 18:09:54 +00001370 subsection in the hypertext renditions of the documentation. For
1371 the HTML output, it is shown as a ``side bar,'' boxed off from the
1372 main flow of the text. The \env{seealso*} environment is
1373 different in that it should be used when a list of references is
1374 being presented as part of the primary content; it is not
1375 specially set off from the text.
Fred Drake5802e482000-07-06 05:24:41 +00001376
Fred Drakeacffaee1999-03-16 16:09:13 +00001377 \begin{envdesc}{seealso}{}
1378 This environment creates a ``See also:'' heading and defines the
1379 markup used to describe individual references.
1380 \end{envdesc}
1381
Fred Drake5ed35fd2001-11-30 18:09:54 +00001382 \begin{envdesc}{seealso*}{}
1383 This environment is used to create a list of references which
1384 form part of the main content. It is not given a special
1385 header and is not set off from the main flow of the text. It
1386 provides the same additional markup used to describe individual
1387 references.
1388 \end{envdesc}
1389
Fred Drake48449982000-09-12 17:52:33 +00001390 For each of the following macros, \var{why} should be one or more
1391 complete sentences, starting with a capital letter (unless it
1392 starts with an identifier, which should not be modified), and
1393 ending with the apropriate punctuation.
Fred Drake5802e482000-07-06 05:24:41 +00001394
Fred Drakeb7cf3782000-09-12 19:58:10 +00001395 These macros are only defined within the content of the
Fred Drake5ed35fd2001-11-30 18:09:54 +00001396 \env{seealso} and \env{seealso*} environments.
Fred Drakeb7cf3782000-09-12 19:58:10 +00001397
Fred Drakeadade921999-04-22 13:05:27 +00001398 \begin{macrodesc}{seemodule}{\op{key}\p{name}\p{why}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001399 Refer to another module. \var{why} should be a brief
1400 explanation of why the reference may be interesting. The module
1401 name is given in \var{name}, with the link key given in
1402 \var{key} if necessary. In the HTML and PDF conversions, the
1403 module name will be a hyperlink to the referred-to module.
Fred Drake64a5aaf2001-10-20 04:18:14 +00001404 \note{The module must be documented in the same
1405 document (the corresponding \macro{declaremodule} is required).}
Fred Drakeacffaee1999-03-16 16:09:13 +00001406 \end{macrodesc}
1407
Fred Drake08c5d0c2000-09-11 05:22:30 +00001408 \begin{macrodesc}{seepep}{\p{number}\p{title}\p{why}}
1409 Refer to an Python Enhancement Proposal (PEP). \var{number}
1410 should be the official number assigned by the PEP Editor,
1411 \var{title} should be the human-readable title of the PEP as
Fred Drake5802e482000-07-06 05:24:41 +00001412 found in the official copy of the document, and \var{why} should
Fred Drake08c5d0c2000-09-11 05:22:30 +00001413 explain what's interesting about the PEP. This should be used
1414 to refer the reader to PEPs which specify interfaces or language
1415 features relevant to the material in the annotated section of the
1416 documentation.
1417 \end{macrodesc}
1418
1419 \begin{macrodesc}{seerfc}{\p{number}\p{title}\p{why}}
1420 Refer to an IETF Request for Comments (RFC). Otherwise very
1421 similar to \macro{seepep}. This should be used
1422 to refer the reader to PEPs which specify protocols or data
Fred Drake5802e482000-07-06 05:24:41 +00001423 formats relevant to the material in the annotated section of the
1424 documentation.
1425 \end{macrodesc}
1426
Fred Drakeadade921999-04-22 13:05:27 +00001427 \begin{macrodesc}{seetext}{\p{text}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001428 Add arbitrary text \var{text} to the ``See also:'' list. This
1429 can be used to refer to off-line materials or on-line materials
Fred Drake5802e482000-07-06 05:24:41 +00001430 using the \macro{url} macro. This should consist of one or more
1431 complete sentences.
1432 \end{macrodesc}
1433
Fred Drake48449982000-09-12 17:52:33 +00001434 \begin{macrodesc}{seetitle}{\op{url}\p{title}\p{why}}
1435 Add a reference to an external document named \var{title}. If
1436 \var{url} is given, the title is made a hyperlink in the HTML
1437 version of the documentation, and displayed below the title in
1438 the typeset versions of the documentation.
1439 \end{macrodesc}
1440
Fred Drake5802e482000-07-06 05:24:41 +00001441 \begin{macrodesc}{seeurl}{\p{url}\p{why}}
1442 References to specific on-line resources should be given using
Fred Drake5ed35fd2001-11-30 18:09:54 +00001443 the \macro{seeurl} macro if they don't have a meaningful title.
1444 Online documents which have identifiable titles should be
1445 referenced using the \macro{seetitle} macro, using the optional
1446 parameter to that macro to provide the URL.
Fred Drakeacffaee1999-03-16 16:09:13 +00001447 \end{macrodesc}
1448
1449
1450 \subsection{Index-generating Markup \label{indexing}}
1451
1452 Effective index generation for technical documents can be very
Fred Drakee15956b2000-04-03 04:51:13 +00001453 difficult, especially for someone familiar with the topic but not
Fred Drakeacffaee1999-03-16 16:09:13 +00001454 the creation of indexes. Much of the difficulty arises in the
1455 area of terminology: including the terms an expert would use for a
1456 concept is not sufficient. Coming up with the terms that a novice
Fred Drake2c4e0091999-03-29 14:55:55 +00001457 would look up is fairly difficult for an author who, typically, is
Fred Drakeacffaee1999-03-16 16:09:13 +00001458 an expert in the area she is writing on.
1459
Fred Drake2c4e0091999-03-29 14:55:55 +00001460 The truly difficult aspects of index generation are not areas with
1461 which the documentation tools can help. However, ease
Fred Drakee15956b2000-04-03 04:51:13 +00001462 of producing the index once content decisions are made is within
Fred Drakeacffaee1999-03-16 16:09:13 +00001463 the scope of the tools. Markup is provided which the processing
1464 software is able to use to generate a variety of kinds of index
1465 entry with minimal effort. Additionally, many of the environments
Fred Drake7a737df1999-04-23 14:41:44 +00001466 described in section \ref{info-units}, ``Information Units,'' will
Fred Drakeacffaee1999-03-16 16:09:13 +00001467 generate appropriate entries into the general and module indexes.
1468
1469 The following macro can be used to control the generation of index
Fred Drakeadade921999-04-22 13:05:27 +00001470 data, and should be used in the document preamble:
Fred Drakeacffaee1999-03-16 16:09:13 +00001471
1472 \begin{macrodesc}{makemodindex}{}
Fred Drakeadade921999-04-22 13:05:27 +00001473 This should be used in the document preamble if a ``Module
Fred Drakeacffaee1999-03-16 16:09:13 +00001474 Index'' is desired for a document containing reference material
1475 on many modules. This causes a data file
Fred Draked1fb7791999-05-17 16:33:54 +00001476 \code{lib\var{jobname}.idx} to be created from the
Fred Drakeacffaee1999-03-16 16:09:13 +00001477 \macro{declaremodule} macros. This file can be processed by the
1478 \program{makeindex} program to generate a file which can be
1479 \macro{input} into the document at the desired location of the
1480 module index.
1481 \end{macrodesc}
1482
1483 There are a number of macros that are useful for adding index
1484 entries for particular concepts, many of which are specific to
1485 programming languages or even Python.
1486
Fred Drakeadade921999-04-22 13:05:27 +00001487 \begin{macrodesc}{bifuncindex}{\p{name}}
Fred Drakeec8b9051999-04-23 20:01:17 +00001488 Add an index entry referring to a built-in function named
1489 \var{name}; parentheses should not be included after
Fred Drake2c4e0091999-03-29 14:55:55 +00001490 \var{name}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001491 \end{macrodesc}
1492
Fred Drakeadade921999-04-22 13:05:27 +00001493 \begin{macrodesc}{exindex}{\p{exception}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001494 Add a reference to an exception named \var{exception}. The
1495 exception may be either string- or class-based.
Fred Drakeacffaee1999-03-16 16:09:13 +00001496 \end{macrodesc}
1497
Fred Drakeadade921999-04-22 13:05:27 +00001498 \begin{macrodesc}{kwindex}{\p{keyword}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001499 Add a reference to a language keyword (not a keyword parameter
1500 in a function or method call).
Fred Drakeacffaee1999-03-16 16:09:13 +00001501 \end{macrodesc}
1502
Fred Drakeadade921999-04-22 13:05:27 +00001503 \begin{macrodesc}{obindex}{\p{object type}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001504 Add an index entry for a built-in object type.
Fred Drakeacffaee1999-03-16 16:09:13 +00001505 \end{macrodesc}
1506
Fred Drakeadade921999-04-22 13:05:27 +00001507 \begin{macrodesc}{opindex}{\p{operator}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001508 Add a reference to an operator, such as \samp{+}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001509 \end{macrodesc}
1510
Fred Drakeadade921999-04-22 13:05:27 +00001511 \begin{macrodesc}{refmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001512 Add an index entry for module \var{module}; if \var{module}
1513 contains an underscore, the optional parameter \var{key} should
1514 be provided as the same string with underscores removed. An
1515 index entry ``\var{module} (module)'' will be generated. This
1516 is intended for use with non-standard modules implemented in
1517 Python.
1518 \end{macrodesc}
1519
Fred Drakeadade921999-04-22 13:05:27 +00001520 \begin{macrodesc}{refexmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001521 As for \macro{refmodindex}, but the index entry will be
1522 ``\var{module} (extension module).'' This is intended for use
1523 with non-standard modules not implemented in Python.
1524 \end{macrodesc}
1525
Fred Drakeadade921999-04-22 13:05:27 +00001526 \begin{macrodesc}{refbimodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001527 As for \macro{refmodindex}, but the index entry will be
1528 ``\var{module} (built-in module).'' This is intended for use
1529 with standard modules not implemented in Python.
1530 \end{macrodesc}
1531
Fred Drakeadade921999-04-22 13:05:27 +00001532 \begin{macrodesc}{refstmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001533 As for \macro{refmodindex}, but the index entry will be
1534 ``\var{module} (standard module).'' This is intended for use
1535 with standard modules implemented in Python.
1536 \end{macrodesc}
1537
Fred Drakeadade921999-04-22 13:05:27 +00001538 \begin{macrodesc}{stindex}{\p{statement}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001539 Add an index entry for a statement type, such as \keyword{print}
Fred Drakeadade921999-04-22 13:05:27 +00001540 or \keyword{try}/\keyword{finally}.
1541
1542 XXX Need better examples of difference from \macro{kwindex}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001543 \end{macrodesc}
1544
1545
1546 Additional macros are provided which are useful for conveniently
1547 creating general index entries which should appear at many places
1548 in the index by rotating a list of words. These are simple macros
1549 that simply use \macro{index} to build some number of index
1550 entries. Index entries build using these macros contain both
1551 primary and secondary text.
1552
Fred Drakeadade921999-04-22 13:05:27 +00001553 \begin{macrodesc}{indexii}{\p{word1}\p{word2}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001554 Build two index entries. This is exactly equivalent to using
1555 \code{\e index\{\var{word1}!\var{word2}\}} and
1556 \code{\e index\{\var{word2}!\var{word1}\}}.
1557 \end{macrodesc}
1558
Fred Drakeadade921999-04-22 13:05:27 +00001559 \begin{macrodesc}{indexiii}{\p{word1}\p{word2}\p{word3}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001560 Build three index entries. This is exactly equivalent to using
1561 \code{\e index\{\var{word1}!\var{word2} \var{word3}\}},
1562 \code{\e index\{\var{word2}!\var{word3}, \var{word1}\}}, and
1563 \code{\e index\{\var{word3}!\var{word1} \var{word2}\}}.
1564 \end{macrodesc}
1565
Fred Drakeadade921999-04-22 13:05:27 +00001566 \begin{macrodesc}{indexiv}{\p{word1}\p{word2}\p{word3}\p{word4}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001567 Build four index entries. This is exactly equivalent to using
1568 \code{\e index\{\var{word1}!\var{word2} \var{word3} \var{word4}\}},
1569 \code{\e index\{\var{word2}!\var{word3} \var{word4}, \var{word1}\}},
1570 \code{\e index\{\var{word3}!\var{word4}, \var{word1} \var{word2}\}},
1571 and
1572 \code{\e index\{\var{word4}!\var{word1} \var{word2} \var{word3}\}}.
1573 \end{macrodesc}
1574
Fred Drake432cef02001-07-06 22:34:33 +00001575 \subsection{Grammar Production Displays \label{grammar-displays}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001576
Fred Drake432cef02001-07-06 22:34:33 +00001577 Special markup is available for displaying the productions of a
1578 formal grammar. The markup is simple and does not attempt to
1579 model all aspects of BNF (or any derived forms), but provides
1580 enough to allow context-free grammars to be displayed in a way
1581 that causes uses of a symbol to be rendered as hyperlinks to the
1582 definition of the symbol. There is one environment and a pair of
1583 macros:
Fred Drakeacffaee1999-03-16 16:09:13 +00001584
Fred Drake432cef02001-07-06 22:34:33 +00001585 \begin{envdesc}{productionlist}{\op{language}}
1586 This environment is used to enclose a group of productions. The
1587 two macros are only defined within this environment. If a
1588 document descibes more than one language, the optional parameter
1589 \var{language} should be used to distinguish productions between
1590 languages. The value of the parameter should be a short name
1591 that can be used as part of a filename; colons or other
1592 characters that can't be used in filename across platforms
1593 should be included.
1594 \end{envdesc}
Fred Drakeacffaee1999-03-16 16:09:13 +00001595
Fred Drake432cef02001-07-06 22:34:33 +00001596 \begin{macrodesc}{production}{\p{name}\p{definition}}
1597 A production rule in the grammar. The rule defines the symbol
1598 \var{name} to be \var{definition}. \var{name} should not
1599 contain any markup, and the use of hyphens in a document which
1600 supports more than one grammar is undefined. \var{definition}
1601 may contain \macro{token} macros and any additional content
1602 needed to describe the grammatical model of \var{symbol}. Only
1603 one \macro{production} may be used to define a symbol ---
1604 multiple definitions are not allowed.
1605 \end{macrodesc}
Fred Drakeacffaee1999-03-16 16:09:13 +00001606
Fred Drake432cef02001-07-06 22:34:33 +00001607 \begin{macrodesc}{token}{\p{name}}
1608 The name of a symbol defined by a \macro{production} macro, used
1609 in the \var{definition} of a symbol. Where possible, this will
1610 be rendered as a hyperlink to the definition of the symbol
1611 \var{name}.
1612 \end{macrodesc}
Fred Drake42934682000-04-03 15:00:28 +00001613
Fred Drake432cef02001-07-06 22:34:33 +00001614 Note that the entire grammar does not need to be defined in a
1615 single \env{productionlist} environment; any number of
1616 groupings may be used to describe the grammar. Every use of the
1617 \macro{token} must correspond to a \macro{production}.
1618
1619 The following is an example taken from the
1620 \citetitle[../ref/identifiers.html]{Python Reference Manual}:
1621
1622\begin{verbatim}
1623\begin{productionlist}
1624 \production{identifier}
1625 {(\token{letter}|"_") (\token{letter} | \token{digit} | "_")*}
1626 \production{letter}
1627 {\token{lowercase} | \token{uppercase}}
1628 \production{lowercase}
1629 {"a"..."z"}
1630 \production{uppercase}
1631 {"A"..."Z"}
1632 \production{digit}
1633 {"0"..."9"}
1634\end{productionlist}
1635\end{verbatim}
1636
1637
Fred Drakef1b3de82001-07-24 14:38:34 +00001638\section{Graphical Interface Components \label{gui-markup}}
Fred Drake432cef02001-07-06 22:34:33 +00001639
1640 The components of graphical interfaces will be assigned markup, but
1641 the specifics have not been determined.
Fred Drakeacffaee1999-03-16 16:09:13 +00001642
1643
Fred Drakef1b3de82001-07-24 14:38:34 +00001644\section{Processing Tools \label{tools}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001645
Fred Drakef1b3de82001-07-24 14:38:34 +00001646 \subsection{External Tools \label{tools-external}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001647
1648 Many tools are needed to be able to process the Python
1649 documentation if all supported formats are required. This
Fred Drakeadade921999-04-22 13:05:27 +00001650 section lists the tools used and when each is required. Consult
1651 the \file{Doc/README} file to see if there are specific version
1652 requirements for any of these.
Fred Drakeacffaee1999-03-16 16:09:13 +00001653
1654 \begin{description}
1655 \item[\program{dvips}]
1656 This program is a typical part of \TeX{} installations. It is
1657 used to generate PostScript from the ``device independent''
Fred Drake2c4e0091999-03-29 14:55:55 +00001658 \file{.dvi} files. It is needed for the conversion to
Fred Drakeacffaee1999-03-16 16:09:13 +00001659 PostScript.
1660
1661 \item[\program{emacs}]
1662 Emacs is the kitchen sink of programmers' editors, and a damn
1663 fine kitchen sink it is. It also comes with some of the
1664 processing needed to support the proper menu structures for
1665 Texinfo documents when an info conversion is desired. This is
Fred Drake2c4e0091999-03-29 14:55:55 +00001666 needed for the info conversion. Using \program{xemacs}
Fred Drakeacffaee1999-03-16 16:09:13 +00001667 instead of FSF \program{emacs} may lead to instability in the
1668 conversion, but that's because nobody seems to maintain the
1669 Emacs Texinfo code in a portable manner.
1670
1671 \item[\program{latex}]
Fred Drakeb5f17f22001-08-28 18:09:11 +00001672 \LaTeX{} is a large and extensible macro package by Leslie
1673 Lamport, based on \TeX, a world-class typesetter by Donald
1674 Knuth. It is used for the conversion to PostScript, and is
1675 needed for the HTML conversion as well (\LaTeX2HTML requires
1676 one of the intermediate files it creates).
Fred Drakeacffaee1999-03-16 16:09:13 +00001677
1678 \item[\program{latex2html}]
1679 Probably the longest Perl script anyone ever attempted to
1680 maintain. This converts \LaTeX{} documents to HTML documents,
1681 and does a pretty reasonable job. It is required for the
1682 conversions to HTML and GNU info.
1683
1684 \item[\program{lynx}]
1685 This is a text-mode Web browser which includes an
1686 HTML-to-plain text conversion. This is used to convert
1687 \code{howto} documents to text.
1688
1689 \item[\program{make}]
1690 Just about any version should work for the standard documents,
1691 but GNU \program{make} is required for the experimental
1692 processes in \file{Doc/tools/sgmlconv/}, at least while
Fred Drakeb5f17f22001-08-28 18:09:11 +00001693 they're experimental. This is not required for running the
Fred Drakef9dc0432001-08-29 02:34:10 +00001694 \program{mkhowto} script.
Fred Drakeacffaee1999-03-16 16:09:13 +00001695
1696 \item[\program{makeindex}]
1697 This is a standard program for converting \LaTeX{} index data
1698 to a formatted index; it should be included with all \LaTeX{}
1699 installations. It is needed for the PDF and PostScript
1700 conversions.
1701
1702 \item[\program{makeinfo}]
1703 GNU \program{makeinfo} is used to convert Texinfo documents to
1704 GNU info files. Since Texinfo is used as an intermediate
1705 format in the info conversion, this program is needed in that
1706 conversion.
1707
1708 \item[\program{pdflatex}]
1709 pdf\TeX{} is a relatively new variant of \TeX, and is used to
1710 generate the PDF version of the manuals. It is typically
1711 installed as part of most of the large \TeX{} distributions.
Fred Drake7a737df1999-04-23 14:41:44 +00001712 \program{pdflatex} is pdf\TeX{} using the \LaTeX{} format.
Fred Drakeacffaee1999-03-16 16:09:13 +00001713
1714 \item[\program{perl}]
1715 Perl is required for \LaTeX2HTML{} and one of the scripts used
1716 to post-process \LaTeX2HTML output, as well as the
Fred Drake2c4e0091999-03-29 14:55:55 +00001717 HTML-to-Texinfo conversion. This is required for
Fred Drakeacffaee1999-03-16 16:09:13 +00001718 the HTML and GNU info conversions.
1719
1720 \item[\program{python}]
1721 Python is used for many of the scripts in the
1722 \file{Doc/tools/} directory; it is required for all
1723 conversions. This shouldn't be a problem if you're interested
1724 in writing documentation for Python!
1725 \end{description}
1726
1727
Fred Drakef1b3de82001-07-24 14:38:34 +00001728 \subsection{Internal Tools \label{tools-internal}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001729
1730 This section describes the various scripts that are used to
1731 implement various stages of document processing or to orchestrate
Fred Drake2c4e0091999-03-29 14:55:55 +00001732 entire build sequences. Most of these tools are only useful
Fred Drakeacffaee1999-03-16 16:09:13 +00001733 in the context of building the standard documentation, but some
1734 are more general.
1735
1736 \begin{description}
1737 \item[\program{mkhowto}]
Fred Drake87f768e1999-05-17 15:22:45 +00001738 This is the primary script used to format third-party
1739 documents. It contains all the logic needed to ``get it
1740 right.'' The proper way to use this script is to make a
1741 symbolic link to it or run it in place; the actual script file
1742 must be stored as part of the documentation source tree,
1743 though it may be used to format documents outside the
Fred Drakece444982000-04-11 18:52:52 +00001744 tree. Use \program{mkhowto} \longprogramopt{help}
Fred Draked290c101999-11-09 18:03:00 +00001745 for a list of
Fred Draked2a727f1999-05-27 21:45:54 +00001746 command line options.
Fred Drake87f768e1999-05-17 15:22:45 +00001747
Fred Draked1fb7791999-05-17 16:33:54 +00001748 \program{mkhowto} can be used for both \code{howto} and
1749 \code{manual} class documents. (For the later, be sure to get
1750 the latest version from the Python CVS repository rather than
1751 the version distributed in the \file{latex-1.5.2.tgz} source
1752 archive.)
1753
Fred Drake87f768e1999-05-17 15:22:45 +00001754 XXX Need more here.
Fred Drakeacffaee1999-03-16 16:09:13 +00001755 \end{description}
1756
1757
Fred Drakeeb2b8332002-05-01 22:05:30 +00001758 \subsection{Working on Cygwin \label{cygwin}}
1759
1760 \begin{notice}[warning]
1761 This section is a work in progress. It really doesn't work
1762 yet. If anyone knows Cygwin and wants to help, send email to
1763 \email{python-docs@python.org}.
1764 \end{notice}
1765
1766 Installing the required tools under Cygwin under Cygwin can be a
1767 little tedious, if only because many packages are more difficult
1768 to install under Cygwin.
1769
1770 Using the Cygwin installer, make sure your Cygwin installation
1771 includes Perl, Python, and the \TeX{} packages. Perl and Python
1772 are located under \menuselection{Interpreters} in the installer
1773 The \TeX{} packages are located in the \menuselection{Text}
1774 section; installing the tetex-beta, texmf, texmf-base, and
1775 texmf-extra ensures that all the required packages are available.
1776 (There may be a more minimal set, but I've not spent time trying
1777 to minimize the installation.)
1778
1779 The netpbm package is used by \LaTeX2HTML, and \emph{must} be
1780 installed before \LaTeX2HTML can be successfully installed, even
1781 though they will never be used for most Python documentation.
1782 References to download locations are located in the \ulink{netpbm
1783 README}{http://netpbm.sourceforge.net/README}. Install according
1784 to the instructions.
1785
1786 \LaTeX2HTML can be installed from the source archive, but only
1787 after munging one of the files in the distribution. Edit the file
1788 \file{L2hos.pm} in the top level of the unpacked distribution;
1789 near the bottom of the file, change the text
1790 \code{\$\textasciicircum{}O} with the text \code{'unix'}. Proceed
1791 using this command to build and install the software:
1792
1793\begin{verbatim}
1794% configure && make install
1795\end{verbatim}
1796
1797
Fred Drakeacffaee1999-03-16 16:09:13 +00001798\section{Future Directions \label{futures}}
1799
1800 The history of the Python documentation is full of changes, most of
1801 which have been fairly small and evolutionary. There has been a
1802 great deal of discussion about making large changes in the markup
1803 languages and tools used to process the documentation. This section
1804 deals with the nature of the changes and what appears to be the most
1805 likely path of future development.
1806
1807 \subsection{Structured Documentation \label{structured}}
1808
1809 Most of the small changes to the \LaTeX{} markup have been made
1810 with an eye to divorcing the markup from the presentation, making
1811 both a bit more maintainable. Over the course of 1998, a large
1812 number of changes were made with exactly this in mind; previously,
1813 changes had been made but in a less systematic manner and with
1814 more concern for not needing to update the existing content. The
1815 result has been a highly structured and semantically loaded markup
1816 language implemented in \LaTeX. With almost no basic \TeX{} or
1817 \LaTeX{} markup in use, however, the markup syntax is about the
1818 only evidence of \LaTeX{} in the actual document sources.
1819
1820 One side effect of this is that while we've been able to use
1821 standard ``engines'' for manipulating the documents, such as
1822 \LaTeX{} and \LaTeX2HTML, most of the actual transformations have
Fred Drake7a737df1999-04-23 14:41:44 +00001823 been created specifically for Python. The \LaTeX{} document
1824 classes and \LaTeX2HTML support are both complete implementations
1825 of the specific markup designed for these documents.
Fred Drakeacffaee1999-03-16 16:09:13 +00001826
1827 Combining highly customized markup with the somewhat esoteric
1828 systems used to process the documents leads us to ask some
1829 questions: Can we do this more easily? and, Can we do this
1830 better? After a great deal of discussion with the community, we
1831 have determined that actively pursuing modern structured
Fred Drake2c4e0091999-03-29 14:55:55 +00001832 documentation systems is worth some investment of time.
Fred Drakeacffaee1999-03-16 16:09:13 +00001833
1834 There appear to be two real contenders in this arena: the Standard
1835 General Markup Language (SGML), and the Extensible Markup Language
1836 (XML). Both of these standards have advantages and disadvantages,
1837 and many advantages are shared.
1838
1839 SGML offers advantages which may appeal most to authors,
1840 especially those using ordinary text editors. There are also
1841 additional abilities to define content models. A number of
Fred Drake67f193f2001-07-09 16:04:03 +00001842 high-quality tools with demonstrated maturity are available, but
Fred Drakeacffaee1999-03-16 16:09:13 +00001843 most are not free; for those which are, portability issues remain
1844 a problem.
1845
1846 The advantages of XML include the availability of a large number
1847 of evolving tools. Unfortunately, many of the associated
1848 standards are still evolving, and the tools will have to follow
1849 along. This means that developing a robust tool set that uses
1850 more than the basic XML 1.0 recommendation is not possible in the
1851 short term. The promised availability of a wide variety of
1852 high-quality tools which support some of the most important
1853 related standards is not immediate. Many tools are likely to be
Fred Drake67f193f2001-07-09 16:04:03 +00001854 free, and the portability issues of those which are, are not
1855 expected to be significant.
Fred Drakeacffaee1999-03-16 16:09:13 +00001856
Fred Drake67f193f2001-07-09 16:04:03 +00001857 It turns out that converting to an XML or SGML system holds
1858 promise for translators as well; how much can be done to ease the
1859 burden on translators remains to be seen, and may have some impact
1860 on the schema and specific technologies used.
1861
1862 XXX Eventual migration to XML.
1863
1864 The documentation will be moved to XML in the future, and tools
1865 are being written which will convert the documentation from the
1866 current format to something close to a finished version, to the
1867 extent that the desired information is already present in the
1868 documentation. Some XSLT stylesheets have been started for
1869 presenting a preliminary XML version as HTML, but the results are
1870 fairly rough..
1871
1872 The timeframe for the conversion is not clear since there doesn't
1873 seem to be much time available to work on this, but the appearant
1874 benefits are growing more substantial at a moderately rapid pace.
1875
Fred Drakeacffaee1999-03-16 16:09:13 +00001876
1877 \subsection{Discussion Forums \label{discussion}}
1878
1879 Discussion of the future of the Python documentation and related
Fred Drake7a737df1999-04-23 14:41:44 +00001880 topics takes place in the Documentation Special Interest Group, or
1881 ``Doc-SIG.'' Information on the group, including mailing list
1882 archives and subscription information, is available at
Fred Drakeacffaee1999-03-16 16:09:13 +00001883 \url{http://www.python.org/sigs/doc-sig/}. The SIG is open to all
1884 interested parties.
1885
1886 Comments and bug reports on the standard documents should be sent
1887 to \email{python-docs@python.org}. This may include comments
Fred Drakeadade921999-04-22 13:05:27 +00001888 about formatting, content, grammatical and spelling errors, or
Fred Draked1fb7791999-05-17 16:33:54 +00001889 this document. You can also send comments on this document
1890 directly to the author at \email{fdrake@acm.org}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001891
Skip Montanaro176bda4cd2002-04-19 04:50:44 +00001892\input{doc.ind}
1893
Fred Drakeacffaee1999-03-16 16:09:13 +00001894\end{document}