Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1 | \documentclass{howto} |
| 2 | \usepackage{ltxmarkup} |
| 3 | |
| 4 | \title{Documenting Python} |
| 5 | |
| 6 | \input{boilerplate} |
| 7 | |
Fred Drake | c7c9a64 | 1999-04-28 18:24:02 +0000 | [diff] [blame] | 8 | % Now override the stuff that includes author information; |
| 9 | % Guido did *not* write this one! |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 10 | |
| 11 | \author{Fred L. Drake, Jr.} |
| 12 | \authoraddress{ |
Fred Drake | 8fdb638 | 2000-10-28 04:08:38 +0000 | [diff] [blame] | 13 | PythonLabs \\ |
| 14 | E-mail: \email{fdrake@acm.org} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 15 | } |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 16 | |
| 17 | |
| 18 | \begin{document} |
| 19 | |
| 20 | \maketitle |
| 21 | |
| 22 | \begin{abstract} |
| 23 | \noindent |
Fred Drake | 0299749 | 2000-09-21 05:26:43 +0000 | [diff] [blame] | 24 | The Python language has a substantial body of |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 25 | documentation, much of it contributed by various authors. The markup |
| 26 | used for the Python documentation is based on \LaTeX{} and requires a |
| 27 | significant set of macros written specifically for documenting Python. |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 28 | This document describes the macros introduced to support Python |
| 29 | documentation and how they should be used to support a wide range of |
| 30 | output formats. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 31 | |
| 32 | This document describes the document classes and special markup used |
| 33 | in the Python documentation. Authors may use this guide, in |
| 34 | conjunction with the template files provided with the |
| 35 | distribution, 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 Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 51 | 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 Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 55 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 56 | This document is aimed at authors and potential authors of |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 57 | 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 Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 63 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 64 | 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 Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 67 | document types, reference material on the markup defined in the |
| 68 | document classes, a list of the external tools needed for processing |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 69 | documents, and reference material on the tools provided with the |
| 70 | documentation resources. At the end, there is also a section |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 71 | discussing future directions for the Python documentation and where |
| 72 | to turn for more information. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 73 | |
| 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 Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 85 | source distribution as the top-level directory \file{Doc/}, but |
| 86 | are not dependent on the Python source distribution in any way. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 87 | |
| 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 |
Fred Drake | 0299749 | 2000-09-21 05:26:43 +0000 | [diff] [blame] | 96 | separate directory. These directories are given short |
| 97 | names which vaguely indicate the document in each: |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 98 | |
| 99 | \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Document Title} |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 100 | \lineii{api/} |
| 101 | {\citetitle[../api/api.html]{The Python/C API}} |
| 102 | \lineii{dist/} |
| 103 | {\citetitle[../dist/dist.html]{Distributing Python Modules}} |
| 104 | \lineii{doc/} |
| 105 | {\citetitle[../doc/doc.html]{Documenting Python}} |
| 106 | \lineii{ext/} |
| 107 | {\citetitle[../ext/ext.html]{Extending and Embedding the Python Interpreter}} |
| 108 | \lineii{inst/} |
| 109 | {\citetitle[../inst/inst.html]{Installing Python Modules}} |
| 110 | \lineii{lib/} |
| 111 | {\citetitle[../lib/lib.html]{Python Library Reference}} |
| 112 | \lineii{mac/} |
| 113 | {\citetitle[../mac/mac.html]{Macintosh Module Reference}} |
| 114 | \lineii{ref/} |
| 115 | {\citetitle[../ref/ref.html]{Python Reference Manual}} |
| 116 | \lineii{tut/} |
| 117 | {\citetitle[../tut/tut.html]{Python Tutorial}} |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 118 | \end{tableii} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 119 | |
| 120 | \term{Format-Specific Output} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 121 | Most output formats have a directory which contains a |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 122 | \file{Makefile} which controls the generation of that format |
| 123 | and provides storage for the formatted documents. The only |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 124 | variations within this category are the Portable Document |
| 125 | Format (PDF) and PostScript versions are placed in the |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 126 | directories \file{paper-a4/} and \file{paper-letter/} (this |
| 127 | causes all the temporary files created by \LaTeX{} to be kept |
| 128 | in the same place for each paper size, where they can be more |
| 129 | easily ignored). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 130 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 131 | \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Output Formats} |
| 132 | \lineii{html/}{HTML output} |
| 133 | \lineii{info/}{GNU info output} |
| 134 | \lineii{paper-a4/}{PDF and PostScript, A4 paper} |
| 135 | \lineii{paper-letter/}{PDF and PostScript, US-Letter paper} |
| 136 | \end{tableii} |
| 137 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 138 | \term{Supplemental Files} |
| 139 | Some additional directories are used to store supplemental |
| 140 | files used for the various processes. Directories are |
| 141 | included for the shared \LaTeX{} document classes, the |
| 142 | \LaTeX2HTML support, template files for various document |
| 143 | components, and the scripts used to perform various steps in |
| 144 | the formatting processes. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 145 | |
| 146 | \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Contents} |
| 147 | \lineii{perl/}{Support for \LaTeX2HTML processing} |
| 148 | \lineii{templates/}{Example files for source documents} |
| 149 | \lineii{texinputs/}{Style implementation for \LaTeX} |
| 150 | \lineii{tools/}{Custom processing scripts} |
| 151 | \end{tableii} |
| 152 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 153 | \end{definitions} |
| 154 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 155 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 156 | \section{\LaTeX{} Primer \label{latex-primer}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 157 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 158 | This section is a brief introduction to \LaTeX{} concepts and |
| 159 | syntax, to provide authors enough information to author documents |
| 160 | productively without having to become ``\TeX{}nicians.'' |
| 161 | |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 162 | Perhaps the most important concept to keep in mind while marking up |
Fred Drake | 0299749 | 2000-09-21 05:26:43 +0000 | [diff] [blame] | 163 | Python documentation is that while \TeX{} is unstructured, \LaTeX{} was |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 164 | designed as a layer on top of \TeX{} which specifically supports |
| 165 | structured markup. The Python-specific markup is intended to extend |
| 166 | the structure provided by standard \LaTeX{} document classes to |
| 167 | support additional information specific to Python. |
| 168 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 169 | \LaTeX{} documents contain two parts: the preamble and the body. |
| 170 | The preamble is used to specify certain metadata about the document |
| 171 | itself, such as the title, the list of authors, the date, and the |
| 172 | \emph{class} the document belongs to. Additional information used |
| 173 | to control index generation and the use of bibliographic databases |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 174 | can also be placed in the preamble. For most authors, the preamble |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 175 | can be most easily created by copying it from an existing document |
| 176 | and modifying a few key pieces of information. |
| 177 | |
| 178 | The \dfn{class} of a document is used to place a document within a |
| 179 | broad category of documents and set some fundamental formatting |
| 180 | properties. For Python documentation, two classes are used: the |
| 181 | \code{manual} class and the \code{howto} class. These classes also |
| 182 | define the additional markup used to document Python concepts and |
| 183 | structures. Specific information about these classes is provided in |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 184 | section \ref{classes}, ``Document Classes,'' below. The first thing |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 185 | in the preamble is the declaration of the document's class. |
| 186 | |
| 187 | After the class declaration, a number of \emph{macros} are used to |
| 188 | provide further information about the document and setup any |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 189 | additional markup that is needed. No output is generated from the |
| 190 | preamble; it is an error to include free text in the preamble |
| 191 | because it would cause output. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 192 | |
| 193 | The document body follows the preamble. This contains all the |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 194 | printed components of the document marked up structurally. Generic |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 195 | \LaTeX{} structures include hierarchical sections, numbered and |
| 196 | bulleted lists, and special structures for the document abstract and |
| 197 | indexes. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 198 | |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 199 | \subsection{Syntax} |
| 200 | |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 201 | There are some things that an author of Python documentation needs |
| 202 | to know about \LaTeX{} syntax. |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 203 | |
| 204 | A \dfn{comment} is started by the ``percent'' character |
| 205 | (\character{\%}) and continues through the end of the line and all |
| 206 | leading whitespace on the following line. This is a little |
| 207 | different from any programming language I know of, so an example |
| 208 | is in order: |
| 209 | |
| 210 | \begin{verbatim} |
| 211 | This is text.% comment |
| 212 | This is more text. % another comment |
| 213 | Still more text. |
| 214 | \end{verbatim} |
| 215 | |
| 216 | The first non-comment character following the first comment is the |
| 217 | letter \character{T} on the second line; the leading whitespace on |
| 218 | that line is consumed as part of the first comment. This means |
| 219 | that there is no space between the first and second sentences, so |
| 220 | the period and letter \character{T} will be directly adjacent in |
| 221 | the typeset document. |
| 222 | |
| 223 | Note also that though the first non-comment character after the |
| 224 | second comment is the letter \character{S}, there is whitespace |
| 225 | preceding the comment, so the two sentences are separated as |
| 226 | expected. |
| 227 | |
| 228 | A \dfn{group} is an enclosure for a collection of text and |
| 229 | commands which encloses the formatting context and constrains the |
| 230 | scope of any changes to that context made by commands within the |
| 231 | group. Groups can be nested hierarchically. The formatting |
| 232 | context includes the font and the definition of additional macros |
| 233 | (or overrides of macros defined in outer groups). Syntactically, |
| 234 | groups are enclosed in braces: |
| 235 | |
| 236 | \begin{verbatim} |
| 237 | {text in a group} |
| 238 | \end{verbatim} |
| 239 | |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 240 | An alternate syntax for a group using brackets, \code{[...]}, is |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 241 | used by macros and environment constructors which take optional |
| 242 | parameters; brackets do not normally hold syntactic significance. |
| 243 | A degenerate group, containing only one atomic bit of content, |
| 244 | does not need to have an explicit group, unless it is required to |
| 245 | avoid ambiguity. Since Python tends toward the explicit, groups |
| 246 | are also made explicit in the documentation markup. |
| 247 | |
| 248 | Groups are used only sparingly in the Python documentation, except |
| 249 | for their use in marking parameters to macros and environments. |
| 250 | |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 251 | A \dfn{macro} is usually a simple construct which is identified by |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 252 | name and can take some number of parameters. In normal \LaTeX{} |
| 253 | usage, one of these can be optional. The markup is introduced |
| 254 | using the backslash character (\character{\e}), and the name is |
| 255 | given by alphabetic characters (no digits, hyphens, or |
| 256 | underscores). Required parameters should be marked as a group, |
| 257 | and optional parameters should be marked using the alternate |
| 258 | syntax for a group. |
| 259 | |
| 260 | For example, a macro named ``foo'' which takes a single parameter |
| 261 | would appear like this: |
| 262 | |
| 263 | \begin{verbatim} |
| 264 | \name{parameter} |
| 265 | \end{verbatim} |
| 266 | |
| 267 | A macro which takes an optional parameter would be typed like this |
| 268 | when the optional paramter is given: |
| 269 | |
| 270 | \begin{verbatim} |
| 271 | \name[optional] |
| 272 | \end{verbatim} |
| 273 | |
| 274 | If both optional and required parameters are to be required, it |
| 275 | looks like this: |
| 276 | |
| 277 | \begin{verbatim} |
| 278 | \name[optional]{required} |
| 279 | \end{verbatim} |
| 280 | |
| 281 | A macro name may be followed by a space or newline; a space |
| 282 | between the macro name and any parameters will be consumed, but |
| 283 | this usage is not practiced in the Python documentation. Such a |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 284 | space is still consumed if there are no parameters to the macro, |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 285 | in which case inserting an empty group (\code{\{\}}) or explicit |
| 286 | word space (\samp{\e\ }) immediately after the macro name helps to |
| 287 | avoid running the expansion of the macro into the following text. |
| 288 | Macros which take no parameters but which should not be followed |
| 289 | by a word space do not need special treatment if the following |
| 290 | character in the document source if not a name character (such as |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 291 | punctuation). |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 292 | |
| 293 | Each line of this example shows an appropriate way to write text |
| 294 | which includes a macro which takes no parameters: |
| 295 | |
| 296 | \begin{verbatim} |
| 297 | This \UNIX{} is followed by a space. |
| 298 | This \UNIX\ is also followed by a space. |
| 299 | \UNIX, followed by a comma, needs no additional markup. |
| 300 | \end{verbatim} |
| 301 | |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 302 | An \dfn{environment} is a larger construct than a macro, and can |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 303 | be used for things with more content than would conveniently fit |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 304 | in a macro parameter. They are primarily used when formatting |
| 305 | parameters need to be changed before and after a large chunk of |
| 306 | content, but the content itself needs to be highly flexible. Code |
| 307 | samples are presented using an environment, and descriptions of |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 308 | functions, methods, and classes are also marked using environments. |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 309 | |
| 310 | Since the content of an environment is free-form and can consist |
| 311 | of several paragraphs, they are actually marked using a pair of |
| 312 | macros: \macro{begin} and \macro{end}. These macros both take the |
| 313 | name of the environment as a parameter. An example is the |
| 314 | environment used to mark the abstract of a document: |
| 315 | |
| 316 | \begin{verbatim} |
| 317 | \begin{abstract} |
| 318 | This is the text of the abstract. It concisely explains what |
| 319 | information is found in the document. |
| 320 | |
| 321 | It can consist of multiple paragraphs. |
| 322 | \end{abstract} |
| 323 | \end{verbatim} |
| 324 | |
| 325 | An environment can also have required and optional parameters of |
| 326 | its own. These follow the parameter of the \macro{begin} macro. |
| 327 | This example shows an environment which takes a single required |
| 328 | parameter: |
| 329 | |
| 330 | \begin{verbatim} |
Fred Drake | 2bbc697 | 2001-03-28 16:51:20 +0000 | [diff] [blame] | 331 | \begin{datadesc}{controlnames} |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 332 | A 33-element string array that contains the \ASCII{} mnemonics for |
| 333 | the thirty-two \ASCII{} control characters from 0 (NUL) to 0x1f |
| 334 | (US), in order, plus the mnemonic \samp{SP} for the space character. |
| 335 | \end{datadesc} |
| 336 | \end{verbatim} |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 337 | |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 338 | There are a number of less-used marks in \LaTeX{} which are used |
| 339 | to enter non-\ASCII{} characters, especially those used in |
| 340 | European names. Given that these are often used adjacent to other |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 341 | characters, the markup required to produce the proper character |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 342 | may need to be followed by a space or an empty group, or the |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 343 | markup can be enclosed in a group. Some which are found in Python |
| 344 | documentation are: |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 345 | |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 346 | \begin{tableii}{c|l}{textrm}{Character}{Markup} |
| 347 | \lineii{\c c}{\code{\e c c}} |
| 348 | \lineii{\"o}{\code{\e"o}} |
| 349 | \lineii{\o}{\code{\e o}} |
| 350 | \end{tableii} |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 351 | |
| 352 | |
| 353 | \subsection{Hierarchical Structure} |
| 354 | |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 355 | \LaTeX{} expects documents to be arranged in a conventional, |
| 356 | hierarchical way, with chapters, sections, sub-sections, |
| 357 | appendixes, and the like. These are marked using macros rather |
| 358 | than environments, probably because the end of a section can be |
| 359 | safely inferred when a section of equal or higher level starts. |
| 360 | |
| 361 | There are six ``levels'' of sectioning in the document classes |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 362 | used for Python documentation, and the deepest two |
| 363 | levels\footnote{The deepest levels have the highest numbers in the |
| 364 | table.} are not used. The levels are: |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 365 | |
| 366 | \begin{tableiii}{c|l|c}{textrm}{Level}{Macro Name}{Notes} |
| 367 | \lineiii{1}{\macro{chapter}}{(1)} |
| 368 | \lineiii{2}{\macro{section}}{} |
| 369 | \lineiii{3}{\macro{subsection}}{} |
Fred Drake | b7a52c9 | 2000-11-27 20:10:18 +0000 | [diff] [blame] | 370 | \lineiii{4}{\macro{subsubsection}}{} |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 371 | \lineiii{5}{\macro{paragraph}}{(2)} |
| 372 | \lineiii{6}{\macro{subparagraph}}{} |
| 373 | \end{tableiii} |
| 374 | |
| 375 | \noindent |
| 376 | Notes: |
| 377 | |
| 378 | \begin{description} |
| 379 | \item[(1)] |
| 380 | Only used for the \code{manual} documents, as described in |
| 381 | section \ref{classes}, ``Document Classes.'' |
| 382 | \item[(2)] |
| 383 | Not the same as a paragraph of text; nobody seems to use this. |
| 384 | \end{description} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 385 | |
| 386 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 387 | \section{Document Classes \label{classes}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 388 | |
| 389 | Two \LaTeX{} document classes are defined specifically for use with |
| 390 | the Python documentation. The \code{manual} class is for large |
| 391 | documents which are sectioned into chapters, and the \code{howto} |
| 392 | class is for smaller documents. |
| 393 | |
| 394 | The \code{manual} documents are larger and are used for most of the |
| 395 | standard documents. This document class is based on the standard |
| 396 | \LaTeX{} \code{report} class and is formatted very much like a long |
Fred Drake | 698d520 | 1999-11-10 15:54:57 +0000 | [diff] [blame] | 397 | technical report. The \citetitle[../ref/ref.html]{Python Reference |
| 398 | Manual} is a good example of a \code{manual} document, and the |
| 399 | \citetitle[../lib/lib.html]{Python Library Reference} is a large |
| 400 | example. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 401 | |
| 402 | The \code{howto} documents are shorter, and don't have the large |
| 403 | structure of the \code{manual} documents. This class is based on |
| 404 | the standard \LaTeX{} \code{article} class and is formatted somewhat |
| 405 | like the Linux Documentation Project's ``HOWTO'' series as done |
| 406 | originally using the LinuxDoc software. The original intent for the |
| 407 | document class was that it serve a similar role as the LDP's HOWTO |
| 408 | series, but the applicability of the class turns out to be somewhat |
Fred Drake | 0299749 | 2000-09-21 05:26:43 +0000 | [diff] [blame] | 409 | broader. This class is used for ``how-to'' documents (this |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 410 | document is an example) and for shorter reference manuals for small, |
| 411 | fairly cohesive module libraries. Examples of the later use include |
Fred Drake | 698d520 | 1999-11-10 15:54:57 +0000 | [diff] [blame] | 412 | the standard \citetitle[../mac/mac.html]{Macintosh Library Modules} |
| 413 | and |
Fred Drake | 6a547c7 | 2000-09-15 22:11:24 +0000 | [diff] [blame] | 414 | \citetitle[http://starship.python.net/crew/fdrake/manuals/krb5py/krb5py.html]{Using |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 415 | Kerberos from Python}, which contains reference material for an |
| 416 | extension package. These documents are roughly equivalent to a |
| 417 | single chapter from a larger work. |
| 418 | |
| 419 | |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 420 | \section{Special Markup Constructs} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 421 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 422 | The Python document classes define a lot of new environments and |
| 423 | macros. This section contains the reference material for these |
| 424 | facilities. |
| 425 | |
Fred Drake | af2b714 | 2000-09-14 20:11:05 +0000 | [diff] [blame] | 426 | \subsection{Markup for the Preamble \label{preamble-info}} |
| 427 | |
| 428 | \begin{macrodesc}{release}{\p{ver}} |
| 429 | Set the version number for the software described in the |
| 430 | document. |
| 431 | \end{macrodesc} |
| 432 | |
| 433 | \begin{macrodesc}{setshortversion}{\p{sver}} |
| 434 | Specify the ``short'' version number of the documented software |
| 435 | to be \var{sver}. |
| 436 | \end{macrodesc} |
| 437 | |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 438 | \subsection{Meta-information Markup \label{meta-info}} |
| 439 | |
| 440 | \begin{macrodesc}{sectionauthor}{\p{author}\p{email}} |
| 441 | Identifies the author of the current section. \var{author} |
| 442 | should be the author's name such that it can be used for |
| 443 | presentation (though it isn't), and \var{email} should be the |
| 444 | author's email address. The domain name portion of |
| 445 | the address should be lower case. |
| 446 | |
| 447 | No presentation is generated from this markup, but it is used to |
| 448 | help keep track of contributions. |
| 449 | \end{macrodesc} |
| 450 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 451 | \subsection{Information Units \label{info-units}} |
| 452 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 453 | XXX Explain terminology, or come up with something more ``lay.'' |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 454 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 455 | There are a number of environments used to describe specific |
| 456 | features provided by modules. Each environment requires |
| 457 | parameters needed to provide basic information about what is being |
| 458 | described, and the environment content should be the description. |
| 459 | Most of these environments make entries in the general index (if |
| 460 | one is being produced for the document); if no index entry is |
| 461 | desired, non-indexing variants are available for many of these |
| 462 | environments. The environments have names of the form |
| 463 | \code{\var{feature}desc}, and the non-indexing variants are named |
| 464 | \code{\var{feature}descni}. The available variants are explicitly |
| 465 | included in the list below. |
| 466 | |
| 467 | For each of these environments, the first parameter, \var{name}, |
| 468 | provides the name by which the feature is accessed. |
| 469 | |
| 470 | Environments which describe features of objects within a module, |
| 471 | such as object methods or data attributes, allow an optional |
| 472 | \var{type name} parameter. When the feature is an attribute of |
| 473 | class instances, \var{type name} only needs to be given if the |
| 474 | class was not the most recently described class in the module; the |
| 475 | \var{name} value from the most recent \env{classdesc} is implied. |
| 476 | For features of built-in or extension types, the \var{type name} |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 477 | value should always be provided. Another special case includes |
| 478 | methods and members of general ``protocols,'' such as the |
| 479 | formatter and writer protocols described for the |
| 480 | \module{formatter} module: these may be documented without any |
| 481 | specific implementation classes, and will always require the |
| 482 | \var{type name} parameter to be provided. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 483 | |
Fred Drake | 7be440d | 2000-09-16 21:23:25 +0000 | [diff] [blame] | 484 | \begin{envdesc}{cfuncdesc}{\p{type}\p{name}\p{args}} |
| 485 | Environment used to described a C function. The \var{type} |
| 486 | should be specified as a \keyword{typedef} name, \code{struct |
| 487 | \var{tag}}, or the name of a primitive type. If it is a pointer |
Fred Drake | 0299749 | 2000-09-21 05:26:43 +0000 | [diff] [blame] | 488 | type, the trailing asterisk should not be preceded by a space. |
Fred Drake | 7be440d | 2000-09-16 21:23:25 +0000 | [diff] [blame] | 489 | \var{name} should be the name of the function (or function-like |
| 490 | pre-processor macro), and \var{args} should give the types and |
| 491 | names of the parameters. The names need to be given so they may |
| 492 | be used in the description. |
| 493 | \end{envdesc} |
| 494 | |
| 495 | \begin{envdesc}{ctypedesc}{\op{tag}\p{name}} |
| 496 | Environment used to described a C type. The \var{name} |
| 497 | parameter should be the \keyword{typedef} name. If the type is |
| 498 | defined as a \keyword{struct} without a \keyword{typedef}, |
| 499 | \var{name} should have the form \code{struct \var{tag}}. |
| 500 | \var{name} will be added to the index unless \var{tag} is |
| 501 | provided, in which case \var{tag} will be used instead. |
| 502 | \var{tag} should not be used for a \keyword{typedef} name. |
| 503 | \end{envdesc} |
| 504 | |
| 505 | \begin{envdesc}{cvardesc}{\p{type}\p{name}} |
| 506 | Description of a global C variable. \var{type} should be the |
| 507 | \keyword{typedef} name, \code{struct \var{tag}}, or the name of |
| 508 | a primitive type. If variable has a pointer type, the trailing |
Fred Drake | 0299749 | 2000-09-21 05:26:43 +0000 | [diff] [blame] | 509 | asterisk should \emph{not} be preceded by a space. |
Fred Drake | 7be440d | 2000-09-16 21:23:25 +0000 | [diff] [blame] | 510 | \end{envdesc} |
| 511 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 512 | \begin{envdesc}{datadesc}{\p{name}} |
| 513 | This environment is used to document global data in a module, |
| 514 | including both variables and values used as ``defined |
| 515 | constants.'' Class and object attributes are not documented |
| 516 | using this environment. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 517 | \end{envdesc} |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 518 | \begin{envdesc}{datadescni}{\p{name}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 519 | Like \env{datadesc}, but without creating any index entries. |
| 520 | \end{envdesc} |
| 521 | |
Fred Drake | 9f2376d | 2001-05-11 01:01:12 +0000 | [diff] [blame^] | 522 | \begin{envdesc}{excclassdesc}{\p{name}\p{constructor parameters}} |
| 523 | Descibe an exception defined by a class. \var{constructor |
| 524 | parameters} should not include the \var{self} parameter or |
| 525 | the parentheses used in the call syntax. To describe an |
| 526 | exception class without describing the parameters to its |
| 527 | constructor, use the \env{excdesc} environment. |
| 528 | \end{envdesc} |
| 529 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 530 | \begin{envdesc}{excdesc}{\p{name}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 531 | Describe an exception. This may be either a string exception or |
Fred Drake | 9f2376d | 2001-05-11 01:01:12 +0000 | [diff] [blame^] | 532 | a class exception. In the case of class exceptions, the |
| 533 | constructor parameters are not described; use \env{excclassdesc} |
| 534 | to describe an exception class and its constructor. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 535 | \end{envdesc} |
| 536 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 537 | \begin{envdesc}{funcdesc}{\p{name}\p{parameters}} |
| 538 | Describe a module-level function. \var{parameters} should |
| 539 | not include the parentheses used in the call syntax. Object |
| 540 | methods are not documented using this environment. Bound object |
| 541 | methods placed in the module namespace as part of the public |
| 542 | interface of the module are documented using this, as they are |
| 543 | equivalent to normal functions for most purposes. |
| 544 | |
| 545 | The description should include information about the parameters |
| 546 | required and how they are used (especially whether mutable |
| 547 | objects passed as parameters are modified), side effects, and |
| 548 | possible exceptions. A small example may be provided. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 549 | \end{envdesc} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 550 | \begin{envdesc}{funcdescni}{\p{name}\p{parameters}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 551 | Like \env{funcdesc}, but without creating any index entries. |
| 552 | \end{envdesc} |
| 553 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 554 | \begin{envdesc}{classdesc}{\p{name}\p{constructor parameters}} |
| 555 | Describe a class and its constructor. \var{constructor |
| 556 | parameters} should not include the \var{self} parameter or |
| 557 | the parentheses used in the call syntax. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 558 | \end{envdesc} |
| 559 | |
Fred Drake | 9f2376d | 2001-05-11 01:01:12 +0000 | [diff] [blame^] | 560 | \begin{envdesc}{classdesc*}{\p{name}} |
| 561 | Describe a class without describing the constructor. This can |
| 562 | be used to describe classes that are merely containers for |
| 563 | attributes or which should never be instantiated or subclassed |
| 564 | by user code. |
| 565 | \end{envdesc} |
| 566 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 567 | \begin{envdesc}{memberdesc}{\op{type name}\p{name}} |
| 568 | Describe an object data attribute. The description should |
| 569 | include information about the type of the data to be expected |
| 570 | and whether it may be changed directly. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 571 | \end{envdesc} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 572 | \begin{envdesc}{memberdescni}{\op{type name}\p{name}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 573 | Like \env{memberdesc}, but without creating any index entries. |
| 574 | \end{envdesc} |
| 575 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 576 | \begin{envdesc}{methoddesc}{\op{type name}\p{name}\p{parameters}} |
| 577 | Describe an object method. \var{parameters} should not include |
| 578 | the \var{self} parameter or the parentheses used in the call |
| 579 | syntax. The description should include similar information to |
| 580 | that described for \env{funcdesc}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 581 | \end{envdesc} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 582 | \begin{envdesc}{methoddescni}{\op{type name}\p{name}\p{parameters}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 583 | Like \env{methoddesc}, but without creating any index entries. |
| 584 | \end{envdesc} |
| 585 | |
| 586 | |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 587 | \subsection{Showing Code Examples} |
| 588 | |
| 589 | Examples of Python source code or interactive sessions are |
| 590 | represented as \env{verbatim} environments. This environment |
| 591 | is a standard part of \LaTeX{}. It is important to only use |
| 592 | spaces for indentation in code examples since \TeX{} drops tabs |
| 593 | instead of converting them to spaces. |
| 594 | |
| 595 | Representing an interactive session requires including the prompts |
| 596 | and output along with the Python code. No special markup is |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 597 | required for interactive sessions. After the last line of input |
| 598 | or output presented, there should not be an ``unused'' primary |
| 599 | prompt; this is an example of what \emph{not} to do: |
| 600 | |
| 601 | \begin{verbatim} |
| 602 | >>> 1 + 1 |
| 603 | 2 |
| 604 | >>> |
| 605 | \end{verbatim} |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 606 | |
| 607 | Within the \env{verbatim} environment, characters special to |
| 608 | \LaTeX{} do not need to be specially marked in any way. The entire |
| 609 | example will be presented in a monospaced font; no attempt at |
| 610 | ``pretty-printing'' is made, as the environment must work for |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 611 | non-Python code and non-code displays. There should be no blank |
| 612 | lines at the top or bottom of any \env{verbatim} display. |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 613 | |
| 614 | The Python Documentation Special Interest Group has discussed a |
| 615 | number of approaches to creating pretty-printed code displays and |
| 616 | interactive sessions; see the Doc-SIG area on the Python Web site |
| 617 | for more information on this topic. |
| 618 | |
| 619 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 620 | \subsection{Inline Markup} |
| 621 | |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 622 | The macros described in this section are used to mark just about |
| 623 | anything interesting in the document text. They may be used in |
| 624 | headings (though anything involving hyperlinks should be avoided |
| 625 | there) as well as in the body text. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 626 | |
| 627 | \begin{macrodesc}{bfcode}{\p{text}} |
| 628 | Like \macro{code}, but also makes the font bold-face. |
| 629 | \end{macrodesc} |
| 630 | |
| 631 | \begin{macrodesc}{cdata}{\p{name}} |
| 632 | The name of a C-language variable. |
| 633 | \end{macrodesc} |
| 634 | |
| 635 | \begin{macrodesc}{cfunction}{\p{name}} |
| 636 | The name of a C-language function. \var{name} should include the |
| 637 | function name and the trailing parentheses. |
| 638 | \end{macrodesc} |
| 639 | |
| 640 | \begin{macrodesc}{character}{\p{char}} |
| 641 | A character when discussing the character rather than a one-byte |
| 642 | string value. The character will be typeset as with \macro{samp}. |
| 643 | \end{macrodesc} |
| 644 | |
Fred Drake | 29a710f | 1999-11-10 22:51:18 +0000 | [diff] [blame] | 645 | \begin{macrodesc}{citetitle}{\op{url}\p{title}} |
| 646 | A title for a referenced publication. If \var{url} is specified, |
| 647 | the title will be made into a hyperlink when formatted as HTML. |
| 648 | \end{macrodesc} |
| 649 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 650 | \begin{macrodesc}{class}{\p{name}} |
| 651 | A class name; a dotted name may be used. |
| 652 | \end{macrodesc} |
| 653 | |
| 654 | \begin{macrodesc}{code}{\p{text}} |
| 655 | A short code fragment or literal constant value. Typically, it |
| 656 | should not include any spaces since no quotation marks are |
| 657 | added. |
| 658 | \end{macrodesc} |
| 659 | |
| 660 | \begin{macrodesc}{constant}{\p{name}} |
| 661 | The name of a ``defined'' constant. This may be a C-language |
| 662 | \code{\#define} or a Python variable that is not intended to be |
| 663 | changed. |
| 664 | \end{macrodesc} |
| 665 | |
| 666 | \begin{macrodesc}{ctype}{\p{name}} |
| 667 | The name of a C \keyword{typedef} or structure. For structures |
| 668 | defined without a \keyword{typedef}, use \code{\e ctype\{struct |
| 669 | struct_tag\}} to make it clear that the \keyword{struct} is |
| 670 | required. |
| 671 | \end{macrodesc} |
| 672 | |
| 673 | \begin{macrodesc}{deprecated}{\p{version}\p{what to do}} |
| 674 | Declare whatever is being described as being deprecated starting |
| 675 | with release \var{version}. The text given as \var{what to do} |
| 676 | should recommend something to use instead. |
| 677 | \end{macrodesc} |
| 678 | |
| 679 | \begin{macrodesc}{dfn}{\p{term}} |
| 680 | Mark the defining instance of \var{term} in the text. (No index |
| 681 | entries are generated.) |
| 682 | \end{macrodesc} |
| 683 | |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 684 | \begin{macrodesc}{e}{} |
| 685 | Produces a backslash. This is convenient in \macro{code} and |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 686 | similar macros, and is only defined there. To create a |
Fred Drake | 2b85341 | 2000-04-11 19:08:30 +0000 | [diff] [blame] | 687 | backslash in ordinary text (such as the contents of the |
| 688 | \macro{file} macro), use the standard \macro{textbackslash} macro. |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 689 | \end{macrodesc} |
| 690 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 691 | \begin{macrodesc}{email}{\p{address}} |
| 692 | An email address. Note that this is \emph{not} hyperlinked in |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 693 | any of the possible output formats. The domain name portion of |
| 694 | the address should be lower case. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 695 | \end{macrodesc} |
| 696 | |
| 697 | \begin{macrodesc}{emph}{\p{text}} |
| 698 | Emphasized text; this will be presented in an italic font. |
| 699 | \end{macrodesc} |
| 700 | |
| 701 | \begin{macrodesc}{envvar}{\p{name}} |
| 702 | An environment variable. Index entries are generated. |
| 703 | \end{macrodesc} |
| 704 | |
| 705 | \begin{macrodesc}{exception}{\p{name}} |
| 706 | The name of an exception. A dotted name may be used. |
| 707 | \end{macrodesc} |
| 708 | |
| 709 | \begin{macrodesc}{file}{\p{file or dir}} |
| 710 | The name of a file or directory. In the PDF and PostScript |
| 711 | outputs, single quotes and a font change are used to indicate |
| 712 | the file name, but no quotes are used in the HTML output. |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 713 | \strong{Warning:} The \macro{file} macro cannot be used in the |
| 714 | content of a section title due to processing limitations. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 715 | \end{macrodesc} |
| 716 | |
| 717 | \begin{macrodesc}{filenq}{\p{file or dir}} |
| 718 | Like \macro{file}, but single quotes are never used. This can |
| 719 | be used in conjunction with tables if a column will only contain |
| 720 | file or directory names. |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 721 | \strong{Warning:} The \macro{filenq} macro cannot be used in the |
| 722 | content of a section title due to processing limitations. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 723 | \end{macrodesc} |
| 724 | |
| 725 | \begin{macrodesc}{function}{\p{name}} |
| 726 | The name of a Python function; dotted names may be used. |
| 727 | \end{macrodesc} |
| 728 | |
| 729 | \begin{macrodesc}{kbd}{\p{key sequence}} |
| 730 | Mark a sequence of keystrokes. What form \var{key sequence} |
| 731 | takes may depend on platform- or application-specific |
| 732 | conventions. For example, an \program{xemacs} key sequence |
| 733 | may be marked like \code{\e kbd\{C-x C-f\}}. |
| 734 | \end{macrodesc} |
| 735 | |
| 736 | \begin{macrodesc}{keyword}{\p{name}} |
| 737 | The name of a keyword in a programming language. |
| 738 | \end{macrodesc} |
| 739 | |
| 740 | \begin{macrodesc}{makevar}{\p{name}} |
| 741 | The name of a \program{make} variable. |
| 742 | \end{macrodesc} |
| 743 | |
| 744 | \begin{macrodesc}{manpage}{\p{name}\p{section}} |
| 745 | A reference to a \UNIX{} manual page. |
| 746 | \end{macrodesc} |
| 747 | |
| 748 | \begin{macrodesc}{member}{\p{name}} |
| 749 | The name of a data attribute of an object. |
| 750 | \end{macrodesc} |
| 751 | |
| 752 | \begin{macrodesc}{method}{\p{name}} |
| 753 | The name of a method of an object. \var{name} should include the |
| 754 | method name and the trailing parentheses. A dotted name may be |
| 755 | used. |
| 756 | \end{macrodesc} |
| 757 | |
| 758 | \begin{macrodesc}{mimetype}{\p{name}} |
| 759 | The name of a MIME type. |
| 760 | \end{macrodesc} |
| 761 | |
| 762 | \begin{macrodesc}{module}{\p{name}} |
Fred Drake | 2b85341 | 2000-04-11 19:08:30 +0000 | [diff] [blame] | 763 | The name of a module; a dotted name may be used. This should |
| 764 | also be used for package names. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 765 | \end{macrodesc} |
| 766 | |
| 767 | \begin{macrodesc}{newsgroup}{\p{name}} |
| 768 | The name of a USENET newsgroup. |
| 769 | \end{macrodesc} |
| 770 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 771 | \begin{macrodesc}{program}{\p{name}} |
| 772 | The name of an executable program. This may differ from the |
| 773 | file name for the executable for some platforms. In particular, |
| 774 | the \file{.exe} (or other) extension should be omitted for DOS |
| 775 | and Windows programs. |
| 776 | \end{macrodesc} |
| 777 | |
Fred Drake | 29a710f | 1999-11-10 22:51:18 +0000 | [diff] [blame] | 778 | \begin{macrodesc}{programopt}{\p{option}} |
Fred Drake | ce44498 | 2000-04-11 18:52:52 +0000 | [diff] [blame] | 779 | A command-line option to an executable program. Use this only |
| 780 | for ``shot'' options, and include the leading hyphen. |
| 781 | \end{macrodesc} |
| 782 | |
| 783 | \begin{macrodesc}{longprogramopt}{\p{option}} |
| 784 | A long command-line option to an executable program. This |
| 785 | should only be used for long option names which will be prefixed |
| 786 | by two hyphens; the hyphens should not be provided as part of |
| 787 | \var{option}. |
Fred Drake | 29a710f | 1999-11-10 22:51:18 +0000 | [diff] [blame] | 788 | \end{macrodesc} |
| 789 | |
Fred Drake | 08c5d0c | 2000-09-11 05:22:30 +0000 | [diff] [blame] | 790 | \begin{macrodesc}{pep}{\p{number}} |
| 791 | A reference to a Python Enhancement Proposal. This generates |
| 792 | appropriate index entries. The text \samp{PEP \var{number}} is |
| 793 | generated; in the HTML output, this text is a hyperlink to an |
| 794 | online copy of the specified PEP. |
| 795 | \end{macrodesc} |
| 796 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 797 | \begin{macrodesc}{refmodule}{\op{key}\p{name}} |
| 798 | Like \macro{module}, but create a hyperlink to the documentation |
| 799 | for the named module. Note that the corresponding |
| 800 | \macro{declaremodule} must be in the same document. If the |
| 801 | \macro{declaremodule} defines a module key different from the |
| 802 | module name, it must also be provided as \var{key} to the |
| 803 | \macro{refmodule} macro. |
| 804 | \end{macrodesc} |
| 805 | |
| 806 | \begin{macrodesc}{regexp}{\p{string}} |
| 807 | Mark a regular expression. |
| 808 | \end{macrodesc} |
| 809 | |
| 810 | \begin{macrodesc}{rfc}{\p{number}} |
| 811 | A reference to an Internet Request for Comments. This generates |
| 812 | appropriate index entries. The text \samp{RFC \var{number}} is |
| 813 | generated; in the HTML output, this text is a hyperlink to an |
| 814 | online copy of the specified RFC. |
| 815 | \end{macrodesc} |
| 816 | |
| 817 | \begin{macrodesc}{samp}{\p{text}} |
| 818 | A short code sample, but possibly longer than would be given |
| 819 | using \macro{code}. Since quotation marks are added, spaces are |
| 820 | acceptable. |
| 821 | \end{macrodesc} |
| 822 | |
Fred Drake | af2b714 | 2000-09-14 20:11:05 +0000 | [diff] [blame] | 823 | \begin{macrodesc}{shortversion}{} |
| 824 | The ``short'' version number of the documented software, as |
| 825 | specified using the \macro{setshortversion} macro in the |
| 826 | preamble. For Python, the short version number for a release is |
| 827 | the first three characters of the \code{sys.version} value. For |
| 828 | example, versions 2.0b1 and 2.0.1 both have a short version of |
| 829 | 2.0. This may not apply for all packages; if |
| 830 | \macro{setshortversion} is not used, this produces an empty |
| 831 | expansion. See also the \macro{version} macro. |
| 832 | \end{macrodesc} |
| 833 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 834 | \begin{macrodesc}{strong}{\p{text}} |
| 835 | Strongly emphasized text; this will be presented using a bold |
| 836 | font. |
| 837 | \end{macrodesc} |
| 838 | |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 839 | \begin{macrodesc}{url}{\p{url}} |
| 840 | A URL (or URN). The URL will be presented as text. In the HTML |
| 841 | and PDF formatted versions, the URL will also be a hyperlink. |
| 842 | This can be used when referring to external resources. Note |
| 843 | that many characters are special to \LaTeX{} and this macro |
| 844 | does not always do the right thing. In particular, the tilde |
| 845 | character (\character{\~}) is mis-handled; encoding it as a |
| 846 | hex-sequence does work, use \samp{\%7e} in place of the tilde |
| 847 | character. |
| 848 | \end{macrodesc} |
| 849 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 850 | \begin{macrodesc}{var}{\p{name}} |
| 851 | The name of a variable or formal parameter in running text. |
| 852 | \end{macrodesc} |
| 853 | |
| 854 | \begin{macrodesc}{version}{} |
Fred Drake | af2b714 | 2000-09-14 20:11:05 +0000 | [diff] [blame] | 855 | The version number of the described software, as specified using |
| 856 | \macro{release} in the preamble. See also the |
| 857 | \macro{shortversion} macro. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 858 | \end{macrodesc} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 859 | |
Fred Drake | 3151f44 | 2001-04-18 05:19:06 +0000 | [diff] [blame] | 860 | \begin{macrodesc}{versionadded}{\op{explanation}\p{version}} |
Fred Drake | c26cc91 | 2000-05-02 17:43:44 +0000 | [diff] [blame] | 861 | The version of Python which added the described feature to the |
Fred Drake | 3151f44 | 2001-04-18 05:19:06 +0000 | [diff] [blame] | 862 | library or C API. \var{explanation} should be a \emph{brief} |
| 863 | explanation of the change consisting of a capitalized sentence |
| 864 | fragment; a period will be appended by the formatting process. |
| 865 | This is typically added to the end of the first paragraph of the |
| 866 | description before any availability notes. The location should |
| 867 | be selected so the explanation makes sense and may vary as |
| 868 | needed. |
Fred Drake | c26cc91 | 2000-05-02 17:43:44 +0000 | [diff] [blame] | 869 | \end{macrodesc} |
| 870 | |
| 871 | \begin{macrodesc}{versionchanged}{\op{explanation}\p{version}} |
| 872 | The version of Python in which the named feature was changed in |
| 873 | some way (new parameters, changed side effects, etc.). |
| 874 | \var{explanation} should be a \emph{brief} explanation of the |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 875 | change consisting of a capitalized sentence fragment; a |
Fred Drake | c26cc91 | 2000-05-02 17:43:44 +0000 | [diff] [blame] | 876 | period will be appended by the formatting process. |
| 877 | This is typically added to the end of the first paragraph of the |
| 878 | description before any availability notes and after |
| 879 | \macro{versionadded}. The location should be selected so the |
| 880 | explanation makes sense and may vary as needed. |
| 881 | \end{macrodesc} |
| 882 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 883 | |
| 884 | \subsection{Module-specific Markup} |
| 885 | |
| 886 | The markup described in this section is used to provide information |
| 887 | about a module being documented. A typical use of this markup |
| 888 | appears at the top of the section used to document a module. A |
| 889 | typical example might look like this: |
| 890 | |
| 891 | \begin{verbatim} |
| 892 | \section{\module{spam} --- |
| 893 | Access to the SPAM facility} |
| 894 | |
| 895 | \declaremodule{extension}{spam} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 896 | \platform{Unix} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 897 | \modulesynopsis{Access to the SPAM facility of \UNIX{}.} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 898 | \moduleauthor{Jane Doe}{jane.doe@frobnitz.org} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 899 | \end{verbatim} |
| 900 | |
Fred Drake | 7932ed0 | 2000-08-11 17:37:33 +0000 | [diff] [blame] | 901 | Python packages\index{packages} --- collections of modules that can |
| 902 | be described as a unit --- are documented using the same markup as |
| 903 | modules. The name for a module in a package should be typed in |
| 904 | ``fully qualified'' form (i.e., it should include the package name). |
| 905 | For example, a module ``foo'' in package ``bar'' should be marked as |
| 906 | \samp{\e module\{bar.foo\}}, and the beginning of the reference |
| 907 | section would appear as: |
| 908 | |
| 909 | \begin{verbatim} |
| 910 | \section{\module{bar.foo} --- |
| 911 | Module from the \module{bar} package} |
| 912 | |
| 913 | \declaremodule{extension}{bar.foo} |
| 914 | \modulesynopsis{Nifty module from the \module{bar} package.} |
| 915 | \moduleauthor{Jane Doe}{jane.doe@frobnitz.org} |
| 916 | \end{verbatim} |
| 917 | |
| 918 | Note that the name of a package is also marked using |
| 919 | \macro{module}. |
| 920 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 921 | \begin{macrodesc}{declaremodule}{\op{key}\p{type}\p{name}} |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 922 | Requires two parameters: module type (\samp{standard}, |
| 923 | \samp{builtin}, \samp{extension}, or \samp{}), and the module |
| 924 | name. An optional parameter should be given as the basis for the |
| 925 | module's ``key'' used for linking to or referencing the section. |
| 926 | The ``key'' should only be given if the module's name contains any |
| 927 | underscores, and should be the name with the underscores stripped. |
| 928 | Note that the \var{type} parameter must be one of the values |
| 929 | listed above or an error will be printed. For modules which are |
| 930 | contained in packages, the fully-qualified name should be given as |
| 931 | \var{name} parameter. This should be the first thing after the |
| 932 | \macro{section} used to introduce the module. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 933 | \end{macrodesc} |
| 934 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 935 | \begin{macrodesc}{platform}{\p{specifier}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 936 | Specifies the portability of the module. \var{specifier} is a |
| 937 | comma-separated list of keys that specify what platforms the |
| 938 | module is available on. The keys are short identifiers; |
| 939 | examples that are in use include \samp{IRIX}, \samp{Mac}, |
| 940 | \samp{Windows}, and \samp{Unix}. It is important to use a key |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 941 | which has already been used when applicable. This is used to |
| 942 | provide annotations in the Module Index and the HTML and GNU info |
| 943 | output. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 944 | \end{macrodesc} |
| 945 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 946 | \begin{macrodesc}{modulesynopsis}{\p{text}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 947 | The \var{text} is a short, ``one line'' description of the |
| 948 | module that can be used as part of the chapter introduction. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 949 | This is must be placed after \macro{declaremodule}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 950 | The synopsis is used in building the contents of the table |
| 951 | inserted as the \macro{localmoduletable}. No text is |
| 952 | produced at the point of the markup. |
| 953 | \end{macrodesc} |
| 954 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 955 | \begin{macrodesc}{moduleauthor}{\p{name}\p{email}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 956 | This macro is used to encode information about who authored a |
| 957 | module. This is currently not used to generate output, but can be |
| 958 | used to help determine the origin of the module. |
| 959 | \end{macrodesc} |
| 960 | |
| 961 | |
| 962 | \subsection{Library-level Markup} |
| 963 | |
| 964 | This markup is used when describing a selection of modules. For |
Fred Drake | 698d520 | 1999-11-10 15:54:57 +0000 | [diff] [blame] | 965 | example, the \citetitle[../mac/mac.html]{Macintosh Library |
| 966 | Modules} document uses this to help provide an overview of the |
| 967 | modules in the collection, and many chapters in the |
| 968 | \citetitle[../lib/lib.html]{Python Library Reference} use it for |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 969 | the same purpose. |
| 970 | |
| 971 | \begin{macrodesc}{localmoduletable}{} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 972 | If a \file{.syn} file exists for the current |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 973 | chapter (or for the entire document in \code{howto} documents), a |
| 974 | \env{synopsistable} is created with the contents loaded from the |
| 975 | \file{.syn} file. |
| 976 | \end{macrodesc} |
| 977 | |
| 978 | |
| 979 | \subsection{Table Markup} |
| 980 | |
| 981 | There are three general-purpose table environments defined which |
| 982 | should be used whenever possible. These environments are defined |
| 983 | to provide tables of specific widths and some convenience for |
| 984 | formatting. These environments are not meant to be general |
| 985 | replacements for the standard \LaTeX{} table environments, but can |
| 986 | be used for an advantage when the documents are processed using |
| 987 | the tools for Python documentation processing. In particular, the |
| 988 | generated HTML looks good! There is also an advantage for the |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 989 | eventual conversion of the documentation to SGML (see section |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 990 | \ref{futures}, ``Future Directions''). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 991 | |
| 992 | Each environment is named \env{table\var{cols}}, where \var{cols} |
| 993 | is the number of columns in the table specified in lower-case |
| 994 | Roman numerals. Within each of these environments, an additional |
| 995 | macro, \macro{line\var{cols}}, is defined, where \var{cols} |
| 996 | matches the \var{cols} value of the corresponding table |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 997 | environment. These are supported for \var{cols} values of |
| 998 | \code{ii}, \code{iii}, and \code{iv}. These environments are all |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 999 | built on top of the \env{tabular} environment. Variants based on |
| 1000 | the \env{longtable} environment are also provided. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1001 | |
Fred Drake | 2b85341 | 2000-04-11 19:08:30 +0000 | [diff] [blame] | 1002 | Note that all tables in the standard Python documentation use |
| 1003 | vertical lines between columns, and this must be specified in the |
| 1004 | markup for each table. A general border around the outside of the |
| 1005 | table is not used, but would be the responsibility of the |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1006 | processor; the document markup should not include an exterior |
| 1007 | border. |
| 1008 | |
| 1009 | The \env{longtable}-based variants of the table environments are |
| 1010 | formatted with extra space before and after, so should only be |
| 1011 | used on tables which are long enough that splitting over multiple |
| 1012 | pages is reasonable; tables with fewer than twenty rows should |
| 1013 | never by marked using the long flavors of the table environments. |
| 1014 | The header row is repeated across the top of each part of the |
| 1015 | table. |
Fred Drake | 2b85341 | 2000-04-11 19:08:30 +0000 | [diff] [blame] | 1016 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1017 | \begin{envdesc}{tableii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1018 | Create a two-column table using the \LaTeX{} column specifier |
| 1019 | \var{colspec}. The column specifier should indicate vertical |
| 1020 | bars between columns as appropriate for the specific table, but |
| 1021 | should not specify vertical bars on the outside of the table |
| 1022 | (that is considered a stylesheet issue). The \var{col1font} |
| 1023 | parameter is used as a stylistic treatment of the first column |
| 1024 | of the table: the first column is presented as |
| 1025 | \code{\e\var{col1font}\{column1\}}. To avoid treating the first |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1026 | column specially, \var{col1font} may be \samp{textrm}. The |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1027 | column headings are taken from the values \var{heading1} and |
| 1028 | \var{heading2}. |
| 1029 | \end{envdesc} |
| 1030 | |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1031 | \begin{envdesc}{longtableii}{\unspecified} |
| 1032 | Like \env{tableii}, but produces a table which may be broken |
| 1033 | across page boundaries. The parameters are the same as for |
| 1034 | \env{tableii}. |
| 1035 | \end{envdesc} |
| 1036 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1037 | \begin{macrodesc}{lineii}{\p{column1}\p{column2}} |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1038 | Create a single table row within a \env{tableii} or |
| 1039 | \env{longtableii} environment. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1040 | The text for the first column will be generated by applying the |
| 1041 | macro named by the \var{col1font} value when the \env{tableii} |
| 1042 | was opened. |
| 1043 | \end{macrodesc} |
| 1044 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1045 | \begin{envdesc}{tableiii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1046 | Like the \env{tableii} environment, but with a third column. |
| 1047 | The heading for the third column is given by \var{heading3}. |
| 1048 | \end{envdesc} |
| 1049 | |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1050 | \begin{envdesc}{longtableiii}{\unspecified} |
| 1051 | Like \env{tableiii}, but produces a table which may be broken |
| 1052 | across page boundaries. The parameters are the same as for |
| 1053 | \env{tableiii}. |
| 1054 | \end{envdesc} |
| 1055 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1056 | \begin{macrodesc}{lineiii}{\p{column1}\p{column2}\p{column3}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1057 | Like the \macro{lineii} macro, but with a third column. The |
| 1058 | text for the third column is given by \var{column3}. |
| 1059 | \end{macrodesc} |
| 1060 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1061 | \begin{envdesc}{tableiv}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}\p{heading4}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1062 | Like the \env{tableiii} environment, but with a fourth column. |
| 1063 | The heading for the fourth column is given by \var{heading4}. |
| 1064 | \end{envdesc} |
| 1065 | |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1066 | \begin{envdesc}{longtableiv}{\unspecified} |
| 1067 | Like \env{tableiv}, but produces a table which may be broken |
| 1068 | across page boundaries. The parameters are the same as for |
| 1069 | \env{tableiv}. |
| 1070 | \end{envdesc} |
| 1071 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1072 | \begin{macrodesc}{lineiv}{\p{column1}\p{column2}\p{column3}\p{column4}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1073 | Like the \macro{lineiii} macro, but with a fourth column. The |
| 1074 | text for the fourth column is given by \var{column4}. |
| 1075 | \end{macrodesc} |
| 1076 | |
| 1077 | |
| 1078 | An additional table-like environment is \env{synopsistable}. The |
| 1079 | table generated by this environment contains two columns, and each |
| 1080 | row is defined by an alternate definition of |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1081 | \macro{modulesynopsis}. This environment is not normally used by |
| 1082 | authors, but is created by the \macro{localmoduletable} macro. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1083 | |
| 1084 | |
| 1085 | \subsection{Reference List Markup \label{references}} |
| 1086 | |
| 1087 | Many sections include a list of references to module documentation |
| 1088 | or external documents. These lists are created using the |
| 1089 | \env{seealso} environment. This environment defines some |
| 1090 | additional macros to support creating reference entries in a |
| 1091 | reasonable manner. |
| 1092 | |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 1093 | The \env{seealso} environment is typically placed in a section |
| 1094 | just before any sub-sections. This is done to ensure that |
| 1095 | reference links related to the section are not hidden in a |
| 1096 | subsection in the hypertext renditions of the documentation. |
| 1097 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1098 | \begin{envdesc}{seealso}{} |
| 1099 | This environment creates a ``See also:'' heading and defines the |
| 1100 | markup used to describe individual references. |
| 1101 | \end{envdesc} |
| 1102 | |
Fred Drake | 4844998 | 2000-09-12 17:52:33 +0000 | [diff] [blame] | 1103 | For each of the following macros, \var{why} should be one or more |
| 1104 | complete sentences, starting with a capital letter (unless it |
| 1105 | starts with an identifier, which should not be modified), and |
| 1106 | ending with the apropriate punctuation. |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 1107 | |
Fred Drake | b7cf378 | 2000-09-12 19:58:10 +0000 | [diff] [blame] | 1108 | These macros are only defined within the content of the |
| 1109 | \env{seealso} environment. |
| 1110 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1111 | \begin{macrodesc}{seemodule}{\op{key}\p{name}\p{why}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1112 | Refer to another module. \var{why} should be a brief |
| 1113 | explanation of why the reference may be interesting. The module |
| 1114 | name is given in \var{name}, with the link key given in |
| 1115 | \var{key} if necessary. In the HTML and PDF conversions, the |
| 1116 | module name will be a hyperlink to the referred-to module. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1117 | \strong{Note:} The module must be documented in the same |
| 1118 | document (the corresponding \macro{declaremodule} is required). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1119 | \end{macrodesc} |
| 1120 | |
Fred Drake | 08c5d0c | 2000-09-11 05:22:30 +0000 | [diff] [blame] | 1121 | \begin{macrodesc}{seepep}{\p{number}\p{title}\p{why}} |
| 1122 | Refer to an Python Enhancement Proposal (PEP). \var{number} |
| 1123 | should be the official number assigned by the PEP Editor, |
| 1124 | \var{title} should be the human-readable title of the PEP as |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 1125 | found in the official copy of the document, and \var{why} should |
Fred Drake | 08c5d0c | 2000-09-11 05:22:30 +0000 | [diff] [blame] | 1126 | explain what's interesting about the PEP. This should be used |
| 1127 | to refer the reader to PEPs which specify interfaces or language |
| 1128 | features relevant to the material in the annotated section of the |
| 1129 | documentation. |
| 1130 | \end{macrodesc} |
| 1131 | |
| 1132 | \begin{macrodesc}{seerfc}{\p{number}\p{title}\p{why}} |
| 1133 | Refer to an IETF Request for Comments (RFC). Otherwise very |
| 1134 | similar to \macro{seepep}. This should be used |
| 1135 | to refer the reader to PEPs which specify protocols or data |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 1136 | formats relevant to the material in the annotated section of the |
| 1137 | documentation. |
| 1138 | \end{macrodesc} |
| 1139 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1140 | \begin{macrodesc}{seetext}{\p{text}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1141 | Add arbitrary text \var{text} to the ``See also:'' list. This |
| 1142 | can be used to refer to off-line materials or on-line materials |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 1143 | using the \macro{url} macro. This should consist of one or more |
| 1144 | complete sentences. |
| 1145 | \end{macrodesc} |
| 1146 | |
Fred Drake | 4844998 | 2000-09-12 17:52:33 +0000 | [diff] [blame] | 1147 | \begin{macrodesc}{seetitle}{\op{url}\p{title}\p{why}} |
| 1148 | Add a reference to an external document named \var{title}. If |
| 1149 | \var{url} is given, the title is made a hyperlink in the HTML |
| 1150 | version of the documentation, and displayed below the title in |
| 1151 | the typeset versions of the documentation. |
| 1152 | \end{macrodesc} |
| 1153 | |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 1154 | \begin{macrodesc}{seeurl}{\p{url}\p{why}} |
| 1155 | References to specific on-line resources should be given using |
| 1156 | the \macro{seeurl} macro. No title is associated with the |
| 1157 | reference, but the \var{why} text may include a title marked |
| 1158 | using the \macro{citetitle} macro. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1159 | \end{macrodesc} |
| 1160 | |
| 1161 | |
| 1162 | \subsection{Index-generating Markup \label{indexing}} |
| 1163 | |
| 1164 | Effective index generation for technical documents can be very |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1165 | difficult, especially for someone familiar with the topic but not |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1166 | the creation of indexes. Much of the difficulty arises in the |
| 1167 | area of terminology: including the terms an expert would use for a |
| 1168 | concept is not sufficient. Coming up with the terms that a novice |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1169 | would look up is fairly difficult for an author who, typically, is |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1170 | an expert in the area she is writing on. |
| 1171 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1172 | The truly difficult aspects of index generation are not areas with |
| 1173 | which the documentation tools can help. However, ease |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1174 | of producing the index once content decisions are made is within |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1175 | the scope of the tools. Markup is provided which the processing |
| 1176 | software is able to use to generate a variety of kinds of index |
| 1177 | entry with minimal effort. Additionally, many of the environments |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 1178 | described in section \ref{info-units}, ``Information Units,'' will |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1179 | generate appropriate entries into the general and module indexes. |
| 1180 | |
| 1181 | The following macro can be used to control the generation of index |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1182 | data, and should be used in the document preamble: |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1183 | |
| 1184 | \begin{macrodesc}{makemodindex}{} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1185 | This should be used in the document preamble if a ``Module |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1186 | Index'' is desired for a document containing reference material |
| 1187 | on many modules. This causes a data file |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 1188 | \code{lib\var{jobname}.idx} to be created from the |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1189 | \macro{declaremodule} macros. This file can be processed by the |
| 1190 | \program{makeindex} program to generate a file which can be |
| 1191 | \macro{input} into the document at the desired location of the |
| 1192 | module index. |
| 1193 | \end{macrodesc} |
| 1194 | |
| 1195 | There are a number of macros that are useful for adding index |
| 1196 | entries for particular concepts, many of which are specific to |
| 1197 | programming languages or even Python. |
| 1198 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1199 | \begin{macrodesc}{bifuncindex}{\p{name}} |
Fred Drake | ec8b905 | 1999-04-23 20:01:17 +0000 | [diff] [blame] | 1200 | Add an index entry referring to a built-in function named |
| 1201 | \var{name}; parentheses should not be included after |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1202 | \var{name}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1203 | \end{macrodesc} |
| 1204 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1205 | \begin{macrodesc}{exindex}{\p{exception}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1206 | Add a reference to an exception named \var{exception}. The |
| 1207 | exception may be either string- or class-based. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1208 | \end{macrodesc} |
| 1209 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1210 | \begin{macrodesc}{kwindex}{\p{keyword}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1211 | Add a reference to a language keyword (not a keyword parameter |
| 1212 | in a function or method call). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1213 | \end{macrodesc} |
| 1214 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1215 | \begin{macrodesc}{obindex}{\p{object type}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1216 | Add an index entry for a built-in object type. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1217 | \end{macrodesc} |
| 1218 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1219 | \begin{macrodesc}{opindex}{\p{operator}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1220 | Add a reference to an operator, such as \samp{+}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1221 | \end{macrodesc} |
| 1222 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1223 | \begin{macrodesc}{refmodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1224 | Add an index entry for module \var{module}; if \var{module} |
| 1225 | contains an underscore, the optional parameter \var{key} should |
| 1226 | be provided as the same string with underscores removed. An |
| 1227 | index entry ``\var{module} (module)'' will be generated. This |
| 1228 | is intended for use with non-standard modules implemented in |
| 1229 | Python. |
| 1230 | \end{macrodesc} |
| 1231 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1232 | \begin{macrodesc}{refexmodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1233 | As for \macro{refmodindex}, but the index entry will be |
| 1234 | ``\var{module} (extension module).'' This is intended for use |
| 1235 | with non-standard modules not implemented in Python. |
| 1236 | \end{macrodesc} |
| 1237 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1238 | \begin{macrodesc}{refbimodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1239 | As for \macro{refmodindex}, but the index entry will be |
| 1240 | ``\var{module} (built-in module).'' This is intended for use |
| 1241 | with standard modules not implemented in Python. |
| 1242 | \end{macrodesc} |
| 1243 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1244 | \begin{macrodesc}{refstmodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1245 | As for \macro{refmodindex}, but the index entry will be |
| 1246 | ``\var{module} (standard module).'' This is intended for use |
| 1247 | with standard modules implemented in Python. |
| 1248 | \end{macrodesc} |
| 1249 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1250 | \begin{macrodesc}{stindex}{\p{statement}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1251 | Add an index entry for a statement type, such as \keyword{print} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1252 | or \keyword{try}/\keyword{finally}. |
| 1253 | |
| 1254 | XXX Need better examples of difference from \macro{kwindex}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1255 | \end{macrodesc} |
| 1256 | |
| 1257 | |
| 1258 | Additional macros are provided which are useful for conveniently |
| 1259 | creating general index entries which should appear at many places |
| 1260 | in the index by rotating a list of words. These are simple macros |
| 1261 | that simply use \macro{index} to build some number of index |
| 1262 | entries. Index entries build using these macros contain both |
| 1263 | primary and secondary text. |
| 1264 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1265 | \begin{macrodesc}{indexii}{\p{word1}\p{word2}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1266 | Build two index entries. This is exactly equivalent to using |
| 1267 | \code{\e index\{\var{word1}!\var{word2}\}} and |
| 1268 | \code{\e index\{\var{word2}!\var{word1}\}}. |
| 1269 | \end{macrodesc} |
| 1270 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1271 | \begin{macrodesc}{indexiii}{\p{word1}\p{word2}\p{word3}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1272 | Build three index entries. This is exactly equivalent to using |
| 1273 | \code{\e index\{\var{word1}!\var{word2} \var{word3}\}}, |
| 1274 | \code{\e index\{\var{word2}!\var{word3}, \var{word1}\}}, and |
| 1275 | \code{\e index\{\var{word3}!\var{word1} \var{word2}\}}. |
| 1276 | \end{macrodesc} |
| 1277 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1278 | \begin{macrodesc}{indexiv}{\p{word1}\p{word2}\p{word3}\p{word4}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1279 | Build four index entries. This is exactly equivalent to using |
| 1280 | \code{\e index\{\var{word1}!\var{word2} \var{word3} \var{word4}\}}, |
| 1281 | \code{\e index\{\var{word2}!\var{word3} \var{word4}, \var{word1}\}}, |
| 1282 | \code{\e index\{\var{word3}!\var{word4}, \var{word1} \var{word2}\}}, |
| 1283 | and |
| 1284 | \code{\e index\{\var{word4}!\var{word1} \var{word2} \var{word3}\}}. |
| 1285 | \end{macrodesc} |
| 1286 | |
| 1287 | |
| 1288 | \section{Special Names} |
| 1289 | |
| 1290 | Many special names are used in the Python documentation, including |
| 1291 | the names of operating systems, programming languages, standards |
| 1292 | bodies, and the like. Many of these were assigned \LaTeX{} macros |
| 1293 | at some point in the distant past, and these macros lived on long |
| 1294 | past their usefulness. In the current markup, these entities are |
| 1295 | not assigned any special markup, but the preferred spellings are |
| 1296 | given here to aid authors in maintaining the consistency of |
| 1297 | presentation in the Python documentation. |
| 1298 | |
| 1299 | \begin{description} |
| 1300 | \item[POSIX] |
| 1301 | The name assigned to a particular group of standards. This is |
| 1302 | always uppercase. |
| 1303 | |
| 1304 | \item[Python] |
| 1305 | The name of our favorite programming language is always |
| 1306 | capitalized. |
Fred Drake | 4293468 | 2000-04-03 15:00:28 +0000 | [diff] [blame] | 1307 | |
| 1308 | \item[Unicode] |
| 1309 | The name of a character set and matching encoding. This is |
| 1310 | always written capitalized. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1311 | \end{description} |
| 1312 | |
| 1313 | |
| 1314 | \section{Processing Tools} |
| 1315 | |
| 1316 | \subsection{External Tools} |
| 1317 | |
| 1318 | Many tools are needed to be able to process the Python |
| 1319 | documentation if all supported formats are required. This |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1320 | section lists the tools used and when each is required. Consult |
| 1321 | the \file{Doc/README} file to see if there are specific version |
| 1322 | requirements for any of these. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1323 | |
| 1324 | \begin{description} |
| 1325 | \item[\program{dvips}] |
| 1326 | This program is a typical part of \TeX{} installations. It is |
| 1327 | used to generate PostScript from the ``device independent'' |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1328 | \file{.dvi} files. It is needed for the conversion to |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1329 | PostScript. |
| 1330 | |
| 1331 | \item[\program{emacs}] |
| 1332 | Emacs is the kitchen sink of programmers' editors, and a damn |
| 1333 | fine kitchen sink it is. It also comes with some of the |
| 1334 | processing needed to support the proper menu structures for |
| 1335 | Texinfo documents when an info conversion is desired. This is |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1336 | needed for the info conversion. Using \program{xemacs} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1337 | instead of FSF \program{emacs} may lead to instability in the |
| 1338 | conversion, but that's because nobody seems to maintain the |
| 1339 | Emacs Texinfo code in a portable manner. |
| 1340 | |
| 1341 | \item[\program{latex}] |
| 1342 | This is a world-class typesetter by Donald Knuth. It is used |
| 1343 | for the conversion to PostScript, and is needed for the HTML |
| 1344 | conversion as well (\LaTeX2HTML requires one of the |
| 1345 | intermediate files it creates). |
| 1346 | |
| 1347 | \item[\program{latex2html}] |
| 1348 | Probably the longest Perl script anyone ever attempted to |
| 1349 | maintain. This converts \LaTeX{} documents to HTML documents, |
| 1350 | and does a pretty reasonable job. It is required for the |
| 1351 | conversions to HTML and GNU info. |
| 1352 | |
| 1353 | \item[\program{lynx}] |
| 1354 | This is a text-mode Web browser which includes an |
| 1355 | HTML-to-plain text conversion. This is used to convert |
| 1356 | \code{howto} documents to text. |
| 1357 | |
| 1358 | \item[\program{make}] |
| 1359 | Just about any version should work for the standard documents, |
| 1360 | but GNU \program{make} is required for the experimental |
| 1361 | processes in \file{Doc/tools/sgmlconv/}, at least while |
| 1362 | they're experimental. |
| 1363 | |
| 1364 | \item[\program{makeindex}] |
| 1365 | This is a standard program for converting \LaTeX{} index data |
| 1366 | to a formatted index; it should be included with all \LaTeX{} |
| 1367 | installations. It is needed for the PDF and PostScript |
| 1368 | conversions. |
| 1369 | |
| 1370 | \item[\program{makeinfo}] |
| 1371 | GNU \program{makeinfo} is used to convert Texinfo documents to |
| 1372 | GNU info files. Since Texinfo is used as an intermediate |
| 1373 | format in the info conversion, this program is needed in that |
| 1374 | conversion. |
| 1375 | |
| 1376 | \item[\program{pdflatex}] |
| 1377 | pdf\TeX{} is a relatively new variant of \TeX, and is used to |
| 1378 | generate the PDF version of the manuals. It is typically |
| 1379 | installed as part of most of the large \TeX{} distributions. |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 1380 | \program{pdflatex} is pdf\TeX{} using the \LaTeX{} format. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1381 | |
| 1382 | \item[\program{perl}] |
| 1383 | Perl is required for \LaTeX2HTML{} and one of the scripts used |
| 1384 | to post-process \LaTeX2HTML output, as well as the |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1385 | HTML-to-Texinfo conversion. This is required for |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1386 | the HTML and GNU info conversions. |
| 1387 | |
| 1388 | \item[\program{python}] |
| 1389 | Python is used for many of the scripts in the |
| 1390 | \file{Doc/tools/} directory; it is required for all |
| 1391 | conversions. This shouldn't be a problem if you're interested |
| 1392 | in writing documentation for Python! |
| 1393 | \end{description} |
| 1394 | |
| 1395 | |
| 1396 | \subsection{Internal Tools} |
| 1397 | |
| 1398 | This section describes the various scripts that are used to |
| 1399 | implement various stages of document processing or to orchestrate |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1400 | entire build sequences. Most of these tools are only useful |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1401 | in the context of building the standard documentation, but some |
| 1402 | are more general. |
| 1403 | |
| 1404 | \begin{description} |
| 1405 | \item[\program{mkhowto}] |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 1406 | This is the primary script used to format third-party |
| 1407 | documents. It contains all the logic needed to ``get it |
| 1408 | right.'' The proper way to use this script is to make a |
| 1409 | symbolic link to it or run it in place; the actual script file |
| 1410 | must be stored as part of the documentation source tree, |
| 1411 | though it may be used to format documents outside the |
Fred Drake | ce44498 | 2000-04-11 18:52:52 +0000 | [diff] [blame] | 1412 | tree. Use \program{mkhowto} \longprogramopt{help} |
Fred Drake | d290c10 | 1999-11-09 18:03:00 +0000 | [diff] [blame] | 1413 | for a list of |
Fred Drake | d2a727f | 1999-05-27 21:45:54 +0000 | [diff] [blame] | 1414 | command line options. |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 1415 | |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 1416 | \program{mkhowto} can be used for both \code{howto} and |
| 1417 | \code{manual} class documents. (For the later, be sure to get |
| 1418 | the latest version from the Python CVS repository rather than |
| 1419 | the version distributed in the \file{latex-1.5.2.tgz} source |
| 1420 | archive.) |
| 1421 | |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 1422 | XXX Need more here. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1423 | \end{description} |
| 1424 | |
| 1425 | |
| 1426 | \section{Future Directions \label{futures}} |
| 1427 | |
| 1428 | The history of the Python documentation is full of changes, most of |
| 1429 | which have been fairly small and evolutionary. There has been a |
| 1430 | great deal of discussion about making large changes in the markup |
| 1431 | languages and tools used to process the documentation. This section |
| 1432 | deals with the nature of the changes and what appears to be the most |
| 1433 | likely path of future development. |
| 1434 | |
| 1435 | \subsection{Structured Documentation \label{structured}} |
| 1436 | |
| 1437 | Most of the small changes to the \LaTeX{} markup have been made |
| 1438 | with an eye to divorcing the markup from the presentation, making |
| 1439 | both a bit more maintainable. Over the course of 1998, a large |
| 1440 | number of changes were made with exactly this in mind; previously, |
| 1441 | changes had been made but in a less systematic manner and with |
| 1442 | more concern for not needing to update the existing content. The |
| 1443 | result has been a highly structured and semantically loaded markup |
| 1444 | language implemented in \LaTeX. With almost no basic \TeX{} or |
| 1445 | \LaTeX{} markup in use, however, the markup syntax is about the |
| 1446 | only evidence of \LaTeX{} in the actual document sources. |
| 1447 | |
| 1448 | One side effect of this is that while we've been able to use |
| 1449 | standard ``engines'' for manipulating the documents, such as |
| 1450 | \LaTeX{} and \LaTeX2HTML, most of the actual transformations have |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 1451 | been created specifically for Python. The \LaTeX{} document |
| 1452 | classes and \LaTeX2HTML support are both complete implementations |
| 1453 | of the specific markup designed for these documents. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1454 | |
| 1455 | Combining highly customized markup with the somewhat esoteric |
| 1456 | systems used to process the documents leads us to ask some |
| 1457 | questions: Can we do this more easily? and, Can we do this |
| 1458 | better? After a great deal of discussion with the community, we |
| 1459 | have determined that actively pursuing modern structured |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1460 | documentation systems is worth some investment of time. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1461 | |
| 1462 | There appear to be two real contenders in this arena: the Standard |
| 1463 | General Markup Language (SGML), and the Extensible Markup Language |
| 1464 | (XML). Both of these standards have advantages and disadvantages, |
| 1465 | and many advantages are shared. |
| 1466 | |
| 1467 | SGML offers advantages which may appeal most to authors, |
| 1468 | especially those using ordinary text editors. There are also |
| 1469 | additional abilities to define content models. A number of |
| 1470 | high-quality tools with demonstrated maturity is available, but |
| 1471 | most are not free; for those which are, portability issues remain |
| 1472 | a problem. |
| 1473 | |
| 1474 | The advantages of XML include the availability of a large number |
| 1475 | of evolving tools. Unfortunately, many of the associated |
| 1476 | standards are still evolving, and the tools will have to follow |
| 1477 | along. This means that developing a robust tool set that uses |
| 1478 | more than the basic XML 1.0 recommendation is not possible in the |
| 1479 | short term. The promised availability of a wide variety of |
| 1480 | high-quality tools which support some of the most important |
| 1481 | related standards is not immediate. Many tools are likely to be |
| 1482 | free. |
| 1483 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1484 | XXX Eventual migration to SGML/XML. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1485 | |
| 1486 | \subsection{Discussion Forums \label{discussion}} |
| 1487 | |
| 1488 | Discussion of the future of the Python documentation and related |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 1489 | topics takes place in the Documentation Special Interest Group, or |
| 1490 | ``Doc-SIG.'' Information on the group, including mailing list |
| 1491 | archives and subscription information, is available at |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1492 | \url{http://www.python.org/sigs/doc-sig/}. The SIG is open to all |
| 1493 | interested parties. |
| 1494 | |
| 1495 | Comments and bug reports on the standard documents should be sent |
| 1496 | to \email{python-docs@python.org}. This may include comments |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1497 | about formatting, content, grammatical and spelling errors, or |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 1498 | this document. You can also send comments on this document |
| 1499 | directly to the author at \email{fdrake@acm.org}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1500 | |
| 1501 | \end{document} |