blob: 7b7f1574b3a12ec4bf66777c56dd3220b0f4c30f [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}}
Fred Drake1cb3a9e2000-07-25 19:27:17 +0000101 \lineii{dist/}{\citetitle[../dist/dist.html]{Distributing Python Modules}}
Fred Drake698d5201999-11-10 15:54:57 +0000102 \lineii{doc/}{\citetitle[../doc/doc.html]{Documenting Python}}
103 \lineii{ext/}{\citetitle[../ext/ext.html]{Extending and Embedding the Python Interpreter}}
Fred Drake1cb3a9e2000-07-25 19:27:17 +0000104 \lineii{inst/}{\citetitle[../inst/inst.html]{Installing Python Modules}}
Fred Drake698d5201999-11-10 15:54:57 +0000105 \lineii{lib/}{\citetitle[../lib/lib.html]{Python Library Reference}}
106 \lineii{mac/}{\citetitle[../mac/mac.html]{Macintosh Module Reference}}
107 \lineii{ref/}{\citetitle[../ref/ref.html]{Python Reference Manual}}
108 \lineii{tut/}{\citetitle[../tut/tut.html]{Python Tutorial}}
Fred Drake2f4bebd1999-04-28 16:43:11 +0000109 \end{tableii}
Fred Drakeacffaee1999-03-16 16:09:13 +0000110
111 \term{Format-Specific Output}
Fred Drake2c4e0091999-03-29 14:55:55 +0000112 Most output formats have a directory which contains a
Fred Drakeacffaee1999-03-16 16:09:13 +0000113 \file{Makefile} which controls the generation of that format
114 and provides storage for the formatted documents. The only
Fred Drake2c4e0091999-03-29 14:55:55 +0000115 variations within this category are the Portable Document
116 Format (PDF) and PostScript versions are placed in the
Fred Drake7a737df1999-04-23 14:41:44 +0000117 directories \file{paper-a4/} and \file{paper-letter/} (this
118 causes all the temporary files created by \LaTeX{} to be kept
119 in the same place for each paper size, where they can be more
120 easily ignored).
Fred Drakeacffaee1999-03-16 16:09:13 +0000121
Fred Drake2f4bebd1999-04-28 16:43:11 +0000122 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Output Formats}
123 \lineii{html/}{HTML output}
124 \lineii{info/}{GNU info output}
125 \lineii{paper-a4/}{PDF and PostScript, A4 paper}
126 \lineii{paper-letter/}{PDF and PostScript, US-Letter paper}
127 \end{tableii}
128
Fred Drakeacffaee1999-03-16 16:09:13 +0000129 \term{Supplemental Files}
130 Some additional directories are used to store supplemental
131 files used for the various processes. Directories are
132 included for the shared \LaTeX{} document classes, the
133 \LaTeX2HTML support, template files for various document
134 components, and the scripts used to perform various steps in
135 the formatting processes.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000136
137 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Contents}
138 \lineii{perl/}{Support for \LaTeX2HTML processing}
139 \lineii{templates/}{Example files for source documents}
140 \lineii{texinputs/}{Style implementation for \LaTeX}
141 \lineii{tools/}{Custom processing scripts}
142 \end{tableii}
143
Fred Drakeacffaee1999-03-16 16:09:13 +0000144 \end{definitions}
145
Fred Drake2c4e0091999-03-29 14:55:55 +0000146
Fred Drakeadade921999-04-22 13:05:27 +0000147\section{\LaTeX{} Primer \label{latex-primer}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000148
Fred Drakeadade921999-04-22 13:05:27 +0000149 This section is a brief introduction to \LaTeX{} concepts and
150 syntax, to provide authors enough information to author documents
151 productively without having to become ``\TeX{}nicians.''
152
Fred Drake5eb992b1999-06-11 14:25:45 +0000153 Perhaps the most important concept to keep in mind while marking up
154 Python documentation is the while \TeX{} is unstructured, \LaTeX{} was
155 designed as a layer on top of \TeX{} which specifically supports
156 structured markup. The Python-specific markup is intended to extend
157 the structure provided by standard \LaTeX{} document classes to
158 support additional information specific to Python.
159
Fred Drakeadade921999-04-22 13:05:27 +0000160 \LaTeX{} documents contain two parts: the preamble and the body.
161 The preamble is used to specify certain metadata about the document
162 itself, such as the title, the list of authors, the date, and the
163 \emph{class} the document belongs to. Additional information used
164 to control index generation and the use of bibliographic databases
Fred Drake7a737df1999-04-23 14:41:44 +0000165 can also be placed in the preamble. For most authors, the preamble
Fred Drakeadade921999-04-22 13:05:27 +0000166 can be most easily created by copying it from an existing document
167 and modifying a few key pieces of information.
168
169 The \dfn{class} of a document is used to place a document within a
170 broad category of documents and set some fundamental formatting
171 properties. For Python documentation, two classes are used: the
172 \code{manual} class and the \code{howto} class. These classes also
173 define the additional markup used to document Python concepts and
174 structures. Specific information about these classes is provided in
Fred Drake7a737df1999-04-23 14:41:44 +0000175 section \ref{classes}, ``Document Classes,'' below. The first thing
Fred Drakeadade921999-04-22 13:05:27 +0000176 in the preamble is the declaration of the document's class.
177
178 After the class declaration, a number of \emph{macros} are used to
179 provide further information about the document and setup any
Fred Drake7a737df1999-04-23 14:41:44 +0000180 additional markup that is needed. No output is generated from the
181 preamble; it is an error to include free text in the preamble
182 because it would cause output.
Fred Drakeadade921999-04-22 13:05:27 +0000183
184 The document body follows the preamble. This contains all the
185 printed components of the document marked up structurally.
186
187 XXX This section will discuss what the markup looks like, and
188 explain the difference between an environment and a macro.
Fred Drake2c4e0091999-03-29 14:55:55 +0000189
190
Fred Drakeadade921999-04-22 13:05:27 +0000191\section{Document Classes \label{classes}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000192
193 Two \LaTeX{} document classes are defined specifically for use with
194 the Python documentation. The \code{manual} class is for large
195 documents which are sectioned into chapters, and the \code{howto}
196 class is for smaller documents.
197
198 The \code{manual} documents are larger and are used for most of the
199 standard documents. This document class is based on the standard
200 \LaTeX{} \code{report} class and is formatted very much like a long
Fred Drake698d5201999-11-10 15:54:57 +0000201 technical report. The \citetitle[../ref/ref.html]{Python Reference
202 Manual} is a good example of a \code{manual} document, and the
203 \citetitle[../lib/lib.html]{Python Library Reference} is a large
204 example.
Fred Drakeacffaee1999-03-16 16:09:13 +0000205
206 The \code{howto} documents are shorter, and don't have the large
207 structure of the \code{manual} documents. This class is based on
208 the standard \LaTeX{} \code{article} class and is formatted somewhat
209 like the Linux Documentation Project's ``HOWTO'' series as done
210 originally using the LinuxDoc software. The original intent for the
211 document class was that it serve a similar role as the LDP's HOWTO
212 series, but the applicability of the class turns out to be somewhat
213 more broad. This class is used for ``how-to'' documents (this
214 document is an example) and for shorter reference manuals for small,
215 fairly cohesive module libraries. Examples of the later use include
Fred Drake698d5201999-11-10 15:54:57 +0000216 the standard \citetitle[../mac/mac.html]{Macintosh Library Modules}
217 and
218\citetitle[http://starship.python.org/crew/fdrake/manuals/krb5py/krb5py.html]{Using
Fred Drakeacffaee1999-03-16 16:09:13 +0000219 Kerberos from Python}, which contains reference material for an
220 extension package. These documents are roughly equivalent to a
221 single chapter from a larger work.
222
223
Fred Drake7a737df1999-04-23 14:41:44 +0000224\section{Special Markup Constructs}
Fred Drakeacffaee1999-03-16 16:09:13 +0000225
Fred Drake2c4e0091999-03-29 14:55:55 +0000226 The Python document classes define a lot of new environments and
227 macros. This section contains the reference material for these
228 facilities.
229
Fred Drakee15956b2000-04-03 04:51:13 +0000230 \subsection{Meta-information Markup \label{meta-info}}
231
232 \begin{macrodesc}{sectionauthor}{\p{author}\p{email}}
233 Identifies the author of the current section. \var{author}
234 should be the author's name such that it can be used for
235 presentation (though it isn't), and \var{email} should be the
236 author's email address. The domain name portion of
237 the address should be lower case.
238
239 No presentation is generated from this markup, but it is used to
240 help keep track of contributions.
241 \end{macrodesc}
242
Fred Drakeacffaee1999-03-16 16:09:13 +0000243 \subsection{Information Units \label{info-units}}
244
Fred Drake2f4bebd1999-04-28 16:43:11 +0000245 XXX Explain terminology, or come up with something more ``lay.''
Fred Drakeacffaee1999-03-16 16:09:13 +0000246
Fred Drakeadade921999-04-22 13:05:27 +0000247 There are a number of environments used to describe specific
248 features provided by modules. Each environment requires
249 parameters needed to provide basic information about what is being
250 described, and the environment content should be the description.
251 Most of these environments make entries in the general index (if
252 one is being produced for the document); if no index entry is
253 desired, non-indexing variants are available for many of these
254 environments. The environments have names of the form
255 \code{\var{feature}desc}, and the non-indexing variants are named
256 \code{\var{feature}descni}. The available variants are explicitly
257 included in the list below.
258
259 For each of these environments, the first parameter, \var{name},
260 provides the name by which the feature is accessed.
261
262 Environments which describe features of objects within a module,
263 such as object methods or data attributes, allow an optional
264 \var{type name} parameter. When the feature is an attribute of
265 class instances, \var{type name} only needs to be given if the
266 class was not the most recently described class in the module; the
267 \var{name} value from the most recent \env{classdesc} is implied.
268 For features of built-in or extension types, the \var{type name}
Fred Drake7a737df1999-04-23 14:41:44 +0000269 value should always be provided. Another special case includes
270 methods and members of general ``protocols,'' such as the
271 formatter and writer protocols described for the
272 \module{formatter} module: these may be documented without any
273 specific implementation classes, and will always require the
274 \var{type name} parameter to be provided.
Fred Drakeadade921999-04-22 13:05:27 +0000275
276 \begin{envdesc}{datadesc}{\p{name}}
277 This environment is used to document global data in a module,
278 including both variables and values used as ``defined
279 constants.'' Class and object attributes are not documented
280 using this environment.
Fred Drakeacffaee1999-03-16 16:09:13 +0000281 \end{envdesc}
Fred Drake7a737df1999-04-23 14:41:44 +0000282 \begin{envdesc}{datadescni}{\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000283 Like \env{datadesc}, but without creating any index entries.
284 \end{envdesc}
285
Fred Drakeadade921999-04-22 13:05:27 +0000286 \begin{envdesc}{excdesc}{\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000287 Describe an exception. This may be either a string exception or
288 a class exception.
289 \end{envdesc}
290
Fred Drakeadade921999-04-22 13:05:27 +0000291 \begin{envdesc}{funcdesc}{\p{name}\p{parameters}}
292 Describe a module-level function. \var{parameters} should
293 not include the parentheses used in the call syntax. Object
294 methods are not documented using this environment. Bound object
295 methods placed in the module namespace as part of the public
296 interface of the module are documented using this, as they are
297 equivalent to normal functions for most purposes.
298
299 The description should include information about the parameters
300 required and how they are used (especially whether mutable
301 objects passed as parameters are modified), side effects, and
302 possible exceptions. A small example may be provided.
Fred Drakeacffaee1999-03-16 16:09:13 +0000303 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000304 \begin{envdesc}{funcdescni}{\p{name}\p{parameters}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000305 Like \env{funcdesc}, but without creating any index entries.
306 \end{envdesc}
307
Fred Drakeadade921999-04-22 13:05:27 +0000308 \begin{envdesc}{classdesc}{\p{name}\p{constructor parameters}}
309 Describe a class and its constructor. \var{constructor
310 parameters} should not include the \var{self} parameter or
311 the parentheses used in the call syntax.
Fred Drakeacffaee1999-03-16 16:09:13 +0000312 \end{envdesc}
313
Fred Drakeadade921999-04-22 13:05:27 +0000314 \begin{envdesc}{memberdesc}{\op{type name}\p{name}}
315 Describe an object data attribute. The description should
316 include information about the type of the data to be expected
317 and whether it may be changed directly.
Fred Drakeacffaee1999-03-16 16:09:13 +0000318 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000319 \begin{envdesc}{memberdescni}{\op{type name}\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000320 Like \env{memberdesc}, but without creating any index entries.
321 \end{envdesc}
322
Fred Drakeadade921999-04-22 13:05:27 +0000323 \begin{envdesc}{methoddesc}{\op{type name}\p{name}\p{parameters}}
324 Describe an object method. \var{parameters} should not include
325 the \var{self} parameter or the parentheses used in the call
326 syntax. The description should include similar information to
327 that described for \env{funcdesc}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000328 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000329 \begin{envdesc}{methoddescni}{\op{type name}\p{name}\p{parameters}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000330 Like \env{methoddesc}, but without creating any index entries.
331 \end{envdesc}
332
333
Fred Drake5eb992b1999-06-11 14:25:45 +0000334 \subsection{Showing Code Examples}
335
336 Examples of Python source code or interactive sessions are
337 represented as \env{verbatim} environments. This environment
338 is a standard part of \LaTeX{}. It is important to only use
339 spaces for indentation in code examples since \TeX{} drops tabs
340 instead of converting them to spaces.
341
342 Representing an interactive session requires including the prompts
343 and output along with the Python code. No special markup is
344 required for interactive sessions.
345
346 Within the \env{verbatim} environment, characters special to
347 \LaTeX{} do not need to be specially marked in any way. The entire
348 example will be presented in a monospaced font; no attempt at
349 ``pretty-printing'' is made, as the environment must work for
350 non-Python code and non-code displays.
351
352 The Python Documentation Special Interest Group has discussed a
353 number of approaches to creating pretty-printed code displays and
354 interactive sessions; see the Doc-SIG area on the Python Web site
355 for more information on this topic.
356
357
Fred Drakeacffaee1999-03-16 16:09:13 +0000358 \subsection{Inline Markup}
359
Fred Drake87f768e1999-05-17 15:22:45 +0000360 The macros described in this section are used to mark just about
361 anything interesting in the document text. They may be used in
362 headings (though anything involving hyperlinks should be avoided
363 there) as well as in the body text.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000364
365 \begin{macrodesc}{bfcode}{\p{text}}
366 Like \macro{code}, but also makes the font bold-face.
367 \end{macrodesc}
368
369 \begin{macrodesc}{cdata}{\p{name}}
370 The name of a C-language variable.
371 \end{macrodesc}
372
373 \begin{macrodesc}{cfunction}{\p{name}}
374 The name of a C-language function. \var{name} should include the
375 function name and the trailing parentheses.
376 \end{macrodesc}
377
378 \begin{macrodesc}{character}{\p{char}}
379 A character when discussing the character rather than a one-byte
380 string value. The character will be typeset as with \macro{samp}.
381 \end{macrodesc}
382
Fred Drake29a710f1999-11-10 22:51:18 +0000383 \begin{macrodesc}{citetitle}{\op{url}\p{title}}
384 A title for a referenced publication. If \var{url} is specified,
385 the title will be made into a hyperlink when formatted as HTML.
386 \end{macrodesc}
387
Fred Drake2f4bebd1999-04-28 16:43:11 +0000388 \begin{macrodesc}{class}{\p{name}}
389 A class name; a dotted name may be used.
390 \end{macrodesc}
391
392 \begin{macrodesc}{code}{\p{text}}
393 A short code fragment or literal constant value. Typically, it
394 should not include any spaces since no quotation marks are
395 added.
396 \end{macrodesc}
397
398 \begin{macrodesc}{constant}{\p{name}}
399 The name of a ``defined'' constant. This may be a C-language
400 \code{\#define} or a Python variable that is not intended to be
401 changed.
402 \end{macrodesc}
403
404 \begin{macrodesc}{ctype}{\p{name}}
405 The name of a C \keyword{typedef} or structure. For structures
406 defined without a \keyword{typedef}, use \code{\e ctype\{struct
407 struct_tag\}} to make it clear that the \keyword{struct} is
408 required.
409 \end{macrodesc}
410
411 \begin{macrodesc}{deprecated}{\p{version}\p{what to do}}
412 Declare whatever is being described as being deprecated starting
413 with release \var{version}. The text given as \var{what to do}
414 should recommend something to use instead.
415 \end{macrodesc}
416
417 \begin{macrodesc}{dfn}{\p{term}}
418 Mark the defining instance of \var{term} in the text. (No index
419 entries are generated.)
420 \end{macrodesc}
421
Fred Draked1fb7791999-05-17 16:33:54 +0000422 \begin{macrodesc}{e}{}
423 Produces a backslash. This is convenient in \macro{code} and
Fred Drake2b853412000-04-11 19:08:30 +0000424 similar macros, and is only defined there. The create a
425 backslash in ordinary text (such as the contents of the
426 \macro{file} macro), use the standard \macro{textbackslash} macro.
Fred Draked1fb7791999-05-17 16:33:54 +0000427 \end{macrodesc}
428
Fred Drake2f4bebd1999-04-28 16:43:11 +0000429 \begin{macrodesc}{email}{\p{address}}
430 An email address. Note that this is \emph{not} hyperlinked in
Fred Drakee15956b2000-04-03 04:51:13 +0000431 any of the possible output formats. The domain name portion of
432 the address should be lower case.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000433 \end{macrodesc}
434
435 \begin{macrodesc}{emph}{\p{text}}
436 Emphasized text; this will be presented in an italic font.
437 \end{macrodesc}
438
439 \begin{macrodesc}{envvar}{\p{name}}
440 An environment variable. Index entries are generated.
441 \end{macrodesc}
442
443 \begin{macrodesc}{exception}{\p{name}}
444 The name of an exception. A dotted name may be used.
445 \end{macrodesc}
446
447 \begin{macrodesc}{file}{\p{file or dir}}
448 The name of a file or directory. In the PDF and PostScript
449 outputs, single quotes and a font change are used to indicate
450 the file name, but no quotes are used in the HTML output.
451 \end{macrodesc}
452
453 \begin{macrodesc}{filenq}{\p{file or dir}}
454 Like \macro{file}, but single quotes are never used. This can
455 be used in conjunction with tables if a column will only contain
456 file or directory names.
457 \end{macrodesc}
458
459 \begin{macrodesc}{function}{\p{name}}
460 The name of a Python function; dotted names may be used.
461 \end{macrodesc}
462
463 \begin{macrodesc}{kbd}{\p{key sequence}}
464 Mark a sequence of keystrokes. What form \var{key sequence}
465 takes may depend on platform- or application-specific
466 conventions. For example, an \program{xemacs} key sequence
467 may be marked like \code{\e kbd\{C-x C-f\}}.
468 \end{macrodesc}
469
470 \begin{macrodesc}{keyword}{\p{name}}
471 The name of a keyword in a programming language.
472 \end{macrodesc}
473
474 \begin{macrodesc}{makevar}{\p{name}}
475 The name of a \program{make} variable.
476 \end{macrodesc}
477
478 \begin{macrodesc}{manpage}{\p{name}\p{section}}
479 A reference to a \UNIX{} manual page.
480 \end{macrodesc}
481
482 \begin{macrodesc}{member}{\p{name}}
483 The name of a data attribute of an object.
484 \end{macrodesc}
485
486 \begin{macrodesc}{method}{\p{name}}
487 The name of a method of an object. \var{name} should include the
488 method name and the trailing parentheses. A dotted name may be
489 used.
490 \end{macrodesc}
491
492 \begin{macrodesc}{mimetype}{\p{name}}
493 The name of a MIME type.
494 \end{macrodesc}
495
496 \begin{macrodesc}{module}{\p{name}}
Fred Drake2b853412000-04-11 19:08:30 +0000497 The name of a module; a dotted name may be used. This should
498 also be used for package names.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000499 \end{macrodesc}
500
501 \begin{macrodesc}{newsgroup}{\p{name}}
502 The name of a USENET newsgroup.
503 \end{macrodesc}
504
Fred Drake2f4bebd1999-04-28 16:43:11 +0000505 \begin{macrodesc}{program}{\p{name}}
506 The name of an executable program. This may differ from the
507 file name for the executable for some platforms. In particular,
508 the \file{.exe} (or other) extension should be omitted for DOS
509 and Windows programs.
510 \end{macrodesc}
511
Fred Drake29a710f1999-11-10 22:51:18 +0000512 \begin{macrodesc}{programopt}{\p{option}}
Fred Drakece444982000-04-11 18:52:52 +0000513 A command-line option to an executable program. Use this only
514 for ``shot'' options, and include the leading hyphen.
515 \end{macrodesc}
516
517 \begin{macrodesc}{longprogramopt}{\p{option}}
518 A long command-line option to an executable program. This
519 should only be used for long option names which will be prefixed
520 by two hyphens; the hyphens should not be provided as part of
521 \var{option}.
Fred Drake29a710f1999-11-10 22:51:18 +0000522 \end{macrodesc}
523
Fred Drake2f4bebd1999-04-28 16:43:11 +0000524 \begin{macrodesc}{refmodule}{\op{key}\p{name}}
525 Like \macro{module}, but create a hyperlink to the documentation
526 for the named module. Note that the corresponding
527 \macro{declaremodule} must be in the same document. If the
528 \macro{declaremodule} defines a module key different from the
529 module name, it must also be provided as \var{key} to the
530 \macro{refmodule} macro.
531 \end{macrodesc}
532
533 \begin{macrodesc}{regexp}{\p{string}}
534 Mark a regular expression.
535 \end{macrodesc}
536
537 \begin{macrodesc}{rfc}{\p{number}}
538 A reference to an Internet Request for Comments. This generates
539 appropriate index entries. The text \samp{RFC \var{number}} is
540 generated; in the HTML output, this text is a hyperlink to an
541 online copy of the specified RFC.
542 \end{macrodesc}
543
544 \begin{macrodesc}{samp}{\p{text}}
545 A short code sample, but possibly longer than would be given
546 using \macro{code}. Since quotation marks are added, spaces are
547 acceptable.
548 \end{macrodesc}
549
550 \begin{macrodesc}{strong}{\p{text}}
551 Strongly emphasized text; this will be presented using a bold
552 font.
553 \end{macrodesc}
554
Fred Draked1fb7791999-05-17 16:33:54 +0000555 \begin{macrodesc}{url}{\p{url}}
556 A URL (or URN). The URL will be presented as text. In the HTML
557 and PDF formatted versions, the URL will also be a hyperlink.
558 This can be used when referring to external resources. Note
559 that many characters are special to \LaTeX{} and this macro
560 does not always do the right thing. In particular, the tilde
561 character (\character{\~}) is mis-handled; encoding it as a
562 hex-sequence does work, use \samp{\%7e} in place of the tilde
563 character.
564 \end{macrodesc}
565
Fred Drake2f4bebd1999-04-28 16:43:11 +0000566 \begin{macrodesc}{var}{\p{name}}
567 The name of a variable or formal parameter in running text.
568 \end{macrodesc}
569
570 \begin{macrodesc}{version}{}
571 The version number for the documentation, as specified using
572 \macro{release} in the preamble.
573 \end{macrodesc}
Fred Drakeacffaee1999-03-16 16:09:13 +0000574
Fred Drakec26cc912000-05-02 17:43:44 +0000575 \begin{macrodesc}{versionadded}{\p{version}}
576 The version of Python which added the described feature to the
577 library or C API. This is typically added to the end of the
578 first paragraph of the description before any availability
579 notes. The location should be selected so the explanation makes
580 sense and may vary as needed.
581 \end{macrodesc}
582
583 \begin{macrodesc}{versionchanged}{\op{explanation}\p{version}}
584 The version of Python in which the named feature was changed in
585 some way (new parameters, changed side effects, etc.).
586 \var{explanation} should be a \emph{brief} explanation of the
587 change consisting of a non-capitalized sentence fragment; a
588 period will be appended by the formatting process.
589 This is typically added to the end of the first paragraph of the
590 description before any availability notes and after
591 \macro{versionadded}. The location should be selected so the
592 explanation makes sense and may vary as needed.
593 \end{macrodesc}
594
Fred Drakeacffaee1999-03-16 16:09:13 +0000595
596 \subsection{Module-specific Markup}
597
598 The markup described in this section is used to provide information
599 about a module being documented. A typical use of this markup
600 appears at the top of the section used to document a module. A
601 typical example might look like this:
602
603\begin{verbatim}
604\section{\module{spam} ---
605 Access to the SPAM facility}
606
607\declaremodule{extension}{spam}
Fred Drake2c4e0091999-03-29 14:55:55 +0000608 \platform{Unix}
Fred Drakeadade921999-04-22 13:05:27 +0000609\modulesynopsis{Access to the SPAM facility of \UNIX{}.}
Fred Drake2c4e0091999-03-29 14:55:55 +0000610\moduleauthor{Jane Doe}{jane.doe@frobnitz.org}
Fred Drakeacffaee1999-03-16 16:09:13 +0000611\end{verbatim}
612
Fred Drake7932ed02000-08-11 17:37:33 +0000613 Python packages\index{packages} --- collections of modules that can
614 be described as a unit --- are documented using the same markup as
615 modules. The name for a module in a package should be typed in
616 ``fully qualified'' form (i.e., it should include the package name).
617 For example, a module ``foo'' in package ``bar'' should be marked as
618 \samp{\e module\{bar.foo\}}, and the beginning of the reference
619 section would appear as:
620
621\begin{verbatim}
622\section{\module{bar.foo} ---
623 Module from the \module{bar} package}
624
625\declaremodule{extension}{bar.foo}
626\modulesynopsis{Nifty module from the \module{bar} package.}
627\moduleauthor{Jane Doe}{jane.doe@frobnitz.org}
628\end{verbatim}
629
630 Note that the name of a package is also marked using
631 \macro{module}.
632
Fred Drakeadade921999-04-22 13:05:27 +0000633 \begin{macrodesc}{declaremodule}{\op{key}\p{type}\p{name}}
Fred Drake87f768e1999-05-17 15:22:45 +0000634 Requires two parameters: module type (\samp{standard},
635 \samp{builtin}, \samp{extension}, or \samp{}), and the module
636 name. An optional parameter should be given as the basis for the
637 module's ``key'' used for linking to or referencing the section.
638 The ``key'' should only be given if the module's name contains any
639 underscores, and should be the name with the underscores stripped.
640 Note that the \var{type} parameter must be one of the values
641 listed above or an error will be printed. For modules which are
642 contained in packages, the fully-qualified name should be given as
643 \var{name} parameter. This should be the first thing after the
644 \macro{section} used to introduce the module.
Fred Drakeacffaee1999-03-16 16:09:13 +0000645 \end{macrodesc}
646
Fred Drakeadade921999-04-22 13:05:27 +0000647 \begin{macrodesc}{platform}{\p{specifier}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000648 Specifies the portability of the module. \var{specifier} is a
649 comma-separated list of keys that specify what platforms the
650 module is available on. The keys are short identifiers;
651 examples that are in use include \samp{IRIX}, \samp{Mac},
652 \samp{Windows}, and \samp{Unix}. It is important to use a key
Fred Drake7a737df1999-04-23 14:41:44 +0000653 which has already been used when applicable. This is used to
654 provide annotations in the Module Index and the HTML and GNU info
655 output.
Fred Drakeacffaee1999-03-16 16:09:13 +0000656 \end{macrodesc}
657
Fred Drakeadade921999-04-22 13:05:27 +0000658 \begin{macrodesc}{modulesynopsis}{\p{text}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000659 The \var{text} is a short, ``one line'' description of the
660 module that can be used as part of the chapter introduction.
Fred Drakeadade921999-04-22 13:05:27 +0000661 This is must be placed after \macro{declaremodule}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000662 The synopsis is used in building the contents of the table
663 inserted as the \macro{localmoduletable}. No text is
664 produced at the point of the markup.
665 \end{macrodesc}
666
Fred Drakeadade921999-04-22 13:05:27 +0000667 \begin{macrodesc}{moduleauthor}{\p{name}\p{email}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000668 This macro is used to encode information about who authored a
669 module. This is currently not used to generate output, but can be
670 used to help determine the origin of the module.
671 \end{macrodesc}
672
673
674 \subsection{Library-level Markup}
675
676 This markup is used when describing a selection of modules. For
Fred Drake698d5201999-11-10 15:54:57 +0000677 example, the \citetitle[../mac/mac.html]{Macintosh Library
678 Modules} document uses this to help provide an overview of the
679 modules in the collection, and many chapters in the
680 \citetitle[../lib/lib.html]{Python Library Reference} use it for
Fred Drakeacffaee1999-03-16 16:09:13 +0000681 the same purpose.
682
683 \begin{macrodesc}{localmoduletable}{}
Fred Drake2c4e0091999-03-29 14:55:55 +0000684 If a \file{.syn} file exists for the current
Fred Drakeacffaee1999-03-16 16:09:13 +0000685 chapter (or for the entire document in \code{howto} documents), a
686 \env{synopsistable} is created with the contents loaded from the
687 \file{.syn} file.
688 \end{macrodesc}
689
690
691 \subsection{Table Markup}
692
693 There are three general-purpose table environments defined which
694 should be used whenever possible. These environments are defined
695 to provide tables of specific widths and some convenience for
696 formatting. These environments are not meant to be general
697 replacements for the standard \LaTeX{} table environments, but can
698 be used for an advantage when the documents are processed using
699 the tools for Python documentation processing. In particular, the
700 generated HTML looks good! There is also an advantage for the
Fred Drake7a737df1999-04-23 14:41:44 +0000701 eventual conversion of the documentation to SGML (see section
Fred Drake2c4e0091999-03-29 14:55:55 +0000702 \ref{futures}, ``Future Directions'').
Fred Drakeacffaee1999-03-16 16:09:13 +0000703
704 Each environment is named \env{table\var{cols}}, where \var{cols}
705 is the number of columns in the table specified in lower-case
706 Roman numerals. Within each of these environments, an additional
707 macro, \macro{line\var{cols}}, is defined, where \var{cols}
708 matches the \var{cols} value of the corresponding table
Fred Drake2c4e0091999-03-29 14:55:55 +0000709 environment. These are supported for \var{cols} values of
710 \code{ii}, \code{iii}, and \code{iv}. These environments are all
711 built on top of the \env{tabular} environment.
Fred Drakeacffaee1999-03-16 16:09:13 +0000712
Fred Drake2b853412000-04-11 19:08:30 +0000713 Note that all tables in the standard Python documentation use
714 vertical lines between columns, and this must be specified in the
715 markup for each table. A general border around the outside of the
716 table is not used, but would be the responsibility of the
717 processor.
718
Fred Drakeadade921999-04-22 13:05:27 +0000719 \begin{envdesc}{tableii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000720 Create a two-column table using the \LaTeX{} column specifier
721 \var{colspec}. The column specifier should indicate vertical
722 bars between columns as appropriate for the specific table, but
723 should not specify vertical bars on the outside of the table
724 (that is considered a stylesheet issue). The \var{col1font}
725 parameter is used as a stylistic treatment of the first column
726 of the table: the first column is presented as
727 \code{\e\var{col1font}\{column1\}}. To avoid treating the first
Fred Drakeadade921999-04-22 13:05:27 +0000728 column specially, \var{col1font} may be \samp{textrm}. The
Fred Drakeacffaee1999-03-16 16:09:13 +0000729 column headings are taken from the values \var{heading1} and
730 \var{heading2}.
731 \end{envdesc}
732
Fred Drakeadade921999-04-22 13:05:27 +0000733 \begin{macrodesc}{lineii}{\p{column1}\p{column2}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000734 Create a single table row within a \env{tableii} environment.
735 The text for the first column will be generated by applying the
736 macro named by the \var{col1font} value when the \env{tableii}
737 was opened.
738 \end{macrodesc}
739
Fred Drakeadade921999-04-22 13:05:27 +0000740 \begin{envdesc}{tableiii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000741 Like the \env{tableii} environment, but with a third column.
742 The heading for the third column is given by \var{heading3}.
743 \end{envdesc}
744
Fred Drakeadade921999-04-22 13:05:27 +0000745 \begin{macrodesc}{lineiii}{\p{column1}\p{column2}\p{column3}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000746 Like the \macro{lineii} macro, but with a third column. The
747 text for the third column is given by \var{column3}.
748 \end{macrodesc}
749
Fred Drakeadade921999-04-22 13:05:27 +0000750 \begin{envdesc}{tableiv}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}\p{heading4}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000751 Like the \env{tableiii} environment, but with a fourth column.
752 The heading for the fourth column is given by \var{heading4}.
753 \end{envdesc}
754
Fred Drakeadade921999-04-22 13:05:27 +0000755 \begin{macrodesc}{lineiv}{\p{column1}\p{column2}\p{column3}\p{column4}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000756 Like the \macro{lineiii} macro, but with a fourth column. The
757 text for the fourth column is given by \var{column4}.
758 \end{macrodesc}
759
760
761 An additional table-like environment is \env{synopsistable}. The
762 table generated by this environment contains two columns, and each
763 row is defined by an alternate definition of
Fred Drakee15956b2000-04-03 04:51:13 +0000764 \macro{modulesynopsis}. This environment is not normally used by
765 authors, but is created by the \macro{localmoduletable} macro.
Fred Drakeacffaee1999-03-16 16:09:13 +0000766
767
768 \subsection{Reference List Markup \label{references}}
769
770 Many sections include a list of references to module documentation
771 or external documents. These lists are created using the
772 \env{seealso} environment. This environment defines some
773 additional macros to support creating reference entries in a
774 reasonable manner.
775
Fred Drake5802e482000-07-06 05:24:41 +0000776 The \env{seealso} environment is typically placed in a section
777 just before any sub-sections. This is done to ensure that
778 reference links related to the section are not hidden in a
779 subsection in the hypertext renditions of the documentation.
780
Fred Drakeacffaee1999-03-16 16:09:13 +0000781 \begin{envdesc}{seealso}{}
782 This environment creates a ``See also:'' heading and defines the
783 markup used to describe individual references.
784 \end{envdesc}
785
Fred Drake5802e482000-07-06 05:24:41 +0000786 For each of the following macros, \var{why} should be a complete
787 sentence, start with a capital letter (unless it starts with an
788 identifier, which should not be modified), and end with the
789 apropriate punctuation.
790
Fred Drakeadade921999-04-22 13:05:27 +0000791 \begin{macrodesc}{seemodule}{\op{key}\p{name}\p{why}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000792 Refer to another module. \var{why} should be a brief
793 explanation of why the reference may be interesting. The module
794 name is given in \var{name}, with the link key given in
795 \var{key} if necessary. In the HTML and PDF conversions, the
796 module name will be a hyperlink to the referred-to module.
Fred Drakeadade921999-04-22 13:05:27 +0000797 \strong{Note:} The module must be documented in the same
798 document (the corresponding \macro{declaremodule} is required).
Fred Drakeacffaee1999-03-16 16:09:13 +0000799 \end{macrodesc}
800
Fred Drake5802e482000-07-06 05:24:41 +0000801 \begin{macrodesc}{seerfc}{\p{number}\p{title}\p{why}}
802 Refer to an IETF Request for Comments (RFC). \var{number}
803 should be the official number assigned by the RFC Editor,
804 \var{title} should be the human-readable title of the RFC as
805 found in the official copy of the document, and \var{why} should
806 explain what's interesting about the RFC. This should be used
807 to refer the reader to RFCs which specify protocols or data
808 formats relevant to the material in the annotated section of the
809 documentation.
810 \end{macrodesc}
811
Fred Drakeadade921999-04-22 13:05:27 +0000812 \begin{macrodesc}{seetext}{\p{text}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000813 Add arbitrary text \var{text} to the ``See also:'' list. This
814 can be used to refer to off-line materials or on-line materials
Fred Drake5802e482000-07-06 05:24:41 +0000815 using the \macro{url} macro. This should consist of one or more
816 complete sentences.
817 \end{macrodesc}
818
819 \begin{macrodesc}{seeurl}{\p{url}\p{why}}
820 References to specific on-line resources should be given using
821 the \macro{seeurl} macro. No title is associated with the
822 reference, but the \var{why} text may include a title marked
823 using the \macro{citetitle} macro.
Fred Drakeacffaee1999-03-16 16:09:13 +0000824 \end{macrodesc}
825
826
827 \subsection{Index-generating Markup \label{indexing}}
828
829 Effective index generation for technical documents can be very
Fred Drakee15956b2000-04-03 04:51:13 +0000830 difficult, especially for someone familiar with the topic but not
Fred Drakeacffaee1999-03-16 16:09:13 +0000831 the creation of indexes. Much of the difficulty arises in the
832 area of terminology: including the terms an expert would use for a
833 concept is not sufficient. Coming up with the terms that a novice
Fred Drake2c4e0091999-03-29 14:55:55 +0000834 would look up is fairly difficult for an author who, typically, is
Fred Drakeacffaee1999-03-16 16:09:13 +0000835 an expert in the area she is writing on.
836
Fred Drake2c4e0091999-03-29 14:55:55 +0000837 The truly difficult aspects of index generation are not areas with
838 which the documentation tools can help. However, ease
Fred Drakee15956b2000-04-03 04:51:13 +0000839 of producing the index once content decisions are made is within
Fred Drakeacffaee1999-03-16 16:09:13 +0000840 the scope of the tools. Markup is provided which the processing
841 software is able to use to generate a variety of kinds of index
842 entry with minimal effort. Additionally, many of the environments
Fred Drake7a737df1999-04-23 14:41:44 +0000843 described in section \ref{info-units}, ``Information Units,'' will
Fred Drakeacffaee1999-03-16 16:09:13 +0000844 generate appropriate entries into the general and module indexes.
845
846 The following macro can be used to control the generation of index
Fred Drakeadade921999-04-22 13:05:27 +0000847 data, and should be used in the document preamble:
Fred Drakeacffaee1999-03-16 16:09:13 +0000848
849 \begin{macrodesc}{makemodindex}{}
Fred Drakeadade921999-04-22 13:05:27 +0000850 This should be used in the document preamble if a ``Module
Fred Drakeacffaee1999-03-16 16:09:13 +0000851 Index'' is desired for a document containing reference material
852 on many modules. This causes a data file
Fred Draked1fb7791999-05-17 16:33:54 +0000853 \code{lib\var{jobname}.idx} to be created from the
Fred Drakeacffaee1999-03-16 16:09:13 +0000854 \macro{declaremodule} macros. This file can be processed by the
855 \program{makeindex} program to generate a file which can be
856 \macro{input} into the document at the desired location of the
857 module index.
858 \end{macrodesc}
859
860 There are a number of macros that are useful for adding index
861 entries for particular concepts, many of which are specific to
862 programming languages or even Python.
863
Fred Drakeadade921999-04-22 13:05:27 +0000864 \begin{macrodesc}{bifuncindex}{\p{name}}
Fred Drakeec8b9051999-04-23 20:01:17 +0000865 Add an index entry referring to a built-in function named
866 \var{name}; parentheses should not be included after
Fred Drake2c4e0091999-03-29 14:55:55 +0000867 \var{name}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000868 \end{macrodesc}
869
Fred Drakeadade921999-04-22 13:05:27 +0000870 \begin{macrodesc}{exindex}{\p{exception}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000871 Add a reference to an exception named \var{exception}. The
872 exception may be either string- or class-based.
Fred Drakeacffaee1999-03-16 16:09:13 +0000873 \end{macrodesc}
874
Fred Drakeadade921999-04-22 13:05:27 +0000875 \begin{macrodesc}{kwindex}{\p{keyword}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000876 Add a reference to a language keyword (not a keyword parameter
877 in a function or method call).
Fred Drakeacffaee1999-03-16 16:09:13 +0000878 \end{macrodesc}
879
Fred Drakeadade921999-04-22 13:05:27 +0000880 \begin{macrodesc}{obindex}{\p{object type}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000881 Add an index entry for a built-in object type.
Fred Drakeacffaee1999-03-16 16:09:13 +0000882 \end{macrodesc}
883
Fred Drakeadade921999-04-22 13:05:27 +0000884 \begin{macrodesc}{opindex}{\p{operator}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000885 Add a reference to an operator, such as \samp{+}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000886 \end{macrodesc}
887
Fred Drakeadade921999-04-22 13:05:27 +0000888 \begin{macrodesc}{refmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000889 Add an index entry for module \var{module}; if \var{module}
890 contains an underscore, the optional parameter \var{key} should
891 be provided as the same string with underscores removed. An
892 index entry ``\var{module} (module)'' will be generated. This
893 is intended for use with non-standard modules implemented in
894 Python.
895 \end{macrodesc}
896
Fred Drakeadade921999-04-22 13:05:27 +0000897 \begin{macrodesc}{refexmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000898 As for \macro{refmodindex}, but the index entry will be
899 ``\var{module} (extension module).'' This is intended for use
900 with non-standard modules not implemented in Python.
901 \end{macrodesc}
902
Fred Drakeadade921999-04-22 13:05:27 +0000903 \begin{macrodesc}{refbimodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000904 As for \macro{refmodindex}, but the index entry will be
905 ``\var{module} (built-in module).'' This is intended for use
906 with standard modules not implemented in Python.
907 \end{macrodesc}
908
Fred Drakeadade921999-04-22 13:05:27 +0000909 \begin{macrodesc}{refstmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000910 As for \macro{refmodindex}, but the index entry will be
911 ``\var{module} (standard module).'' This is intended for use
912 with standard modules implemented in Python.
913 \end{macrodesc}
914
Fred Drakeadade921999-04-22 13:05:27 +0000915 \begin{macrodesc}{stindex}{\p{statement}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000916 Add an index entry for a statement type, such as \keyword{print}
Fred Drakeadade921999-04-22 13:05:27 +0000917 or \keyword{try}/\keyword{finally}.
918
919 XXX Need better examples of difference from \macro{kwindex}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000920 \end{macrodesc}
921
922
923 Additional macros are provided which are useful for conveniently
924 creating general index entries which should appear at many places
925 in the index by rotating a list of words. These are simple macros
926 that simply use \macro{index} to build some number of index
927 entries. Index entries build using these macros contain both
928 primary and secondary text.
929
Fred Drakeadade921999-04-22 13:05:27 +0000930 \begin{macrodesc}{indexii}{\p{word1}\p{word2}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000931 Build two index entries. This is exactly equivalent to using
932 \code{\e index\{\var{word1}!\var{word2}\}} and
933 \code{\e index\{\var{word2}!\var{word1}\}}.
934 \end{macrodesc}
935
Fred Drakeadade921999-04-22 13:05:27 +0000936 \begin{macrodesc}{indexiii}{\p{word1}\p{word2}\p{word3}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000937 Build three index entries. This is exactly equivalent to using
938 \code{\e index\{\var{word1}!\var{word2} \var{word3}\}},
939 \code{\e index\{\var{word2}!\var{word3}, \var{word1}\}}, and
940 \code{\e index\{\var{word3}!\var{word1} \var{word2}\}}.
941 \end{macrodesc}
942
Fred Drakeadade921999-04-22 13:05:27 +0000943 \begin{macrodesc}{indexiv}{\p{word1}\p{word2}\p{word3}\p{word4}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000944 Build four index entries. This is exactly equivalent to using
945 \code{\e index\{\var{word1}!\var{word2} \var{word3} \var{word4}\}},
946 \code{\e index\{\var{word2}!\var{word3} \var{word4}, \var{word1}\}},
947 \code{\e index\{\var{word3}!\var{word4}, \var{word1} \var{word2}\}},
948 and
949 \code{\e index\{\var{word4}!\var{word1} \var{word2} \var{word3}\}}.
950 \end{macrodesc}
951
952
953\section{Special Names}
954
955 Many special names are used in the Python documentation, including
956 the names of operating systems, programming languages, standards
957 bodies, and the like. Many of these were assigned \LaTeX{} macros
958 at some point in the distant past, and these macros lived on long
959 past their usefulness. In the current markup, these entities are
960 not assigned any special markup, but the preferred spellings are
961 given here to aid authors in maintaining the consistency of
962 presentation in the Python documentation.
963
964 \begin{description}
965 \item[POSIX]
966 The name assigned to a particular group of standards. This is
967 always uppercase.
968
969 \item[Python]
970 The name of our favorite programming language is always
971 capitalized.
Fred Drake42934682000-04-03 15:00:28 +0000972
973 \item[Unicode]
974 The name of a character set and matching encoding. This is
975 always written capitalized.
Fred Drakeacffaee1999-03-16 16:09:13 +0000976 \end{description}
977
978
979\section{Processing Tools}
980
981 \subsection{External Tools}
982
983 Many tools are needed to be able to process the Python
984 documentation if all supported formats are required. This
Fred Drakeadade921999-04-22 13:05:27 +0000985 section lists the tools used and when each is required. Consult
986 the \file{Doc/README} file to see if there are specific version
987 requirements for any of these.
Fred Drakeacffaee1999-03-16 16:09:13 +0000988
989 \begin{description}
990 \item[\program{dvips}]
991 This program is a typical part of \TeX{} installations. It is
992 used to generate PostScript from the ``device independent''
Fred Drake2c4e0091999-03-29 14:55:55 +0000993 \file{.dvi} files. It is needed for the conversion to
Fred Drakeacffaee1999-03-16 16:09:13 +0000994 PostScript.
995
996 \item[\program{emacs}]
997 Emacs is the kitchen sink of programmers' editors, and a damn
998 fine kitchen sink it is. It also comes with some of the
999 processing needed to support the proper menu structures for
1000 Texinfo documents when an info conversion is desired. This is
Fred Drake2c4e0091999-03-29 14:55:55 +00001001 needed for the info conversion. Using \program{xemacs}
Fred Drakeacffaee1999-03-16 16:09:13 +00001002 instead of FSF \program{emacs} may lead to instability in the
1003 conversion, but that's because nobody seems to maintain the
1004 Emacs Texinfo code in a portable manner.
1005
1006 \item[\program{latex}]
1007 This is a world-class typesetter by Donald Knuth. It is used
1008 for the conversion to PostScript, and is needed for the HTML
1009 conversion as well (\LaTeX2HTML requires one of the
1010 intermediate files it creates).
1011
1012 \item[\program{latex2html}]
1013 Probably the longest Perl script anyone ever attempted to
1014 maintain. This converts \LaTeX{} documents to HTML documents,
1015 and does a pretty reasonable job. It is required for the
1016 conversions to HTML and GNU info.
1017
1018 \item[\program{lynx}]
1019 This is a text-mode Web browser which includes an
1020 HTML-to-plain text conversion. This is used to convert
1021 \code{howto} documents to text.
1022
1023 \item[\program{make}]
1024 Just about any version should work for the standard documents,
1025 but GNU \program{make} is required for the experimental
1026 processes in \file{Doc/tools/sgmlconv/}, at least while
1027 they're experimental.
1028
1029 \item[\program{makeindex}]
1030 This is a standard program for converting \LaTeX{} index data
1031 to a formatted index; it should be included with all \LaTeX{}
1032 installations. It is needed for the PDF and PostScript
1033 conversions.
1034
1035 \item[\program{makeinfo}]
1036 GNU \program{makeinfo} is used to convert Texinfo documents to
1037 GNU info files. Since Texinfo is used as an intermediate
1038 format in the info conversion, this program is needed in that
1039 conversion.
1040
1041 \item[\program{pdflatex}]
1042 pdf\TeX{} is a relatively new variant of \TeX, and is used to
1043 generate the PDF version of the manuals. It is typically
1044 installed as part of most of the large \TeX{} distributions.
Fred Drake7a737df1999-04-23 14:41:44 +00001045 \program{pdflatex} is pdf\TeX{} using the \LaTeX{} format.
Fred Drakeacffaee1999-03-16 16:09:13 +00001046
1047 \item[\program{perl}]
1048 Perl is required for \LaTeX2HTML{} and one of the scripts used
1049 to post-process \LaTeX2HTML output, as well as the
Fred Drake2c4e0091999-03-29 14:55:55 +00001050 HTML-to-Texinfo conversion. This is required for
Fred Drakeacffaee1999-03-16 16:09:13 +00001051 the HTML and GNU info conversions.
1052
1053 \item[\program{python}]
1054 Python is used for many of the scripts in the
1055 \file{Doc/tools/} directory; it is required for all
1056 conversions. This shouldn't be a problem if you're interested
1057 in writing documentation for Python!
1058 \end{description}
1059
1060
1061 \subsection{Internal Tools}
1062
1063 This section describes the various scripts that are used to
1064 implement various stages of document processing or to orchestrate
Fred Drake2c4e0091999-03-29 14:55:55 +00001065 entire build sequences. Most of these tools are only useful
Fred Drakeacffaee1999-03-16 16:09:13 +00001066 in the context of building the standard documentation, but some
1067 are more general.
1068
1069 \begin{description}
1070 \item[\program{mkhowto}]
Fred Drake87f768e1999-05-17 15:22:45 +00001071 This is the primary script used to format third-party
1072 documents. It contains all the logic needed to ``get it
1073 right.'' The proper way to use this script is to make a
1074 symbolic link to it or run it in place; the actual script file
1075 must be stored as part of the documentation source tree,
1076 though it may be used to format documents outside the
Fred Drakece444982000-04-11 18:52:52 +00001077 tree. Use \program{mkhowto} \longprogramopt{help}
Fred Draked290c101999-11-09 18:03:00 +00001078 for a list of
Fred Draked2a727f1999-05-27 21:45:54 +00001079 command line options.
Fred Drake87f768e1999-05-17 15:22:45 +00001080
Fred Draked1fb7791999-05-17 16:33:54 +00001081 \program{mkhowto} can be used for both \code{howto} and
1082 \code{manual} class documents. (For the later, be sure to get
1083 the latest version from the Python CVS repository rather than
1084 the version distributed in the \file{latex-1.5.2.tgz} source
1085 archive.)
1086
Fred Drake87f768e1999-05-17 15:22:45 +00001087 XXX Need more here.
Fred Drakeacffaee1999-03-16 16:09:13 +00001088 \end{description}
1089
1090
1091\section{Future Directions \label{futures}}
1092
1093 The history of the Python documentation is full of changes, most of
1094 which have been fairly small and evolutionary. There has been a
1095 great deal of discussion about making large changes in the markup
1096 languages and tools used to process the documentation. This section
1097 deals with the nature of the changes and what appears to be the most
1098 likely path of future development.
1099
1100 \subsection{Structured Documentation \label{structured}}
1101
1102 Most of the small changes to the \LaTeX{} markup have been made
1103 with an eye to divorcing the markup from the presentation, making
1104 both a bit more maintainable. Over the course of 1998, a large
1105 number of changes were made with exactly this in mind; previously,
1106 changes had been made but in a less systematic manner and with
1107 more concern for not needing to update the existing content. The
1108 result has been a highly structured and semantically loaded markup
1109 language implemented in \LaTeX. With almost no basic \TeX{} or
1110 \LaTeX{} markup in use, however, the markup syntax is about the
1111 only evidence of \LaTeX{} in the actual document sources.
1112
1113 One side effect of this is that while we've been able to use
1114 standard ``engines'' for manipulating the documents, such as
1115 \LaTeX{} and \LaTeX2HTML, most of the actual transformations have
Fred Drake7a737df1999-04-23 14:41:44 +00001116 been created specifically for Python. The \LaTeX{} document
1117 classes and \LaTeX2HTML support are both complete implementations
1118 of the specific markup designed for these documents.
Fred Drakeacffaee1999-03-16 16:09:13 +00001119
1120 Combining highly customized markup with the somewhat esoteric
1121 systems used to process the documents leads us to ask some
1122 questions: Can we do this more easily? and, Can we do this
1123 better? After a great deal of discussion with the community, we
1124 have determined that actively pursuing modern structured
Fred Drake2c4e0091999-03-29 14:55:55 +00001125 documentation systems is worth some investment of time.
Fred Drakeacffaee1999-03-16 16:09:13 +00001126
1127 There appear to be two real contenders in this arena: the Standard
1128 General Markup Language (SGML), and the Extensible Markup Language
1129 (XML). Both of these standards have advantages and disadvantages,
1130 and many advantages are shared.
1131
1132 SGML offers advantages which may appeal most to authors,
1133 especially those using ordinary text editors. There are also
1134 additional abilities to define content models. A number of
1135 high-quality tools with demonstrated maturity is available, but
1136 most are not free; for those which are, portability issues remain
1137 a problem.
1138
1139 The advantages of XML include the availability of a large number
1140 of evolving tools. Unfortunately, many of the associated
1141 standards are still evolving, and the tools will have to follow
1142 along. This means that developing a robust tool set that uses
1143 more than the basic XML 1.0 recommendation is not possible in the
1144 short term. The promised availability of a wide variety of
1145 high-quality tools which support some of the most important
1146 related standards is not immediate. Many tools are likely to be
1147 free.
1148
Fred Drakeadade921999-04-22 13:05:27 +00001149 XXX Eventual migration to SGML/XML.
Fred Drakeacffaee1999-03-16 16:09:13 +00001150
1151 \subsection{Discussion Forums \label{discussion}}
1152
1153 Discussion of the future of the Python documentation and related
Fred Drake7a737df1999-04-23 14:41:44 +00001154 topics takes place in the Documentation Special Interest Group, or
1155 ``Doc-SIG.'' Information on the group, including mailing list
1156 archives and subscription information, is available at
Fred Drakeacffaee1999-03-16 16:09:13 +00001157 \url{http://www.python.org/sigs/doc-sig/}. The SIG is open to all
1158 interested parties.
1159
1160 Comments and bug reports on the standard documents should be sent
1161 to \email{python-docs@python.org}. This may include comments
Fred Drakeadade921999-04-22 13:05:27 +00001162 about formatting, content, grammatical and spelling errors, or
Fred Draked1fb7791999-05-17 16:33:54 +00001163 this document. You can also send comments on this document
1164 directly to the author at \email{fdrake@acm.org}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001165
1166\end{document}