blob: 6de8a7b72e9cb7be706a20ffa5894f5f51ddc029 [file] [log] [blame]
Fred Drakeacffaee1999-03-16 16:09:13 +00001\documentclass{howto}
2\usepackage{ltxmarkup}
3
4\title{Documenting Python}
5
6\input{boilerplate}
7
Fred Drakec7c9a641999-04-28 18:24:02 +00008% Now override the stuff that includes author information;
9% Guido did *not* write this one!
Fred Drakeacffaee1999-03-16 16:09:13 +000010
11\author{Fred L. Drake, Jr.}
12\authoraddress{
Fred Drake633a8d92000-06-30 15:54:18 +000013 BeOpen PythonLabs \\
14 E-mail: \email{fdrake@beopen.com}
Fred Drakeacffaee1999-03-16 16:09:13 +000015}
Fred Drakeacffaee1999-03-16 16:09:13 +000016
17
18\begin{document}
19
20\maketitle
21
22\begin{abstract}
23\noindent
24The Python language documentation has a substantial body of
25documentation, much of it contributed by various authors. The markup
26used for the Python documentation is based on \LaTeX{} and requires a
27significant set of macros written specifically for documenting Python.
Fred Drake5eb992b1999-06-11 14:25:45 +000028This document describes the macros introduced to support Python
29documentation and how they should be used to support a wide range of
30output formats.
Fred Drakeacffaee1999-03-16 16:09:13 +000031
32This document describes the document classes and special markup used
33in the Python documentation. Authors may use this guide, in
34conjunction with the template files provided with the
35distribution, to create or maintain whole documents or sections.
36\end{abstract}
37
38\tableofcontents
39
40
41\section{Introduction}
42
43 Python's documentation has long been considered to be good for a
44 free programming language. There are a number of reasons for this,
45 the most important being the early commitment of Python's creator,
46 Guido van Rossum, to providing documentation on the language and its
47 libraries, and the continuing involvement of the user community in
48 providing assistance for creating and maintaining documentation.
49
50 The involvement of the community takes many forms, from authoring to
Fred Drake7a737df1999-04-23 14:41:44 +000051 bug reports to just plain complaining when the documentation could
52 be more complete or easier to use. All of these forms of input from
53 the community have proved useful during the time I've been involved
54 in maintaining the documentation.
Fred Drakeacffaee1999-03-16 16:09:13 +000055
Fred Drake2c4e0091999-03-29 14:55:55 +000056 This document is aimed at authors and potential authors of
Fred Drake7a737df1999-04-23 14:41:44 +000057 documentation for Python. More specifically, it is for people
58 contributing to the standard documentation and developing additional
59 documents using the same tools as the standard documents. This
60 guide will be less useful for authors using the Python documentation
61 tools for topics other than Python, and less useful still for
62 authors not using the tools at all.
Fred Drakeacffaee1999-03-16 16:09:13 +000063
Fred Drake2c4e0091999-03-29 14:55:55 +000064 The material in this guide is intended to assist authors using the
65 Python documentation tools. It includes information on the source
66 distribution of the standard documentation, a discussion of the
Fred Drake7a737df1999-04-23 14:41:44 +000067 document types, reference material on the markup defined in the
68 document classes, a list of the external tools needed for processing
Fred Drake2c4e0091999-03-29 14:55:55 +000069 documents, and reference material on the tools provided with the
70 documentation resources. At the end, there is also a section
Fred Drake7a737df1999-04-23 14:41:44 +000071 discussing future directions for the Python documentation and where
72 to turn for more information.
Fred Drakeacffaee1999-03-16 16:09:13 +000073
74\section{Directory Structure}
75
76 The source distribution for the standard Python documentation
77 contains a large number of directories. While third-party documents
78 do not need to be placed into this structure or need to be placed
79 within a similar structure, it can be helpful to know where to look
80 for examples and tools when developing new documents using the
81 Python documentation tools. This section describes this directory
82 structure.
83
84 The documentation sources are usually placed within the Python
Fred Drake7a737df1999-04-23 14:41:44 +000085 source distribution as the top-level directory \file{Doc/}, but
86 are not dependent on the Python source distribution in any way.
Fred Drakeacffaee1999-03-16 16:09:13 +000087
88 The \file{Doc/} directory contains a few files and several
89 subdirectories. The files are mostly self-explanatory, including a
90 \file{README} and a \file{Makefile}. The directories fall into
91 three categories:
92
93 \begin{definitions}
94 \term{Document Sources}
95 The \LaTeX{} sources for each document are placed in a
96 separate directory. These directories are given short,
Fred Drake2f4bebd1999-04-28 16:43:11 +000097 three-character names:
98
99 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Document Title}
Fred Drake698d5201999-11-10 15:54:57 +0000100 \lineii{api/}{\citetitle[../api/api.html]{The Python/C API}}
101 \lineii{doc/}{\citetitle[../doc/doc.html]{Documenting Python}}
102 \lineii{ext/}{\citetitle[../ext/ext.html]{Extending and Embedding the Python Interpreter}}
103 \lineii{lib/}{\citetitle[../lib/lib.html]{Python Library Reference}}
104 \lineii{mac/}{\citetitle[../mac/mac.html]{Macintosh Module Reference}}
105 \lineii{ref/}{\citetitle[../ref/ref.html]{Python Reference Manual}}
106 \lineii{tut/}{\citetitle[../tut/tut.html]{Python Tutorial}}
Fred Drake2f4bebd1999-04-28 16:43:11 +0000107 \end{tableii}
Fred Drakeacffaee1999-03-16 16:09:13 +0000108
109 \term{Format-Specific Output}
Fred Drake2c4e0091999-03-29 14:55:55 +0000110 Most output formats have a directory which contains a
Fred Drakeacffaee1999-03-16 16:09:13 +0000111 \file{Makefile} which controls the generation of that format
112 and provides storage for the formatted documents. The only
Fred Drake2c4e0091999-03-29 14:55:55 +0000113 variations within this category are the Portable Document
114 Format (PDF) and PostScript versions are placed in the
Fred Drake7a737df1999-04-23 14:41:44 +0000115 directories \file{paper-a4/} and \file{paper-letter/} (this
116 causes all the temporary files created by \LaTeX{} to be kept
117 in the same place for each paper size, where they can be more
118 easily ignored).
Fred Drakeacffaee1999-03-16 16:09:13 +0000119
Fred Drake2f4bebd1999-04-28 16:43:11 +0000120 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Output Formats}
121 \lineii{html/}{HTML output}
122 \lineii{info/}{GNU info output}
123 \lineii{paper-a4/}{PDF and PostScript, A4 paper}
124 \lineii{paper-letter/}{PDF and PostScript, US-Letter paper}
125 \end{tableii}
126
Fred Drakeacffaee1999-03-16 16:09:13 +0000127 \term{Supplemental Files}
128 Some additional directories are used to store supplemental
129 files used for the various processes. Directories are
130 included for the shared \LaTeX{} document classes, the
131 \LaTeX2HTML support, template files for various document
132 components, and the scripts used to perform various steps in
133 the formatting processes.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000134
135 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Contents}
136 \lineii{perl/}{Support for \LaTeX2HTML processing}
137 \lineii{templates/}{Example files for source documents}
138 \lineii{texinputs/}{Style implementation for \LaTeX}
139 \lineii{tools/}{Custom processing scripts}
140 \end{tableii}
141
Fred Drakeacffaee1999-03-16 16:09:13 +0000142 \end{definitions}
143
Fred Drake2c4e0091999-03-29 14:55:55 +0000144
Fred Drakeadade921999-04-22 13:05:27 +0000145\section{\LaTeX{} Primer \label{latex-primer}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000146
Fred Drakeadade921999-04-22 13:05:27 +0000147 This section is a brief introduction to \LaTeX{} concepts and
148 syntax, to provide authors enough information to author documents
149 productively without having to become ``\TeX{}nicians.''
150
Fred Drake5eb992b1999-06-11 14:25:45 +0000151 Perhaps the most important concept to keep in mind while marking up
152 Python documentation is the while \TeX{} is unstructured, \LaTeX{} was
153 designed as a layer on top of \TeX{} which specifically supports
154 structured markup. The Python-specific markup is intended to extend
155 the structure provided by standard \LaTeX{} document classes to
156 support additional information specific to Python.
157
Fred Drakeadade921999-04-22 13:05:27 +0000158 \LaTeX{} documents contain two parts: the preamble and the body.
159 The preamble is used to specify certain metadata about the document
160 itself, such as the title, the list of authors, the date, and the
161 \emph{class} the document belongs to. Additional information used
162 to control index generation and the use of bibliographic databases
Fred Drake7a737df1999-04-23 14:41:44 +0000163 can also be placed in the preamble. For most authors, the preamble
Fred Drakeadade921999-04-22 13:05:27 +0000164 can be most easily created by copying it from an existing document
165 and modifying a few key pieces of information.
166
167 The \dfn{class} of a document is used to place a document within a
168 broad category of documents and set some fundamental formatting
169 properties. For Python documentation, two classes are used: the
170 \code{manual} class and the \code{howto} class. These classes also
171 define the additional markup used to document Python concepts and
172 structures. Specific information about these classes is provided in
Fred Drake7a737df1999-04-23 14:41:44 +0000173 section \ref{classes}, ``Document Classes,'' below. The first thing
Fred Drakeadade921999-04-22 13:05:27 +0000174 in the preamble is the declaration of the document's class.
175
176 After the class declaration, a number of \emph{macros} are used to
177 provide further information about the document and setup any
Fred Drake7a737df1999-04-23 14:41:44 +0000178 additional markup that is needed. No output is generated from the
179 preamble; it is an error to include free text in the preamble
180 because it would cause output.
Fred Drakeadade921999-04-22 13:05:27 +0000181
182 The document body follows the preamble. This contains all the
183 printed components of the document marked up structurally.
184
185 XXX This section will discuss what the markup looks like, and
186 explain the difference between an environment and a macro.
Fred Drake2c4e0091999-03-29 14:55:55 +0000187
188
Fred Drakeadade921999-04-22 13:05:27 +0000189\section{Document Classes \label{classes}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000190
191 Two \LaTeX{} document classes are defined specifically for use with
192 the Python documentation. The \code{manual} class is for large
193 documents which are sectioned into chapters, and the \code{howto}
194 class is for smaller documents.
195
196 The \code{manual} documents are larger and are used for most of the
197 standard documents. This document class is based on the standard
198 \LaTeX{} \code{report} class and is formatted very much like a long
Fred Drake698d5201999-11-10 15:54:57 +0000199 technical report. The \citetitle[../ref/ref.html]{Python Reference
200 Manual} is a good example of a \code{manual} document, and the
201 \citetitle[../lib/lib.html]{Python Library Reference} is a large
202 example.
Fred Drakeacffaee1999-03-16 16:09:13 +0000203
204 The \code{howto} documents are shorter, and don't have the large
205 structure of the \code{manual} documents. This class is based on
206 the standard \LaTeX{} \code{article} class and is formatted somewhat
207 like the Linux Documentation Project's ``HOWTO'' series as done
208 originally using the LinuxDoc software. The original intent for the
209 document class was that it serve a similar role as the LDP's HOWTO
210 series, but the applicability of the class turns out to be somewhat
211 more broad. This class is used for ``how-to'' documents (this
212 document is an example) and for shorter reference manuals for small,
213 fairly cohesive module libraries. Examples of the later use include
Fred Drake698d5201999-11-10 15:54:57 +0000214 the standard \citetitle[../mac/mac.html]{Macintosh Library Modules}
215 and
216\citetitle[http://starship.python.org/crew/fdrake/manuals/krb5py/krb5py.html]{Using
Fred Drakeacffaee1999-03-16 16:09:13 +0000217 Kerberos from Python}, which contains reference material for an
218 extension package. These documents are roughly equivalent to a
219 single chapter from a larger work.
220
221
Fred Drake7a737df1999-04-23 14:41:44 +0000222\section{Special Markup Constructs}
Fred Drakeacffaee1999-03-16 16:09:13 +0000223
Fred Drake2c4e0091999-03-29 14:55:55 +0000224 The Python document classes define a lot of new environments and
225 macros. This section contains the reference material for these
226 facilities.
227
Fred Drakee15956b2000-04-03 04:51:13 +0000228 \subsection{Meta-information Markup \label{meta-info}}
229
230 \begin{macrodesc}{sectionauthor}{\p{author}\p{email}}
231 Identifies the author of the current section. \var{author}
232 should be the author's name such that it can be used for
233 presentation (though it isn't), and \var{email} should be the
234 author's email address. The domain name portion of
235 the address should be lower case.
236
237 No presentation is generated from this markup, but it is used to
238 help keep track of contributions.
239 \end{macrodesc}
240
Fred Drakeacffaee1999-03-16 16:09:13 +0000241 \subsection{Information Units \label{info-units}}
242
Fred Drake2f4bebd1999-04-28 16:43:11 +0000243 XXX Explain terminology, or come up with something more ``lay.''
Fred Drakeacffaee1999-03-16 16:09:13 +0000244
Fred Drakeadade921999-04-22 13:05:27 +0000245 There are a number of environments used to describe specific
246 features provided by modules. Each environment requires
247 parameters needed to provide basic information about what is being
248 described, and the environment content should be the description.
249 Most of these environments make entries in the general index (if
250 one is being produced for the document); if no index entry is
251 desired, non-indexing variants are available for many of these
252 environments. The environments have names of the form
253 \code{\var{feature}desc}, and the non-indexing variants are named
254 \code{\var{feature}descni}. The available variants are explicitly
255 included in the list below.
256
257 For each of these environments, the first parameter, \var{name},
258 provides the name by which the feature is accessed.
259
260 Environments which describe features of objects within a module,
261 such as object methods or data attributes, allow an optional
262 \var{type name} parameter. When the feature is an attribute of
263 class instances, \var{type name} only needs to be given if the
264 class was not the most recently described class in the module; the
265 \var{name} value from the most recent \env{classdesc} is implied.
266 For features of built-in or extension types, the \var{type name}
Fred Drake7a737df1999-04-23 14:41:44 +0000267 value should always be provided. Another special case includes
268 methods and members of general ``protocols,'' such as the
269 formatter and writer protocols described for the
270 \module{formatter} module: these may be documented without any
271 specific implementation classes, and will always require the
272 \var{type name} parameter to be provided.
Fred Drakeadade921999-04-22 13:05:27 +0000273
274 \begin{envdesc}{datadesc}{\p{name}}
275 This environment is used to document global data in a module,
276 including both variables and values used as ``defined
277 constants.'' Class and object attributes are not documented
278 using this environment.
Fred Drakeacffaee1999-03-16 16:09:13 +0000279 \end{envdesc}
Fred Drake7a737df1999-04-23 14:41:44 +0000280 \begin{envdesc}{datadescni}{\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000281 Like \env{datadesc}, but without creating any index entries.
282 \end{envdesc}
283
Fred Drakeadade921999-04-22 13:05:27 +0000284 \begin{envdesc}{excdesc}{\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000285 Describe an exception. This may be either a string exception or
286 a class exception.
287 \end{envdesc}
288
Fred Drakeadade921999-04-22 13:05:27 +0000289 \begin{envdesc}{funcdesc}{\p{name}\p{parameters}}
290 Describe a module-level function. \var{parameters} should
291 not include the parentheses used in the call syntax. Object
292 methods are not documented using this environment. Bound object
293 methods placed in the module namespace as part of the public
294 interface of the module are documented using this, as they are
295 equivalent to normal functions for most purposes.
296
297 The description should include information about the parameters
298 required and how they are used (especially whether mutable
299 objects passed as parameters are modified), side effects, and
300 possible exceptions. A small example may be provided.
Fred Drakeacffaee1999-03-16 16:09:13 +0000301 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000302 \begin{envdesc}{funcdescni}{\p{name}\p{parameters}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000303 Like \env{funcdesc}, but without creating any index entries.
304 \end{envdesc}
305
Fred Drakeadade921999-04-22 13:05:27 +0000306 \begin{envdesc}{classdesc}{\p{name}\p{constructor parameters}}
307 Describe a class and its constructor. \var{constructor
308 parameters} should not include the \var{self} parameter or
309 the parentheses used in the call syntax.
Fred Drakeacffaee1999-03-16 16:09:13 +0000310 \end{envdesc}
311
Fred Drakeadade921999-04-22 13:05:27 +0000312 \begin{envdesc}{memberdesc}{\op{type name}\p{name}}
313 Describe an object data attribute. The description should
314 include information about the type of the data to be expected
315 and whether it may be changed directly.
Fred Drakeacffaee1999-03-16 16:09:13 +0000316 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000317 \begin{envdesc}{memberdescni}{\op{type name}\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000318 Like \env{memberdesc}, but without creating any index entries.
319 \end{envdesc}
320
Fred Drakeadade921999-04-22 13:05:27 +0000321 \begin{envdesc}{methoddesc}{\op{type name}\p{name}\p{parameters}}
322 Describe an object method. \var{parameters} should not include
323 the \var{self} parameter or the parentheses used in the call
324 syntax. The description should include similar information to
325 that described for \env{funcdesc}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000326 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000327 \begin{envdesc}{methoddescni}{\op{type name}\p{name}\p{parameters}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000328 Like \env{methoddesc}, but without creating any index entries.
329 \end{envdesc}
330
331
Fred Drake5eb992b1999-06-11 14:25:45 +0000332 \subsection{Showing Code Examples}
333
334 Examples of Python source code or interactive sessions are
335 represented as \env{verbatim} environments. This environment
336 is a standard part of \LaTeX{}. It is important to only use
337 spaces for indentation in code examples since \TeX{} drops tabs
338 instead of converting them to spaces.
339
340 Representing an interactive session requires including the prompts
341 and output along with the Python code. No special markup is
342 required for interactive sessions.
343
344 Within the \env{verbatim} environment, characters special to
345 \LaTeX{} do not need to be specially marked in any way. The entire
346 example will be presented in a monospaced font; no attempt at
347 ``pretty-printing'' is made, as the environment must work for
348 non-Python code and non-code displays.
349
350 The Python Documentation Special Interest Group has discussed a
351 number of approaches to creating pretty-printed code displays and
352 interactive sessions; see the Doc-SIG area on the Python Web site
353 for more information on this topic.
354
355
Fred Drakeacffaee1999-03-16 16:09:13 +0000356 \subsection{Inline Markup}
357
Fred Drake87f768e1999-05-17 15:22:45 +0000358 The macros described in this section are used to mark just about
359 anything interesting in the document text. They may be used in
360 headings (though anything involving hyperlinks should be avoided
361 there) as well as in the body text.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000362
363 \begin{macrodesc}{bfcode}{\p{text}}
364 Like \macro{code}, but also makes the font bold-face.
365 \end{macrodesc}
366
367 \begin{macrodesc}{cdata}{\p{name}}
368 The name of a C-language variable.
369 \end{macrodesc}
370
371 \begin{macrodesc}{cfunction}{\p{name}}
372 The name of a C-language function. \var{name} should include the
373 function name and the trailing parentheses.
374 \end{macrodesc}
375
376 \begin{macrodesc}{character}{\p{char}}
377 A character when discussing the character rather than a one-byte
378 string value. The character will be typeset as with \macro{samp}.
379 \end{macrodesc}
380
Fred Drake29a710f1999-11-10 22:51:18 +0000381 \begin{macrodesc}{citetitle}{\op{url}\p{title}}
382 A title for a referenced publication. If \var{url} is specified,
383 the title will be made into a hyperlink when formatted as HTML.
384 \end{macrodesc}
385
Fred Drake2f4bebd1999-04-28 16:43:11 +0000386 \begin{macrodesc}{class}{\p{name}}
387 A class name; a dotted name may be used.
388 \end{macrodesc}
389
390 \begin{macrodesc}{code}{\p{text}}
391 A short code fragment or literal constant value. Typically, it
392 should not include any spaces since no quotation marks are
393 added.
394 \end{macrodesc}
395
396 \begin{macrodesc}{constant}{\p{name}}
397 The name of a ``defined'' constant. This may be a C-language
398 \code{\#define} or a Python variable that is not intended to be
399 changed.
400 \end{macrodesc}
401
402 \begin{macrodesc}{ctype}{\p{name}}
403 The name of a C \keyword{typedef} or structure. For structures
404 defined without a \keyword{typedef}, use \code{\e ctype\{struct
405 struct_tag\}} to make it clear that the \keyword{struct} is
406 required.
407 \end{macrodesc}
408
409 \begin{macrodesc}{deprecated}{\p{version}\p{what to do}}
410 Declare whatever is being described as being deprecated starting
411 with release \var{version}. The text given as \var{what to do}
412 should recommend something to use instead.
413 \end{macrodesc}
414
415 \begin{macrodesc}{dfn}{\p{term}}
416 Mark the defining instance of \var{term} in the text. (No index
417 entries are generated.)
418 \end{macrodesc}
419
Fred Draked1fb7791999-05-17 16:33:54 +0000420 \begin{macrodesc}{e}{}
421 Produces a backslash. This is convenient in \macro{code} and
Fred Drake2b853412000-04-11 19:08:30 +0000422 similar macros, and is only defined there. The create a
423 backslash in ordinary text (such as the contents of the
424 \macro{file} macro), use the standard \macro{textbackslash} macro.
Fred Draked1fb7791999-05-17 16:33:54 +0000425 \end{macrodesc}
426
Fred Drake2f4bebd1999-04-28 16:43:11 +0000427 \begin{macrodesc}{email}{\p{address}}
428 An email address. Note that this is \emph{not} hyperlinked in
Fred Drakee15956b2000-04-03 04:51:13 +0000429 any of the possible output formats. The domain name portion of
430 the address should be lower case.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000431 \end{macrodesc}
432
433 \begin{macrodesc}{emph}{\p{text}}
434 Emphasized text; this will be presented in an italic font.
435 \end{macrodesc}
436
437 \begin{macrodesc}{envvar}{\p{name}}
438 An environment variable. Index entries are generated.
439 \end{macrodesc}
440
441 \begin{macrodesc}{exception}{\p{name}}
442 The name of an exception. A dotted name may be used.
443 \end{macrodesc}
444
445 \begin{macrodesc}{file}{\p{file or dir}}
446 The name of a file or directory. In the PDF and PostScript
447 outputs, single quotes and a font change are used to indicate
448 the file name, but no quotes are used in the HTML output.
449 \end{macrodesc}
450
451 \begin{macrodesc}{filenq}{\p{file or dir}}
452 Like \macro{file}, but single quotes are never used. This can
453 be used in conjunction with tables if a column will only contain
454 file or directory names.
455 \end{macrodesc}
456
457 \begin{macrodesc}{function}{\p{name}}
458 The name of a Python function; dotted names may be used.
459 \end{macrodesc}
460
461 \begin{macrodesc}{kbd}{\p{key sequence}}
462 Mark a sequence of keystrokes. What form \var{key sequence}
463 takes may depend on platform- or application-specific
464 conventions. For example, an \program{xemacs} key sequence
465 may be marked like \code{\e kbd\{C-x C-f\}}.
466 \end{macrodesc}
467
468 \begin{macrodesc}{keyword}{\p{name}}
469 The name of a keyword in a programming language.
470 \end{macrodesc}
471
472 \begin{macrodesc}{makevar}{\p{name}}
473 The name of a \program{make} variable.
474 \end{macrodesc}
475
476 \begin{macrodesc}{manpage}{\p{name}\p{section}}
477 A reference to a \UNIX{} manual page.
478 \end{macrodesc}
479
480 \begin{macrodesc}{member}{\p{name}}
481 The name of a data attribute of an object.
482 \end{macrodesc}
483
484 \begin{macrodesc}{method}{\p{name}}
485 The name of a method of an object. \var{name} should include the
486 method name and the trailing parentheses. A dotted name may be
487 used.
488 \end{macrodesc}
489
490 \begin{macrodesc}{mimetype}{\p{name}}
491 The name of a MIME type.
492 \end{macrodesc}
493
494 \begin{macrodesc}{module}{\p{name}}
Fred Drake2b853412000-04-11 19:08:30 +0000495 The name of a module; a dotted name may be used. This should
496 also be used for package names.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000497 \end{macrodesc}
498
499 \begin{macrodesc}{newsgroup}{\p{name}}
500 The name of a USENET newsgroup.
501 \end{macrodesc}
502
Fred Drake2f4bebd1999-04-28 16:43:11 +0000503 \begin{macrodesc}{program}{\p{name}}
504 The name of an executable program. This may differ from the
505 file name for the executable for some platforms. In particular,
506 the \file{.exe} (or other) extension should be omitted for DOS
507 and Windows programs.
508 \end{macrodesc}
509
Fred Drake29a710f1999-11-10 22:51:18 +0000510 \begin{macrodesc}{programopt}{\p{option}}
Fred Drakece444982000-04-11 18:52:52 +0000511 A command-line option to an executable program. Use this only
512 for ``shot'' options, and include the leading hyphen.
513 \end{macrodesc}
514
515 \begin{macrodesc}{longprogramopt}{\p{option}}
516 A long command-line option to an executable program. This
517 should only be used for long option names which will be prefixed
518 by two hyphens; the hyphens should not be provided as part of
519 \var{option}.
Fred Drake29a710f1999-11-10 22:51:18 +0000520 \end{macrodesc}
521
Fred Drake2f4bebd1999-04-28 16:43:11 +0000522 \begin{macrodesc}{refmodule}{\op{key}\p{name}}
523 Like \macro{module}, but create a hyperlink to the documentation
524 for the named module. Note that the corresponding
525 \macro{declaremodule} must be in the same document. If the
526 \macro{declaremodule} defines a module key different from the
527 module name, it must also be provided as \var{key} to the
528 \macro{refmodule} macro.
529 \end{macrodesc}
530
531 \begin{macrodesc}{regexp}{\p{string}}
532 Mark a regular expression.
533 \end{macrodesc}
534
535 \begin{macrodesc}{rfc}{\p{number}}
536 A reference to an Internet Request for Comments. This generates
537 appropriate index entries. The text \samp{RFC \var{number}} is
538 generated; in the HTML output, this text is a hyperlink to an
539 online copy of the specified RFC.
540 \end{macrodesc}
541
542 \begin{macrodesc}{samp}{\p{text}}
543 A short code sample, but possibly longer than would be given
544 using \macro{code}. Since quotation marks are added, spaces are
545 acceptable.
546 \end{macrodesc}
547
548 \begin{macrodesc}{strong}{\p{text}}
549 Strongly emphasized text; this will be presented using a bold
550 font.
551 \end{macrodesc}
552
Fred Draked1fb7791999-05-17 16:33:54 +0000553 \begin{macrodesc}{url}{\p{url}}
554 A URL (or URN). The URL will be presented as text. In the HTML
555 and PDF formatted versions, the URL will also be a hyperlink.
556 This can be used when referring to external resources. Note
557 that many characters are special to \LaTeX{} and this macro
558 does not always do the right thing. In particular, the tilde
559 character (\character{\~}) is mis-handled; encoding it as a
560 hex-sequence does work, use \samp{\%7e} in place of the tilde
561 character.
562 \end{macrodesc}
563
Fred Drake2f4bebd1999-04-28 16:43:11 +0000564 \begin{macrodesc}{var}{\p{name}}
565 The name of a variable or formal parameter in running text.
566 \end{macrodesc}
567
568 \begin{macrodesc}{version}{}
569 The version number for the documentation, as specified using
570 \macro{release} in the preamble.
571 \end{macrodesc}
Fred Drakeacffaee1999-03-16 16:09:13 +0000572
Fred Drakec26cc912000-05-02 17:43:44 +0000573 \begin{macrodesc}{versionadded}{\p{version}}
574 The version of Python which added the described feature to the
575 library or C API. This is typically added to the end of the
576 first paragraph of the description before any availability
577 notes. The location should be selected so the explanation makes
578 sense and may vary as needed.
579 \end{macrodesc}
580
581 \begin{macrodesc}{versionchanged}{\op{explanation}\p{version}}
582 The version of Python in which the named feature was changed in
583 some way (new parameters, changed side effects, etc.).
584 \var{explanation} should be a \emph{brief} explanation of the
585 change consisting of a non-capitalized sentence fragment; a
586 period will be appended by the formatting process.
587 This is typically added to the end of the first paragraph of the
588 description before any availability notes and after
589 \macro{versionadded}. The location should be selected so the
590 explanation makes sense and may vary as needed.
591 \end{macrodesc}
592
Fred Drakeacffaee1999-03-16 16:09:13 +0000593
594 \subsection{Module-specific Markup}
595
596 The markup described in this section is used to provide information
597 about a module being documented. A typical use of this markup
598 appears at the top of the section used to document a module. A
599 typical example might look like this:
600
601\begin{verbatim}
602\section{\module{spam} ---
603 Access to the SPAM facility}
604
605\declaremodule{extension}{spam}
Fred Drake2c4e0091999-03-29 14:55:55 +0000606 \platform{Unix}
Fred Drakeadade921999-04-22 13:05:27 +0000607\modulesynopsis{Access to the SPAM facility of \UNIX{}.}
Fred Drake2c4e0091999-03-29 14:55:55 +0000608\moduleauthor{Jane Doe}{jane.doe@frobnitz.org}
Fred Drakeacffaee1999-03-16 16:09:13 +0000609\end{verbatim}
610
Fred Drakeadade921999-04-22 13:05:27 +0000611 \begin{macrodesc}{declaremodule}{\op{key}\p{type}\p{name}}
Fred Drake87f768e1999-05-17 15:22:45 +0000612 Requires two parameters: module type (\samp{standard},
613 \samp{builtin}, \samp{extension}, or \samp{}), and the module
614 name. An optional parameter should be given as the basis for the
615 module's ``key'' used for linking to or referencing the section.
616 The ``key'' should only be given if the module's name contains any
617 underscores, and should be the name with the underscores stripped.
618 Note that the \var{type} parameter must be one of the values
619 listed above or an error will be printed. For modules which are
620 contained in packages, the fully-qualified name should be given as
621 \var{name} parameter. This should be the first thing after the
622 \macro{section} used to introduce the module.
Fred Drakeacffaee1999-03-16 16:09:13 +0000623 \end{macrodesc}
624
Fred Drakeadade921999-04-22 13:05:27 +0000625 \begin{macrodesc}{platform}{\p{specifier}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000626 Specifies the portability of the module. \var{specifier} is a
627 comma-separated list of keys that specify what platforms the
628 module is available on. The keys are short identifiers;
629 examples that are in use include \samp{IRIX}, \samp{Mac},
630 \samp{Windows}, and \samp{Unix}. It is important to use a key
Fred Drake7a737df1999-04-23 14:41:44 +0000631 which has already been used when applicable. This is used to
632 provide annotations in the Module Index and the HTML and GNU info
633 output.
Fred Drakeacffaee1999-03-16 16:09:13 +0000634 \end{macrodesc}
635
Fred Drakeadade921999-04-22 13:05:27 +0000636 \begin{macrodesc}{modulesynopsis}{\p{text}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000637 The \var{text} is a short, ``one line'' description of the
638 module that can be used as part of the chapter introduction.
Fred Drakeadade921999-04-22 13:05:27 +0000639 This is must be placed after \macro{declaremodule}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000640 The synopsis is used in building the contents of the table
641 inserted as the \macro{localmoduletable}. No text is
642 produced at the point of the markup.
643 \end{macrodesc}
644
Fred Drakeadade921999-04-22 13:05:27 +0000645 \begin{macrodesc}{moduleauthor}{\p{name}\p{email}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000646 This macro is used to encode information about who authored a
647 module. This is currently not used to generate output, but can be
648 used to help determine the origin of the module.
649 \end{macrodesc}
650
651
652 \subsection{Library-level Markup}
653
654 This markup is used when describing a selection of modules. For
Fred Drake698d5201999-11-10 15:54:57 +0000655 example, the \citetitle[../mac/mac.html]{Macintosh Library
656 Modules} document uses this to help provide an overview of the
657 modules in the collection, and many chapters in the
658 \citetitle[../lib/lib.html]{Python Library Reference} use it for
Fred Drakeacffaee1999-03-16 16:09:13 +0000659 the same purpose.
660
661 \begin{macrodesc}{localmoduletable}{}
Fred Drake2c4e0091999-03-29 14:55:55 +0000662 If a \file{.syn} file exists for the current
Fred Drakeacffaee1999-03-16 16:09:13 +0000663 chapter (or for the entire document in \code{howto} documents), a
664 \env{synopsistable} is created with the contents loaded from the
665 \file{.syn} file.
666 \end{macrodesc}
667
668
669 \subsection{Table Markup}
670
671 There are three general-purpose table environments defined which
672 should be used whenever possible. These environments are defined
673 to provide tables of specific widths and some convenience for
674 formatting. These environments are not meant to be general
675 replacements for the standard \LaTeX{} table environments, but can
676 be used for an advantage when the documents are processed using
677 the tools for Python documentation processing. In particular, the
678 generated HTML looks good! There is also an advantage for the
Fred Drake7a737df1999-04-23 14:41:44 +0000679 eventual conversion of the documentation to SGML (see section
Fred Drake2c4e0091999-03-29 14:55:55 +0000680 \ref{futures}, ``Future Directions'').
Fred Drakeacffaee1999-03-16 16:09:13 +0000681
682 Each environment is named \env{table\var{cols}}, where \var{cols}
683 is the number of columns in the table specified in lower-case
684 Roman numerals. Within each of these environments, an additional
685 macro, \macro{line\var{cols}}, is defined, where \var{cols}
686 matches the \var{cols} value of the corresponding table
Fred Drake2c4e0091999-03-29 14:55:55 +0000687 environment. These are supported for \var{cols} values of
688 \code{ii}, \code{iii}, and \code{iv}. These environments are all
689 built on top of the \env{tabular} environment.
Fred Drakeacffaee1999-03-16 16:09:13 +0000690
Fred Drake2b853412000-04-11 19:08:30 +0000691 Note that all tables in the standard Python documentation use
692 vertical lines between columns, and this must be specified in the
693 markup for each table. A general border around the outside of the
694 table is not used, but would be the responsibility of the
695 processor.
696
Fred Drakeadade921999-04-22 13:05:27 +0000697 \begin{envdesc}{tableii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000698 Create a two-column table using the \LaTeX{} column specifier
699 \var{colspec}. The column specifier should indicate vertical
700 bars between columns as appropriate for the specific table, but
701 should not specify vertical bars on the outside of the table
702 (that is considered a stylesheet issue). The \var{col1font}
703 parameter is used as a stylistic treatment of the first column
704 of the table: the first column is presented as
705 \code{\e\var{col1font}\{column1\}}. To avoid treating the first
Fred Drakeadade921999-04-22 13:05:27 +0000706 column specially, \var{col1font} may be \samp{textrm}. The
Fred Drakeacffaee1999-03-16 16:09:13 +0000707 column headings are taken from the values \var{heading1} and
708 \var{heading2}.
709 \end{envdesc}
710
Fred Drakeadade921999-04-22 13:05:27 +0000711 \begin{macrodesc}{lineii}{\p{column1}\p{column2}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000712 Create a single table row within a \env{tableii} environment.
713 The text for the first column will be generated by applying the
714 macro named by the \var{col1font} value when the \env{tableii}
715 was opened.
716 \end{macrodesc}
717
Fred Drakeadade921999-04-22 13:05:27 +0000718 \begin{envdesc}{tableiii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000719 Like the \env{tableii} environment, but with a third column.
720 The heading for the third column is given by \var{heading3}.
721 \end{envdesc}
722
Fred Drakeadade921999-04-22 13:05:27 +0000723 \begin{macrodesc}{lineiii}{\p{column1}\p{column2}\p{column3}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000724 Like the \macro{lineii} macro, but with a third column. The
725 text for the third column is given by \var{column3}.
726 \end{macrodesc}
727
Fred Drakeadade921999-04-22 13:05:27 +0000728 \begin{envdesc}{tableiv}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}\p{heading4}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000729 Like the \env{tableiii} environment, but with a fourth column.
730 The heading for the fourth column is given by \var{heading4}.
731 \end{envdesc}
732
Fred Drakeadade921999-04-22 13:05:27 +0000733 \begin{macrodesc}{lineiv}{\p{column1}\p{column2}\p{column3}\p{column4}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000734 Like the \macro{lineiii} macro, but with a fourth column. The
735 text for the fourth column is given by \var{column4}.
736 \end{macrodesc}
737
738
739 An additional table-like environment is \env{synopsistable}. The
740 table generated by this environment contains two columns, and each
741 row is defined by an alternate definition of
Fred Drakee15956b2000-04-03 04:51:13 +0000742 \macro{modulesynopsis}. This environment is not normally used by
743 authors, but is created by the \macro{localmoduletable} macro.
Fred Drakeacffaee1999-03-16 16:09:13 +0000744
745
746 \subsection{Reference List Markup \label{references}}
747
748 Many sections include a list of references to module documentation
749 or external documents. These lists are created using the
750 \env{seealso} environment. This environment defines some
751 additional macros to support creating reference entries in a
752 reasonable manner.
753
Fred Drake5802e482000-07-06 05:24:41 +0000754 The \env{seealso} environment is typically placed in a section
755 just before any sub-sections. This is done to ensure that
756 reference links related to the section are not hidden in a
757 subsection in the hypertext renditions of the documentation.
758
Fred Drakeacffaee1999-03-16 16:09:13 +0000759 \begin{envdesc}{seealso}{}
760 This environment creates a ``See also:'' heading and defines the
761 markup used to describe individual references.
762 \end{envdesc}
763
Fred Drake5802e482000-07-06 05:24:41 +0000764 For each of the following macros, \var{why} should be a complete
765 sentence, start with a capital letter (unless it starts with an
766 identifier, which should not be modified), and end with the
767 apropriate punctuation.
768
Fred Drakeadade921999-04-22 13:05:27 +0000769 \begin{macrodesc}{seemodule}{\op{key}\p{name}\p{why}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000770 Refer to another module. \var{why} should be a brief
771 explanation of why the reference may be interesting. The module
772 name is given in \var{name}, with the link key given in
773 \var{key} if necessary. In the HTML and PDF conversions, the
774 module name will be a hyperlink to the referred-to module.
Fred Drakeadade921999-04-22 13:05:27 +0000775 \strong{Note:} The module must be documented in the same
776 document (the corresponding \macro{declaremodule} is required).
Fred Drakeacffaee1999-03-16 16:09:13 +0000777 \end{macrodesc}
778
Fred Drake5802e482000-07-06 05:24:41 +0000779 \begin{macrodesc}{seerfc}{\p{number}\p{title}\p{why}}
780 Refer to an IETF Request for Comments (RFC). \var{number}
781 should be the official number assigned by the RFC Editor,
782 \var{title} should be the human-readable title of the RFC as
783 found in the official copy of the document, and \var{why} should
784 explain what's interesting about the RFC. This should be used
785 to refer the reader to RFCs which specify protocols or data
786 formats relevant to the material in the annotated section of the
787 documentation.
788 \end{macrodesc}
789
Fred Drakeadade921999-04-22 13:05:27 +0000790 \begin{macrodesc}{seetext}{\p{text}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000791 Add arbitrary text \var{text} to the ``See also:'' list. This
792 can be used to refer to off-line materials or on-line materials
Fred Drake5802e482000-07-06 05:24:41 +0000793 using the \macro{url} macro. This should consist of one or more
794 complete sentences.
795 \end{macrodesc}
796
797 \begin{macrodesc}{seeurl}{\p{url}\p{why}}
798 References to specific on-line resources should be given using
799 the \macro{seeurl} macro. No title is associated with the
800 reference, but the \var{why} text may include a title marked
801 using the \macro{citetitle} macro.
Fred Drakeacffaee1999-03-16 16:09:13 +0000802 \end{macrodesc}
803
804
805 \subsection{Index-generating Markup \label{indexing}}
806
807 Effective index generation for technical documents can be very
Fred Drakee15956b2000-04-03 04:51:13 +0000808 difficult, especially for someone familiar with the topic but not
Fred Drakeacffaee1999-03-16 16:09:13 +0000809 the creation of indexes. Much of the difficulty arises in the
810 area of terminology: including the terms an expert would use for a
811 concept is not sufficient. Coming up with the terms that a novice
Fred Drake2c4e0091999-03-29 14:55:55 +0000812 would look up is fairly difficult for an author who, typically, is
Fred Drakeacffaee1999-03-16 16:09:13 +0000813 an expert in the area she is writing on.
814
Fred Drake2c4e0091999-03-29 14:55:55 +0000815 The truly difficult aspects of index generation are not areas with
816 which the documentation tools can help. However, ease
Fred Drakee15956b2000-04-03 04:51:13 +0000817 of producing the index once content decisions are made is within
Fred Drakeacffaee1999-03-16 16:09:13 +0000818 the scope of the tools. Markup is provided which the processing
819 software is able to use to generate a variety of kinds of index
820 entry with minimal effort. Additionally, many of the environments
Fred Drake7a737df1999-04-23 14:41:44 +0000821 described in section \ref{info-units}, ``Information Units,'' will
Fred Drakeacffaee1999-03-16 16:09:13 +0000822 generate appropriate entries into the general and module indexes.
823
824 The following macro can be used to control the generation of index
Fred Drakeadade921999-04-22 13:05:27 +0000825 data, and should be used in the document preamble:
Fred Drakeacffaee1999-03-16 16:09:13 +0000826
827 \begin{macrodesc}{makemodindex}{}
Fred Drakeadade921999-04-22 13:05:27 +0000828 This should be used in the document preamble if a ``Module
Fred Drakeacffaee1999-03-16 16:09:13 +0000829 Index'' is desired for a document containing reference material
830 on many modules. This causes a data file
Fred Draked1fb7791999-05-17 16:33:54 +0000831 \code{lib\var{jobname}.idx} to be created from the
Fred Drakeacffaee1999-03-16 16:09:13 +0000832 \macro{declaremodule} macros. This file can be processed by the
833 \program{makeindex} program to generate a file which can be
834 \macro{input} into the document at the desired location of the
835 module index.
836 \end{macrodesc}
837
838 There are a number of macros that are useful for adding index
839 entries for particular concepts, many of which are specific to
840 programming languages or even Python.
841
Fred Drakeadade921999-04-22 13:05:27 +0000842 \begin{macrodesc}{bifuncindex}{\p{name}}
Fred Drakeec8b9051999-04-23 20:01:17 +0000843 Add an index entry referring to a built-in function named
844 \var{name}; parentheses should not be included after
Fred Drake2c4e0091999-03-29 14:55:55 +0000845 \var{name}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000846 \end{macrodesc}
847
Fred Drakeadade921999-04-22 13:05:27 +0000848 \begin{macrodesc}{exindex}{\p{exception}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000849 Add a reference to an exception named \var{exception}. The
850 exception may be either string- or class-based.
Fred Drakeacffaee1999-03-16 16:09:13 +0000851 \end{macrodesc}
852
Fred Drakeadade921999-04-22 13:05:27 +0000853 \begin{macrodesc}{kwindex}{\p{keyword}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000854 Add a reference to a language keyword (not a keyword parameter
855 in a function or method call).
Fred Drakeacffaee1999-03-16 16:09:13 +0000856 \end{macrodesc}
857
Fred Drakeadade921999-04-22 13:05:27 +0000858 \begin{macrodesc}{obindex}{\p{object type}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000859 Add an index entry for a built-in object type.
Fred Drakeacffaee1999-03-16 16:09:13 +0000860 \end{macrodesc}
861
Fred Drakeadade921999-04-22 13:05:27 +0000862 \begin{macrodesc}{opindex}{\p{operator}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000863 Add a reference to an operator, such as \samp{+}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000864 \end{macrodesc}
865
Fred Drakeadade921999-04-22 13:05:27 +0000866 \begin{macrodesc}{refmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000867 Add an index entry for module \var{module}; if \var{module}
868 contains an underscore, the optional parameter \var{key} should
869 be provided as the same string with underscores removed. An
870 index entry ``\var{module} (module)'' will be generated. This
871 is intended for use with non-standard modules implemented in
872 Python.
873 \end{macrodesc}
874
Fred Drakeadade921999-04-22 13:05:27 +0000875 \begin{macrodesc}{refexmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000876 As for \macro{refmodindex}, but the index entry will be
877 ``\var{module} (extension module).'' This is intended for use
878 with non-standard modules not implemented in Python.
879 \end{macrodesc}
880
Fred Drakeadade921999-04-22 13:05:27 +0000881 \begin{macrodesc}{refbimodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000882 As for \macro{refmodindex}, but the index entry will be
883 ``\var{module} (built-in module).'' This is intended for use
884 with standard modules not implemented in Python.
885 \end{macrodesc}
886
Fred Drakeadade921999-04-22 13:05:27 +0000887 \begin{macrodesc}{refstmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000888 As for \macro{refmodindex}, but the index entry will be
889 ``\var{module} (standard module).'' This is intended for use
890 with standard modules implemented in Python.
891 \end{macrodesc}
892
Fred Drakeadade921999-04-22 13:05:27 +0000893 \begin{macrodesc}{stindex}{\p{statement}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000894 Add an index entry for a statement type, such as \keyword{print}
Fred Drakeadade921999-04-22 13:05:27 +0000895 or \keyword{try}/\keyword{finally}.
896
897 XXX Need better examples of difference from \macro{kwindex}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000898 \end{macrodesc}
899
900
901 Additional macros are provided which are useful for conveniently
902 creating general index entries which should appear at many places
903 in the index by rotating a list of words. These are simple macros
904 that simply use \macro{index} to build some number of index
905 entries. Index entries build using these macros contain both
906 primary and secondary text.
907
Fred Drakeadade921999-04-22 13:05:27 +0000908 \begin{macrodesc}{indexii}{\p{word1}\p{word2}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000909 Build two index entries. This is exactly equivalent to using
910 \code{\e index\{\var{word1}!\var{word2}\}} and
911 \code{\e index\{\var{word2}!\var{word1}\}}.
912 \end{macrodesc}
913
Fred Drakeadade921999-04-22 13:05:27 +0000914 \begin{macrodesc}{indexiii}{\p{word1}\p{word2}\p{word3}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000915 Build three index entries. This is exactly equivalent to using
916 \code{\e index\{\var{word1}!\var{word2} \var{word3}\}},
917 \code{\e index\{\var{word2}!\var{word3}, \var{word1}\}}, and
918 \code{\e index\{\var{word3}!\var{word1} \var{word2}\}}.
919 \end{macrodesc}
920
Fred Drakeadade921999-04-22 13:05:27 +0000921 \begin{macrodesc}{indexiv}{\p{word1}\p{word2}\p{word3}\p{word4}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000922 Build four index entries. This is exactly equivalent to using
923 \code{\e index\{\var{word1}!\var{word2} \var{word3} \var{word4}\}},
924 \code{\e index\{\var{word2}!\var{word3} \var{word4}, \var{word1}\}},
925 \code{\e index\{\var{word3}!\var{word4}, \var{word1} \var{word2}\}},
926 and
927 \code{\e index\{\var{word4}!\var{word1} \var{word2} \var{word3}\}}.
928 \end{macrodesc}
929
930
931\section{Special Names}
932
933 Many special names are used in the Python documentation, including
934 the names of operating systems, programming languages, standards
935 bodies, and the like. Many of these were assigned \LaTeX{} macros
936 at some point in the distant past, and these macros lived on long
937 past their usefulness. In the current markup, these entities are
938 not assigned any special markup, but the preferred spellings are
939 given here to aid authors in maintaining the consistency of
940 presentation in the Python documentation.
941
942 \begin{description}
943 \item[POSIX]
944 The name assigned to a particular group of standards. This is
945 always uppercase.
946
947 \item[Python]
948 The name of our favorite programming language is always
949 capitalized.
Fred Drake42934682000-04-03 15:00:28 +0000950
951 \item[Unicode]
952 The name of a character set and matching encoding. This is
953 always written capitalized.
Fred Drakeacffaee1999-03-16 16:09:13 +0000954 \end{description}
955
956
957\section{Processing Tools}
958
959 \subsection{External Tools}
960
961 Many tools are needed to be able to process the Python
962 documentation if all supported formats are required. This
Fred Drakeadade921999-04-22 13:05:27 +0000963 section lists the tools used and when each is required. Consult
964 the \file{Doc/README} file to see if there are specific version
965 requirements for any of these.
Fred Drakeacffaee1999-03-16 16:09:13 +0000966
967 \begin{description}
968 \item[\program{dvips}]
969 This program is a typical part of \TeX{} installations. It is
970 used to generate PostScript from the ``device independent''
Fred Drake2c4e0091999-03-29 14:55:55 +0000971 \file{.dvi} files. It is needed for the conversion to
Fred Drakeacffaee1999-03-16 16:09:13 +0000972 PostScript.
973
974 \item[\program{emacs}]
975 Emacs is the kitchen sink of programmers' editors, and a damn
976 fine kitchen sink it is. It also comes with some of the
977 processing needed to support the proper menu structures for
978 Texinfo documents when an info conversion is desired. This is
Fred Drake2c4e0091999-03-29 14:55:55 +0000979 needed for the info conversion. Using \program{xemacs}
Fred Drakeacffaee1999-03-16 16:09:13 +0000980 instead of FSF \program{emacs} may lead to instability in the
981 conversion, but that's because nobody seems to maintain the
982 Emacs Texinfo code in a portable manner.
983
984 \item[\program{latex}]
985 This is a world-class typesetter by Donald Knuth. It is used
986 for the conversion to PostScript, and is needed for the HTML
987 conversion as well (\LaTeX2HTML requires one of the
988 intermediate files it creates).
989
990 \item[\program{latex2html}]
991 Probably the longest Perl script anyone ever attempted to
992 maintain. This converts \LaTeX{} documents to HTML documents,
993 and does a pretty reasonable job. It is required for the
994 conversions to HTML and GNU info.
995
996 \item[\program{lynx}]
997 This is a text-mode Web browser which includes an
998 HTML-to-plain text conversion. This is used to convert
999 \code{howto} documents to text.
1000
1001 \item[\program{make}]
1002 Just about any version should work for the standard documents,
1003 but GNU \program{make} is required for the experimental
1004 processes in \file{Doc/tools/sgmlconv/}, at least while
1005 they're experimental.
1006
1007 \item[\program{makeindex}]
1008 This is a standard program for converting \LaTeX{} index data
1009 to a formatted index; it should be included with all \LaTeX{}
1010 installations. It is needed for the PDF and PostScript
1011 conversions.
1012
1013 \item[\program{makeinfo}]
1014 GNU \program{makeinfo} is used to convert Texinfo documents to
1015 GNU info files. Since Texinfo is used as an intermediate
1016 format in the info conversion, this program is needed in that
1017 conversion.
1018
1019 \item[\program{pdflatex}]
1020 pdf\TeX{} is a relatively new variant of \TeX, and is used to
1021 generate the PDF version of the manuals. It is typically
1022 installed as part of most of the large \TeX{} distributions.
Fred Drake7a737df1999-04-23 14:41:44 +00001023 \program{pdflatex} is pdf\TeX{} using the \LaTeX{} format.
Fred Drakeacffaee1999-03-16 16:09:13 +00001024
1025 \item[\program{perl}]
1026 Perl is required for \LaTeX2HTML{} and one of the scripts used
1027 to post-process \LaTeX2HTML output, as well as the
Fred Drake2c4e0091999-03-29 14:55:55 +00001028 HTML-to-Texinfo conversion. This is required for
Fred Drakeacffaee1999-03-16 16:09:13 +00001029 the HTML and GNU info conversions.
1030
1031 \item[\program{python}]
1032 Python is used for many of the scripts in the
1033 \file{Doc/tools/} directory; it is required for all
1034 conversions. This shouldn't be a problem if you're interested
1035 in writing documentation for Python!
1036 \end{description}
1037
1038
1039 \subsection{Internal Tools}
1040
1041 This section describes the various scripts that are used to
1042 implement various stages of document processing or to orchestrate
Fred Drake2c4e0091999-03-29 14:55:55 +00001043 entire build sequences. Most of these tools are only useful
Fred Drakeacffaee1999-03-16 16:09:13 +00001044 in the context of building the standard documentation, but some
1045 are more general.
1046
1047 \begin{description}
1048 \item[\program{mkhowto}]
Fred Drake87f768e1999-05-17 15:22:45 +00001049 This is the primary script used to format third-party
1050 documents. It contains all the logic needed to ``get it
1051 right.'' The proper way to use this script is to make a
1052 symbolic link to it or run it in place; the actual script file
1053 must be stored as part of the documentation source tree,
1054 though it may be used to format documents outside the
Fred Drakece444982000-04-11 18:52:52 +00001055 tree. Use \program{mkhowto} \longprogramopt{help}
Fred Draked290c101999-11-09 18:03:00 +00001056 for a list of
Fred Draked2a727f1999-05-27 21:45:54 +00001057 command line options.
Fred Drake87f768e1999-05-17 15:22:45 +00001058
Fred Draked1fb7791999-05-17 16:33:54 +00001059 \program{mkhowto} can be used for both \code{howto} and
1060 \code{manual} class documents. (For the later, be sure to get
1061 the latest version from the Python CVS repository rather than
1062 the version distributed in the \file{latex-1.5.2.tgz} source
1063 archive.)
1064
Fred Drake87f768e1999-05-17 15:22:45 +00001065 XXX Need more here.
Fred Drakeacffaee1999-03-16 16:09:13 +00001066 \end{description}
1067
1068
1069\section{Future Directions \label{futures}}
1070
1071 The history of the Python documentation is full of changes, most of
1072 which have been fairly small and evolutionary. There has been a
1073 great deal of discussion about making large changes in the markup
1074 languages and tools used to process the documentation. This section
1075 deals with the nature of the changes and what appears to be the most
1076 likely path of future development.
1077
1078 \subsection{Structured Documentation \label{structured}}
1079
1080 Most of the small changes to the \LaTeX{} markup have been made
1081 with an eye to divorcing the markup from the presentation, making
1082 both a bit more maintainable. Over the course of 1998, a large
1083 number of changes were made with exactly this in mind; previously,
1084 changes had been made but in a less systematic manner and with
1085 more concern for not needing to update the existing content. The
1086 result has been a highly structured and semantically loaded markup
1087 language implemented in \LaTeX. With almost no basic \TeX{} or
1088 \LaTeX{} markup in use, however, the markup syntax is about the
1089 only evidence of \LaTeX{} in the actual document sources.
1090
1091 One side effect of this is that while we've been able to use
1092 standard ``engines'' for manipulating the documents, such as
1093 \LaTeX{} and \LaTeX2HTML, most of the actual transformations have
Fred Drake7a737df1999-04-23 14:41:44 +00001094 been created specifically for Python. The \LaTeX{} document
1095 classes and \LaTeX2HTML support are both complete implementations
1096 of the specific markup designed for these documents.
Fred Drakeacffaee1999-03-16 16:09:13 +00001097
1098 Combining highly customized markup with the somewhat esoteric
1099 systems used to process the documents leads us to ask some
1100 questions: Can we do this more easily? and, Can we do this
1101 better? After a great deal of discussion with the community, we
1102 have determined that actively pursuing modern structured
Fred Drake2c4e0091999-03-29 14:55:55 +00001103 documentation systems is worth some investment of time.
Fred Drakeacffaee1999-03-16 16:09:13 +00001104
1105 There appear to be two real contenders in this arena: the Standard
1106 General Markup Language (SGML), and the Extensible Markup Language
1107 (XML). Both of these standards have advantages and disadvantages,
1108 and many advantages are shared.
1109
1110 SGML offers advantages which may appeal most to authors,
1111 especially those using ordinary text editors. There are also
1112 additional abilities to define content models. A number of
1113 high-quality tools with demonstrated maturity is available, but
1114 most are not free; for those which are, portability issues remain
1115 a problem.
1116
1117 The advantages of XML include the availability of a large number
1118 of evolving tools. Unfortunately, many of the associated
1119 standards are still evolving, and the tools will have to follow
1120 along. This means that developing a robust tool set that uses
1121 more than the basic XML 1.0 recommendation is not possible in the
1122 short term. The promised availability of a wide variety of
1123 high-quality tools which support some of the most important
1124 related standards is not immediate. Many tools are likely to be
1125 free.
1126
Fred Drakeadade921999-04-22 13:05:27 +00001127 XXX Eventual migration to SGML/XML.
Fred Drakeacffaee1999-03-16 16:09:13 +00001128
1129 \subsection{Discussion Forums \label{discussion}}
1130
1131 Discussion of the future of the Python documentation and related
Fred Drake7a737df1999-04-23 14:41:44 +00001132 topics takes place in the Documentation Special Interest Group, or
1133 ``Doc-SIG.'' Information on the group, including mailing list
1134 archives and subscription information, is available at
Fred Drakeacffaee1999-03-16 16:09:13 +00001135 \url{http://www.python.org/sigs/doc-sig/}. The SIG is open to all
1136 interested parties.
1137
1138 Comments and bug reports on the standard documents should be sent
1139 to \email{python-docs@python.org}. This may include comments
Fred Drakeadade921999-04-22 13:05:27 +00001140 about formatting, content, grammatical and spelling errors, or
Fred Draked1fb7791999-05-17 16:33:54 +00001141 this document. You can also send comments on this document
1142 directly to the author at \email{fdrake@acm.org}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001143
1144\end{document}