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{ |
| 13 | Corporation for National Research Initiatives (CNRI) \\ |
| 14 | 1895 Preston White Drive, Reston, Va 20191, USA \\ |
| 15 | E-mail: \email{fdrake@acm.org} |
| 16 | } |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 17 | |
| 18 | |
| 19 | \begin{document} |
| 20 | |
| 21 | \maketitle |
| 22 | |
| 23 | \begin{abstract} |
| 24 | \noindent |
| 25 | The Python language documentation has a substantial body of |
| 26 | documentation, much of it contributed by various authors. The markup |
| 27 | used for the Python documentation is based on \LaTeX{} and requires a |
| 28 | significant set of macros written specifically for documenting Python. |
| 29 | Maintaining the documentation requires substantial effort, in part |
| 30 | because selecting the correct markup to use is not always easy. |
| 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 |
| 96 | separate directory. These directories are given short, |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 97 | three-character names: |
| 98 | |
| 99 | \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Document Title} |
| 100 | \lineii{api/}{\emph{The Python/C API}} |
| 101 | \lineii{doc/}{\emph{Documenting Python}} |
| 102 | \lineii{ext/}{\emph{Extending and Embedding the Python Interpreter}} |
| 103 | \lineii{lib/}{\emph{Python Library Reference}} |
| 104 | \lineii{mac/}{\emph{Macintosh Module Reference}} |
| 105 | \lineii{ref/}{\emph{Python Reference Manual}} |
| 106 | \lineii{tut/}{\emph{Python Tutorial}} |
| 107 | \end{tableii} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 108 | |
| 109 | \term{Format-Specific Output} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 110 | Most output formats have a directory which contains a |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 111 | \file{Makefile} which controls the generation of that format |
| 112 | and provides storage for the formatted documents. The only |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 113 | variations within this category are the Portable Document |
| 114 | Format (PDF) and PostScript versions are placed in the |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 115 | directories \file{paper-a4/} and \file{paper-letter/} (this |
| 116 | causes all the temporary files created by \LaTeX{} to be kept |
| 117 | in the same place for each paper size, where they can be more |
| 118 | easily ignored). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 119 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 120 | \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Output Formats} |
| 121 | \lineii{html/}{HTML output} |
| 122 | \lineii{info/}{GNU info output} |
| 123 | \lineii{paper-a4/}{PDF and PostScript, A4 paper} |
| 124 | \lineii{paper-letter/}{PDF and PostScript, US-Letter paper} |
| 125 | \end{tableii} |
| 126 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 127 | \term{Supplemental Files} |
| 128 | Some additional directories are used to store supplemental |
| 129 | files used for the various processes. Directories are |
| 130 | included for the shared \LaTeX{} document classes, the |
| 131 | \LaTeX2HTML support, template files for various document |
| 132 | components, and the scripts used to perform various steps in |
| 133 | the formatting processes. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 134 | |
| 135 | \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Contents} |
| 136 | \lineii{perl/}{Support for \LaTeX2HTML processing} |
| 137 | \lineii{templates/}{Example files for source documents} |
| 138 | \lineii{texinputs/}{Style implementation for \LaTeX} |
| 139 | \lineii{tools/}{Custom processing scripts} |
| 140 | \end{tableii} |
| 141 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 142 | \end{definitions} |
| 143 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 144 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 145 | \section{\LaTeX{} Primer \label{latex-primer}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 146 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 147 | This section is a brief introduction to \LaTeX{} concepts and |
| 148 | syntax, to provide authors enough information to author documents |
| 149 | productively without having to become ``\TeX{}nicians.'' |
| 150 | |
| 151 | \LaTeX{} documents contain two parts: the preamble and the body. |
| 152 | The preamble is used to specify certain metadata about the document |
| 153 | itself, such as the title, the list of authors, the date, and the |
| 154 | \emph{class} the document belongs to. Additional information used |
| 155 | to control index generation and the use of bibliographic databases |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 156 | can also be placed in the preamble. For most authors, the preamble |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 157 | can be most easily created by copying it from an existing document |
| 158 | and modifying a few key pieces of information. |
| 159 | |
| 160 | The \dfn{class} of a document is used to place a document within a |
| 161 | broad category of documents and set some fundamental formatting |
| 162 | properties. For Python documentation, two classes are used: the |
| 163 | \code{manual} class and the \code{howto} class. These classes also |
| 164 | define the additional markup used to document Python concepts and |
| 165 | structures. Specific information about these classes is provided in |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 166 | section \ref{classes}, ``Document Classes,'' below. The first thing |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 167 | in the preamble is the declaration of the document's class. |
| 168 | |
| 169 | After the class declaration, a number of \emph{macros} are used to |
| 170 | provide further information about the document and setup any |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 171 | additional markup that is needed. No output is generated from the |
| 172 | preamble; it is an error to include free text in the preamble |
| 173 | because it would cause output. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 174 | |
| 175 | The document body follows the preamble. This contains all the |
| 176 | printed components of the document marked up structurally. |
| 177 | |
| 178 | XXX This section will discuss what the markup looks like, and |
| 179 | explain the difference between an environment and a macro. |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 180 | |
| 181 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 182 | \section{Document Classes \label{classes}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 183 | |
| 184 | Two \LaTeX{} document classes are defined specifically for use with |
| 185 | the Python documentation. The \code{manual} class is for large |
| 186 | documents which are sectioned into chapters, and the \code{howto} |
| 187 | class is for smaller documents. |
| 188 | |
| 189 | The \code{manual} documents are larger and are used for most of the |
| 190 | standard documents. This document class is based on the standard |
| 191 | \LaTeX{} \code{report} class and is formatted very much like a long |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 192 | technical report. The \emph{Python Reference Manual} is a good |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 193 | example of a \code{manual} document, and the \emph{Python Library |
| 194 | Reference} is a large example. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 195 | |
| 196 | The \code{howto} documents are shorter, and don't have the large |
| 197 | structure of the \code{manual} documents. This class is based on |
| 198 | the standard \LaTeX{} \code{article} class and is formatted somewhat |
| 199 | like the Linux Documentation Project's ``HOWTO'' series as done |
| 200 | originally using the LinuxDoc software. The original intent for the |
| 201 | document class was that it serve a similar role as the LDP's HOWTO |
| 202 | series, but the applicability of the class turns out to be somewhat |
| 203 | more broad. This class is used for ``how-to'' documents (this |
| 204 | document is an example) and for shorter reference manuals for small, |
| 205 | fairly cohesive module libraries. Examples of the later use include |
| 206 | the standard \emph{Macintosh Library Modules} and \emph{Using |
| 207 | Kerberos from Python}, which contains reference material for an |
| 208 | extension package. These documents are roughly equivalent to a |
| 209 | single chapter from a larger work. |
| 210 | |
| 211 | |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 212 | \section{Special Markup Constructs} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 213 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 214 | The Python document classes define a lot of new environments and |
| 215 | macros. This section contains the reference material for these |
| 216 | facilities. |
| 217 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 218 | \subsection{Information Units \label{info-units}} |
| 219 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 220 | XXX Explain terminology, or come up with something more ``lay.'' |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 221 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 222 | There are a number of environments used to describe specific |
| 223 | features provided by modules. Each environment requires |
| 224 | parameters needed to provide basic information about what is being |
| 225 | described, and the environment content should be the description. |
| 226 | Most of these environments make entries in the general index (if |
| 227 | one is being produced for the document); if no index entry is |
| 228 | desired, non-indexing variants are available for many of these |
| 229 | environments. The environments have names of the form |
| 230 | \code{\var{feature}desc}, and the non-indexing variants are named |
| 231 | \code{\var{feature}descni}. The available variants are explicitly |
| 232 | included in the list below. |
| 233 | |
| 234 | For each of these environments, the first parameter, \var{name}, |
| 235 | provides the name by which the feature is accessed. |
| 236 | |
| 237 | Environments which describe features of objects within a module, |
| 238 | such as object methods or data attributes, allow an optional |
| 239 | \var{type name} parameter. When the feature is an attribute of |
| 240 | class instances, \var{type name} only needs to be given if the |
| 241 | class was not the most recently described class in the module; the |
| 242 | \var{name} value from the most recent \env{classdesc} is implied. |
| 243 | For features of built-in or extension types, the \var{type name} |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 244 | value should always be provided. Another special case includes |
| 245 | methods and members of general ``protocols,'' such as the |
| 246 | formatter and writer protocols described for the |
| 247 | \module{formatter} module: these may be documented without any |
| 248 | specific implementation classes, and will always require the |
| 249 | \var{type name} parameter to be provided. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 250 | |
| 251 | \begin{envdesc}{datadesc}{\p{name}} |
| 252 | This environment is used to document global data in a module, |
| 253 | including both variables and values used as ``defined |
| 254 | constants.'' Class and object attributes are not documented |
| 255 | using this environment. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 256 | \end{envdesc} |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 257 | \begin{envdesc}{datadescni}{\p{name}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 258 | Like \env{datadesc}, but without creating any index entries. |
| 259 | \end{envdesc} |
| 260 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 261 | \begin{envdesc}{excdesc}{\p{name}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 262 | Describe an exception. This may be either a string exception or |
| 263 | a class exception. |
| 264 | \end{envdesc} |
| 265 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 266 | \begin{envdesc}{funcdesc}{\p{name}\p{parameters}} |
| 267 | Describe a module-level function. \var{parameters} should |
| 268 | not include the parentheses used in the call syntax. Object |
| 269 | methods are not documented using this environment. Bound object |
| 270 | methods placed in the module namespace as part of the public |
| 271 | interface of the module are documented using this, as they are |
| 272 | equivalent to normal functions for most purposes. |
| 273 | |
| 274 | The description should include information about the parameters |
| 275 | required and how they are used (especially whether mutable |
| 276 | objects passed as parameters are modified), side effects, and |
| 277 | possible exceptions. A small example may be provided. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 278 | \end{envdesc} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 279 | \begin{envdesc}{funcdescni}{\p{name}\p{parameters}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 280 | Like \env{funcdesc}, but without creating any index entries. |
| 281 | \end{envdesc} |
| 282 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 283 | \begin{envdesc}{classdesc}{\p{name}\p{constructor parameters}} |
| 284 | Describe a class and its constructor. \var{constructor |
| 285 | parameters} should not include the \var{self} parameter or |
| 286 | the parentheses used in the call syntax. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 287 | \end{envdesc} |
| 288 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 289 | \begin{envdesc}{memberdesc}{\op{type name}\p{name}} |
| 290 | Describe an object data attribute. The description should |
| 291 | include information about the type of the data to be expected |
| 292 | and whether it may be changed directly. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 293 | \end{envdesc} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 294 | \begin{envdesc}{memberdescni}{\op{type name}\p{name}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 295 | Like \env{memberdesc}, but without creating any index entries. |
| 296 | \end{envdesc} |
| 297 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 298 | \begin{envdesc}{methoddesc}{\op{type name}\p{name}\p{parameters}} |
| 299 | Describe an object method. \var{parameters} should not include |
| 300 | the \var{self} parameter or the parentheses used in the call |
| 301 | syntax. The description should include similar information to |
| 302 | that described for \env{funcdesc}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 303 | \end{envdesc} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 304 | \begin{envdesc}{methoddescni}{\op{type name}\p{name}\p{parameters}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 305 | Like \env{methoddesc}, but without creating any index entries. |
| 306 | \end{envdesc} |
| 307 | |
| 308 | |
| 309 | \subsection{Inline Markup} |
| 310 | |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 311 | The macros described in this section are used to mark just about |
| 312 | anything interesting in the document text. They may be used in |
| 313 | headings (though anything involving hyperlinks should be avoided |
| 314 | there) as well as in the body text. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 315 | |
| 316 | \begin{macrodesc}{bfcode}{\p{text}} |
| 317 | Like \macro{code}, but also makes the font bold-face. |
| 318 | \end{macrodesc} |
| 319 | |
| 320 | \begin{macrodesc}{cdata}{\p{name}} |
| 321 | The name of a C-language variable. |
| 322 | \end{macrodesc} |
| 323 | |
| 324 | \begin{macrodesc}{cfunction}{\p{name}} |
| 325 | The name of a C-language function. \var{name} should include the |
| 326 | function name and the trailing parentheses. |
| 327 | \end{macrodesc} |
| 328 | |
| 329 | \begin{macrodesc}{character}{\p{char}} |
| 330 | A character when discussing the character rather than a one-byte |
| 331 | string value. The character will be typeset as with \macro{samp}. |
| 332 | \end{macrodesc} |
| 333 | |
| 334 | \begin{macrodesc}{class}{\p{name}} |
| 335 | A class name; a dotted name may be used. |
| 336 | \end{macrodesc} |
| 337 | |
| 338 | \begin{macrodesc}{code}{\p{text}} |
| 339 | A short code fragment or literal constant value. Typically, it |
| 340 | should not include any spaces since no quotation marks are |
| 341 | added. |
| 342 | \end{macrodesc} |
| 343 | |
| 344 | \begin{macrodesc}{constant}{\p{name}} |
| 345 | The name of a ``defined'' constant. This may be a C-language |
| 346 | \code{\#define} or a Python variable that is not intended to be |
| 347 | changed. |
| 348 | \end{macrodesc} |
| 349 | |
| 350 | \begin{macrodesc}{ctype}{\p{name}} |
| 351 | The name of a C \keyword{typedef} or structure. For structures |
| 352 | defined without a \keyword{typedef}, use \code{\e ctype\{struct |
| 353 | struct_tag\}} to make it clear that the \keyword{struct} is |
| 354 | required. |
| 355 | \end{macrodesc} |
| 356 | |
| 357 | \begin{macrodesc}{deprecated}{\p{version}\p{what to do}} |
| 358 | Declare whatever is being described as being deprecated starting |
| 359 | with release \var{version}. The text given as \var{what to do} |
| 360 | should recommend something to use instead. |
| 361 | \end{macrodesc} |
| 362 | |
| 363 | \begin{macrodesc}{dfn}{\p{term}} |
| 364 | Mark the defining instance of \var{term} in the text. (No index |
| 365 | entries are generated.) |
| 366 | \end{macrodesc} |
| 367 | |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 368 | \begin{macrodesc}{e}{} |
| 369 | Produces a backslash. This is convenient in \macro{code} and |
| 370 | similar macros. |
| 371 | \end{macrodesc} |
| 372 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 373 | \begin{macrodesc}{email}{\p{address}} |
| 374 | An email address. Note that this is \emph{not} hyperlinked in |
| 375 | any of the possible output formats. |
| 376 | \end{macrodesc} |
| 377 | |
| 378 | \begin{macrodesc}{emph}{\p{text}} |
| 379 | Emphasized text; this will be presented in an italic font. |
| 380 | \end{macrodesc} |
| 381 | |
| 382 | \begin{macrodesc}{envvar}{\p{name}} |
| 383 | An environment variable. Index entries are generated. |
| 384 | \end{macrodesc} |
| 385 | |
| 386 | \begin{macrodesc}{exception}{\p{name}} |
| 387 | The name of an exception. A dotted name may be used. |
| 388 | \end{macrodesc} |
| 389 | |
| 390 | \begin{macrodesc}{file}{\p{file or dir}} |
| 391 | The name of a file or directory. In the PDF and PostScript |
| 392 | outputs, single quotes and a font change are used to indicate |
| 393 | the file name, but no quotes are used in the HTML output. |
| 394 | \end{macrodesc} |
| 395 | |
| 396 | \begin{macrodesc}{filenq}{\p{file or dir}} |
| 397 | Like \macro{file}, but single quotes are never used. This can |
| 398 | be used in conjunction with tables if a column will only contain |
| 399 | file or directory names. |
| 400 | \end{macrodesc} |
| 401 | |
| 402 | \begin{macrodesc}{function}{\p{name}} |
| 403 | The name of a Python function; dotted names may be used. |
| 404 | \end{macrodesc} |
| 405 | |
| 406 | \begin{macrodesc}{kbd}{\p{key sequence}} |
| 407 | Mark a sequence of keystrokes. What form \var{key sequence} |
| 408 | takes may depend on platform- or application-specific |
| 409 | conventions. For example, an \program{xemacs} key sequence |
| 410 | may be marked like \code{\e kbd\{C-x C-f\}}. |
| 411 | \end{macrodesc} |
| 412 | |
| 413 | \begin{macrodesc}{keyword}{\p{name}} |
| 414 | The name of a keyword in a programming language. |
| 415 | \end{macrodesc} |
| 416 | |
| 417 | \begin{macrodesc}{makevar}{\p{name}} |
| 418 | The name of a \program{make} variable. |
| 419 | \end{macrodesc} |
| 420 | |
| 421 | \begin{macrodesc}{manpage}{\p{name}\p{section}} |
| 422 | A reference to a \UNIX{} manual page. |
| 423 | \end{macrodesc} |
| 424 | |
| 425 | \begin{macrodesc}{member}{\p{name}} |
| 426 | The name of a data attribute of an object. |
| 427 | \end{macrodesc} |
| 428 | |
| 429 | \begin{macrodesc}{method}{\p{name}} |
| 430 | The name of a method of an object. \var{name} should include the |
| 431 | method name and the trailing parentheses. A dotted name may be |
| 432 | used. |
| 433 | \end{macrodesc} |
| 434 | |
| 435 | \begin{macrodesc}{mimetype}{\p{name}} |
| 436 | The name of a MIME type. |
| 437 | \end{macrodesc} |
| 438 | |
| 439 | \begin{macrodesc}{module}{\p{name}} |
| 440 | The name of a module; a dotted name may be used. |
| 441 | \end{macrodesc} |
| 442 | |
| 443 | \begin{macrodesc}{newsgroup}{\p{name}} |
| 444 | The name of a USENET newsgroup. |
| 445 | \end{macrodesc} |
| 446 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 447 | \begin{macrodesc}{program}{\p{name}} |
| 448 | The name of an executable program. This may differ from the |
| 449 | file name for the executable for some platforms. In particular, |
| 450 | the \file{.exe} (or other) extension should be omitted for DOS |
| 451 | and Windows programs. |
| 452 | \end{macrodesc} |
| 453 | |
| 454 | \begin{macrodesc}{refmodule}{\op{key}\p{name}} |
| 455 | Like \macro{module}, but create a hyperlink to the documentation |
| 456 | for the named module. Note that the corresponding |
| 457 | \macro{declaremodule} must be in the same document. If the |
| 458 | \macro{declaremodule} defines a module key different from the |
| 459 | module name, it must also be provided as \var{key} to the |
| 460 | \macro{refmodule} macro. |
| 461 | \end{macrodesc} |
| 462 | |
| 463 | \begin{macrodesc}{regexp}{\p{string}} |
| 464 | Mark a regular expression. |
| 465 | \end{macrodesc} |
| 466 | |
| 467 | \begin{macrodesc}{rfc}{\p{number}} |
| 468 | A reference to an Internet Request for Comments. This generates |
| 469 | appropriate index entries. The text \samp{RFC \var{number}} is |
| 470 | generated; in the HTML output, this text is a hyperlink to an |
| 471 | online copy of the specified RFC. |
| 472 | \end{macrodesc} |
| 473 | |
| 474 | \begin{macrodesc}{samp}{\p{text}} |
| 475 | A short code sample, but possibly longer than would be given |
| 476 | using \macro{code}. Since quotation marks are added, spaces are |
| 477 | acceptable. |
| 478 | \end{macrodesc} |
| 479 | |
| 480 | \begin{macrodesc}{strong}{\p{text}} |
| 481 | Strongly emphasized text; this will be presented using a bold |
| 482 | font. |
| 483 | \end{macrodesc} |
| 484 | |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 485 | \begin{macrodesc}{url}{\p{url}} |
| 486 | A URL (or URN). The URL will be presented as text. In the HTML |
| 487 | and PDF formatted versions, the URL will also be a hyperlink. |
| 488 | This can be used when referring to external resources. Note |
| 489 | that many characters are special to \LaTeX{} and this macro |
| 490 | does not always do the right thing. In particular, the tilde |
| 491 | character (\character{\~}) is mis-handled; encoding it as a |
| 492 | hex-sequence does work, use \samp{\%7e} in place of the tilde |
| 493 | character. |
| 494 | \end{macrodesc} |
| 495 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 496 | \begin{macrodesc}{var}{\p{name}} |
| 497 | The name of a variable or formal parameter in running text. |
| 498 | \end{macrodesc} |
| 499 | |
| 500 | \begin{macrodesc}{version}{} |
| 501 | The version number for the documentation, as specified using |
| 502 | \macro{release} in the preamble. |
| 503 | \end{macrodesc} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 504 | |
| 505 | |
| 506 | \subsection{Module-specific Markup} |
| 507 | |
| 508 | The markup described in this section is used to provide information |
| 509 | about a module being documented. A typical use of this markup |
| 510 | appears at the top of the section used to document a module. A |
| 511 | typical example might look like this: |
| 512 | |
| 513 | \begin{verbatim} |
| 514 | \section{\module{spam} --- |
| 515 | Access to the SPAM facility} |
| 516 | |
| 517 | \declaremodule{extension}{spam} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 518 | \platform{Unix} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 519 | \modulesynopsis{Access to the SPAM facility of \UNIX{}.} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 520 | \moduleauthor{Jane Doe}{jane.doe@frobnitz.org} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 521 | \end{verbatim} |
| 522 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 523 | \begin{macrodesc}{declaremodule}{\op{key}\p{type}\p{name}} |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 524 | Requires two parameters: module type (\samp{standard}, |
| 525 | \samp{builtin}, \samp{extension}, or \samp{}), and the module |
| 526 | name. An optional parameter should be given as the basis for the |
| 527 | module's ``key'' used for linking to or referencing the section. |
| 528 | The ``key'' should only be given if the module's name contains any |
| 529 | underscores, and should be the name with the underscores stripped. |
| 530 | Note that the \var{type} parameter must be one of the values |
| 531 | listed above or an error will be printed. For modules which are |
| 532 | contained in packages, the fully-qualified name should be given as |
| 533 | \var{name} parameter. This should be the first thing after the |
| 534 | \macro{section} used to introduce the module. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 535 | \end{macrodesc} |
| 536 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 537 | \begin{macrodesc}{platform}{\p{specifier}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 538 | Specifies the portability of the module. \var{specifier} is a |
| 539 | comma-separated list of keys that specify what platforms the |
| 540 | module is available on. The keys are short identifiers; |
| 541 | examples that are in use include \samp{IRIX}, \samp{Mac}, |
| 542 | \samp{Windows}, and \samp{Unix}. It is important to use a key |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 543 | which has already been used when applicable. This is used to |
| 544 | provide annotations in the Module Index and the HTML and GNU info |
| 545 | output. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 546 | \end{macrodesc} |
| 547 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 548 | \begin{macrodesc}{modulesynopsis}{\p{text}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 549 | The \var{text} is a short, ``one line'' description of the |
| 550 | module that can be used as part of the chapter introduction. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 551 | This is must be placed after \macro{declaremodule}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 552 | The synopsis is used in building the contents of the table |
| 553 | inserted as the \macro{localmoduletable}. No text is |
| 554 | produced at the point of the markup. |
| 555 | \end{macrodesc} |
| 556 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 557 | \begin{macrodesc}{moduleauthor}{\p{name}\p{email}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 558 | This macro is used to encode information about who authored a |
| 559 | module. This is currently not used to generate output, but can be |
| 560 | used to help determine the origin of the module. |
| 561 | \end{macrodesc} |
| 562 | |
| 563 | |
| 564 | \subsection{Library-level Markup} |
| 565 | |
| 566 | This markup is used when describing a selection of modules. For |
| 567 | example, the \emph{Macintosh Library Modules} document uses this |
| 568 | to help provide an overview of the modules in the collection, and |
| 569 | many chapters in the \emph{Python Library Reference} use it for |
| 570 | the same purpose. |
| 571 | |
| 572 | \begin{macrodesc}{localmoduletable}{} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 573 | If a \file{.syn} file exists for the current |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 574 | chapter (or for the entire document in \code{howto} documents), a |
| 575 | \env{synopsistable} is created with the contents loaded from the |
| 576 | \file{.syn} file. |
| 577 | \end{macrodesc} |
| 578 | |
| 579 | |
| 580 | \subsection{Table Markup} |
| 581 | |
| 582 | There are three general-purpose table environments defined which |
| 583 | should be used whenever possible. These environments are defined |
| 584 | to provide tables of specific widths and some convenience for |
| 585 | formatting. These environments are not meant to be general |
| 586 | replacements for the standard \LaTeX{} table environments, but can |
| 587 | be used for an advantage when the documents are processed using |
| 588 | the tools for Python documentation processing. In particular, the |
| 589 | generated HTML looks good! There is also an advantage for the |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 590 | eventual conversion of the documentation to SGML (see section |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 591 | \ref{futures}, ``Future Directions''). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 592 | |
| 593 | Each environment is named \env{table\var{cols}}, where \var{cols} |
| 594 | is the number of columns in the table specified in lower-case |
| 595 | Roman numerals. Within each of these environments, an additional |
| 596 | macro, \macro{line\var{cols}}, is defined, where \var{cols} |
| 597 | matches the \var{cols} value of the corresponding table |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 598 | environment. These are supported for \var{cols} values of |
| 599 | \code{ii}, \code{iii}, and \code{iv}. These environments are all |
| 600 | built on top of the \env{tabular} environment. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 601 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 602 | \begin{envdesc}{tableii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 603 | Create a two-column table using the \LaTeX{} column specifier |
| 604 | \var{colspec}. The column specifier should indicate vertical |
| 605 | bars between columns as appropriate for the specific table, but |
| 606 | should not specify vertical bars on the outside of the table |
| 607 | (that is considered a stylesheet issue). The \var{col1font} |
| 608 | parameter is used as a stylistic treatment of the first column |
| 609 | of the table: the first column is presented as |
| 610 | \code{\e\var{col1font}\{column1\}}. To avoid treating the first |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 611 | column specially, \var{col1font} may be \samp{textrm}. The |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 612 | column headings are taken from the values \var{heading1} and |
| 613 | \var{heading2}. |
| 614 | \end{envdesc} |
| 615 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 616 | \begin{macrodesc}{lineii}{\p{column1}\p{column2}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 617 | Create a single table row within a \env{tableii} environment. |
| 618 | The text for the first column will be generated by applying the |
| 619 | macro named by the \var{col1font} value when the \env{tableii} |
| 620 | was opened. |
| 621 | \end{macrodesc} |
| 622 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 623 | \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] | 624 | Like the \env{tableii} environment, but with a third column. |
| 625 | The heading for the third column is given by \var{heading3}. |
| 626 | \end{envdesc} |
| 627 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 628 | \begin{macrodesc}{lineiii}{\p{column1}\p{column2}\p{column3}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 629 | Like the \macro{lineii} macro, but with a third column. The |
| 630 | text for the third column is given by \var{column3}. |
| 631 | \end{macrodesc} |
| 632 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 633 | \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] | 634 | Like the \env{tableiii} environment, but with a fourth column. |
| 635 | The heading for the fourth column is given by \var{heading4}. |
| 636 | \end{envdesc} |
| 637 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 638 | \begin{macrodesc}{lineiv}{\p{column1}\p{column2}\p{column3}\p{column4}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 639 | Like the \macro{lineiii} macro, but with a fourth column. The |
| 640 | text for the fourth column is given by \var{column4}. |
| 641 | \end{macrodesc} |
| 642 | |
| 643 | |
| 644 | An additional table-like environment is \env{synopsistable}. The |
| 645 | table generated by this environment contains two columns, and each |
| 646 | row is defined by an alternate definition of |
| 647 | \macro{modulesynopsis}. This environment is not normally use by |
| 648 | the user, but is created by the \macro{localmoduletable} macro. |
| 649 | |
| 650 | |
| 651 | \subsection{Reference List Markup \label{references}} |
| 652 | |
| 653 | Many sections include a list of references to module documentation |
| 654 | or external documents. These lists are created using the |
| 655 | \env{seealso} environment. This environment defines some |
| 656 | additional macros to support creating reference entries in a |
| 657 | reasonable manner. |
| 658 | |
| 659 | \begin{envdesc}{seealso}{} |
| 660 | This environment creates a ``See also:'' heading and defines the |
| 661 | markup used to describe individual references. |
| 662 | \end{envdesc} |
| 663 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 664 | \begin{macrodesc}{seemodule}{\op{key}\p{name}\p{why}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 665 | Refer to another module. \var{why} should be a brief |
| 666 | explanation of why the reference may be interesting. The module |
| 667 | name is given in \var{name}, with the link key given in |
| 668 | \var{key} if necessary. In the HTML and PDF conversions, the |
| 669 | module name will be a hyperlink to the referred-to module. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 670 | \strong{Note:} The module must be documented in the same |
| 671 | document (the corresponding \macro{declaremodule} is required). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 672 | \end{macrodesc} |
| 673 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 674 | \begin{macrodesc}{seetext}{\p{text}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 675 | Add arbitrary text \var{text} to the ``See also:'' list. This |
| 676 | can be used to refer to off-line materials or on-line materials |
| 677 | using the \macro{url} macro. |
| 678 | \end{macrodesc} |
| 679 | |
| 680 | |
| 681 | \subsection{Index-generating Markup \label{indexing}} |
| 682 | |
| 683 | Effective index generation for technical documents can be very |
| 684 | difficult, especially for someone familliar with the topic but not |
| 685 | the creation of indexes. Much of the difficulty arises in the |
| 686 | area of terminology: including the terms an expert would use for a |
| 687 | concept is not sufficient. Coming up with the terms that a novice |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 688 | would look up is fairly difficult for an author who, typically, is |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 689 | an expert in the area she is writing on. |
| 690 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 691 | The truly difficult aspects of index generation are not areas with |
| 692 | which the documentation tools can help. However, ease |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 693 | of producing the index once content decisions are make is within |
| 694 | the scope of the tools. Markup is provided which the processing |
| 695 | software is able to use to generate a variety of kinds of index |
| 696 | entry with minimal effort. Additionally, many of the environments |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 697 | described in section \ref{info-units}, ``Information Units,'' will |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 698 | generate appropriate entries into the general and module indexes. |
| 699 | |
| 700 | The following macro can be used to control the generation of index |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 701 | data, and should be used in the document preamble: |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 702 | |
| 703 | \begin{macrodesc}{makemodindex}{} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 704 | This should be used in the document preamble if a ``Module |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 705 | Index'' is desired for a document containing reference material |
| 706 | on many modules. This causes a data file |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 707 | \code{lib\var{jobname}.idx} to be created from the |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 708 | \macro{declaremodule} macros. This file can be processed by the |
| 709 | \program{makeindex} program to generate a file which can be |
| 710 | \macro{input} into the document at the desired location of the |
| 711 | module index. |
| 712 | \end{macrodesc} |
| 713 | |
| 714 | There are a number of macros that are useful for adding index |
| 715 | entries for particular concepts, many of which are specific to |
| 716 | programming languages or even Python. |
| 717 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 718 | \begin{macrodesc}{bifuncindex}{\p{name}} |
Fred Drake | ec8b905 | 1999-04-23 20:01:17 +0000 | [diff] [blame] | 719 | Add an index entry referring to a built-in function named |
| 720 | \var{name}; parentheses should not be included after |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 721 | \var{name}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 722 | \end{macrodesc} |
| 723 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 724 | \begin{macrodesc}{exindex}{\p{exception}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 725 | Add a reference to an exception named \var{exception}. The |
| 726 | exception may be either string- or class-based. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 727 | \end{macrodesc} |
| 728 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 729 | \begin{macrodesc}{kwindex}{\p{keyword}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 730 | Add a reference to a language keyword (not a keyword parameter |
| 731 | in a function or method call). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 732 | \end{macrodesc} |
| 733 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 734 | \begin{macrodesc}{obindex}{\p{object type}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 735 | Add an index entry for a built-in object type. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 736 | \end{macrodesc} |
| 737 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 738 | \begin{macrodesc}{opindex}{\p{operator}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 739 | Add a reference to an operator, such as \samp{+}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 740 | \end{macrodesc} |
| 741 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 742 | \begin{macrodesc}{refmodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 743 | Add an index entry for module \var{module}; if \var{module} |
| 744 | contains an underscore, the optional parameter \var{key} should |
| 745 | be provided as the same string with underscores removed. An |
| 746 | index entry ``\var{module} (module)'' will be generated. This |
| 747 | is intended for use with non-standard modules implemented in |
| 748 | Python. |
| 749 | \end{macrodesc} |
| 750 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 751 | \begin{macrodesc}{refexmodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 752 | As for \macro{refmodindex}, but the index entry will be |
| 753 | ``\var{module} (extension module).'' This is intended for use |
| 754 | with non-standard modules not implemented in Python. |
| 755 | \end{macrodesc} |
| 756 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 757 | \begin{macrodesc}{refbimodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 758 | As for \macro{refmodindex}, but the index entry will be |
| 759 | ``\var{module} (built-in module).'' This is intended for use |
| 760 | with standard modules not implemented in Python. |
| 761 | \end{macrodesc} |
| 762 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 763 | \begin{macrodesc}{refstmodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 764 | As for \macro{refmodindex}, but the index entry will be |
| 765 | ``\var{module} (standard module).'' This is intended for use |
| 766 | with standard modules implemented in Python. |
| 767 | \end{macrodesc} |
| 768 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 769 | \begin{macrodesc}{stindex}{\p{statement}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 770 | Add an index entry for a statement type, such as \keyword{print} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 771 | or \keyword{try}/\keyword{finally}. |
| 772 | |
| 773 | XXX Need better examples of difference from \macro{kwindex}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 774 | \end{macrodesc} |
| 775 | |
| 776 | |
| 777 | Additional macros are provided which are useful for conveniently |
| 778 | creating general index entries which should appear at many places |
| 779 | in the index by rotating a list of words. These are simple macros |
| 780 | that simply use \macro{index} to build some number of index |
| 781 | entries. Index entries build using these macros contain both |
| 782 | primary and secondary text. |
| 783 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 784 | \begin{macrodesc}{indexii}{\p{word1}\p{word2}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 785 | Build two index entries. This is exactly equivalent to using |
| 786 | \code{\e index\{\var{word1}!\var{word2}\}} and |
| 787 | \code{\e index\{\var{word2}!\var{word1}\}}. |
| 788 | \end{macrodesc} |
| 789 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 790 | \begin{macrodesc}{indexiii}{\p{word1}\p{word2}\p{word3}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 791 | Build three index entries. This is exactly equivalent to using |
| 792 | \code{\e index\{\var{word1}!\var{word2} \var{word3}\}}, |
| 793 | \code{\e index\{\var{word2}!\var{word3}, \var{word1}\}}, and |
| 794 | \code{\e index\{\var{word3}!\var{word1} \var{word2}\}}. |
| 795 | \end{macrodesc} |
| 796 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 797 | \begin{macrodesc}{indexiv}{\p{word1}\p{word2}\p{word3}\p{word4}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 798 | Build four index entries. This is exactly equivalent to using |
| 799 | \code{\e index\{\var{word1}!\var{word2} \var{word3} \var{word4}\}}, |
| 800 | \code{\e index\{\var{word2}!\var{word3} \var{word4}, \var{word1}\}}, |
| 801 | \code{\e index\{\var{word3}!\var{word4}, \var{word1} \var{word2}\}}, |
| 802 | and |
| 803 | \code{\e index\{\var{word4}!\var{word1} \var{word2} \var{word3}\}}. |
| 804 | \end{macrodesc} |
| 805 | |
| 806 | |
| 807 | \section{Special Names} |
| 808 | |
| 809 | Many special names are used in the Python documentation, including |
| 810 | the names of operating systems, programming languages, standards |
| 811 | bodies, and the like. Many of these were assigned \LaTeX{} macros |
| 812 | at some point in the distant past, and these macros lived on long |
| 813 | past their usefulness. In the current markup, these entities are |
| 814 | not assigned any special markup, but the preferred spellings are |
| 815 | given here to aid authors in maintaining the consistency of |
| 816 | presentation in the Python documentation. |
| 817 | |
| 818 | \begin{description} |
| 819 | \item[POSIX] |
| 820 | The name assigned to a particular group of standards. This is |
| 821 | always uppercase. |
| 822 | |
| 823 | \item[Python] |
| 824 | The name of our favorite programming language is always |
| 825 | capitalized. |
| 826 | \end{description} |
| 827 | |
| 828 | |
| 829 | \section{Processing Tools} |
| 830 | |
| 831 | \subsection{External Tools} |
| 832 | |
| 833 | Many tools are needed to be able to process the Python |
| 834 | documentation if all supported formats are required. This |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 835 | section lists the tools used and when each is required. Consult |
| 836 | the \file{Doc/README} file to see if there are specific version |
| 837 | requirements for any of these. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 838 | |
| 839 | \begin{description} |
| 840 | \item[\program{dvips}] |
| 841 | This program is a typical part of \TeX{} installations. It is |
| 842 | used to generate PostScript from the ``device independent'' |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 843 | \file{.dvi} files. It is needed for the conversion to |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 844 | PostScript. |
| 845 | |
| 846 | \item[\program{emacs}] |
| 847 | Emacs is the kitchen sink of programmers' editors, and a damn |
| 848 | fine kitchen sink it is. It also comes with some of the |
| 849 | processing needed to support the proper menu structures for |
| 850 | Texinfo documents when an info conversion is desired. This is |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 851 | needed for the info conversion. Using \program{xemacs} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 852 | instead of FSF \program{emacs} may lead to instability in the |
| 853 | conversion, but that's because nobody seems to maintain the |
| 854 | Emacs Texinfo code in a portable manner. |
| 855 | |
| 856 | \item[\program{latex}] |
| 857 | This is a world-class typesetter by Donald Knuth. It is used |
| 858 | for the conversion to PostScript, and is needed for the HTML |
| 859 | conversion as well (\LaTeX2HTML requires one of the |
| 860 | intermediate files it creates). |
| 861 | |
| 862 | \item[\program{latex2html}] |
| 863 | Probably the longest Perl script anyone ever attempted to |
| 864 | maintain. This converts \LaTeX{} documents to HTML documents, |
| 865 | and does a pretty reasonable job. It is required for the |
| 866 | conversions to HTML and GNU info. |
| 867 | |
| 868 | \item[\program{lynx}] |
| 869 | This is a text-mode Web browser which includes an |
| 870 | HTML-to-plain text conversion. This is used to convert |
| 871 | \code{howto} documents to text. |
| 872 | |
| 873 | \item[\program{make}] |
| 874 | Just about any version should work for the standard documents, |
| 875 | but GNU \program{make} is required for the experimental |
| 876 | processes in \file{Doc/tools/sgmlconv/}, at least while |
| 877 | they're experimental. |
| 878 | |
| 879 | \item[\program{makeindex}] |
| 880 | This is a standard program for converting \LaTeX{} index data |
| 881 | to a formatted index; it should be included with all \LaTeX{} |
| 882 | installations. It is needed for the PDF and PostScript |
| 883 | conversions. |
| 884 | |
| 885 | \item[\program{makeinfo}] |
| 886 | GNU \program{makeinfo} is used to convert Texinfo documents to |
| 887 | GNU info files. Since Texinfo is used as an intermediate |
| 888 | format in the info conversion, this program is needed in that |
| 889 | conversion. |
| 890 | |
| 891 | \item[\program{pdflatex}] |
| 892 | pdf\TeX{} is a relatively new variant of \TeX, and is used to |
| 893 | generate the PDF version of the manuals. It is typically |
| 894 | installed as part of most of the large \TeX{} distributions. |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 895 | \program{pdflatex} is pdf\TeX{} using the \LaTeX{} format. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 896 | |
| 897 | \item[\program{perl}] |
| 898 | Perl is required for \LaTeX2HTML{} and one of the scripts used |
| 899 | to post-process \LaTeX2HTML output, as well as the |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 900 | HTML-to-Texinfo conversion. This is required for |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 901 | the HTML and GNU info conversions. |
| 902 | |
| 903 | \item[\program{python}] |
| 904 | Python is used for many of the scripts in the |
| 905 | \file{Doc/tools/} directory; it is required for all |
| 906 | conversions. This shouldn't be a problem if you're interested |
| 907 | in writing documentation for Python! |
| 908 | \end{description} |
| 909 | |
| 910 | |
| 911 | \subsection{Internal Tools} |
| 912 | |
| 913 | This section describes the various scripts that are used to |
| 914 | implement various stages of document processing or to orchestrate |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 915 | entire build sequences. Most of these tools are only useful |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 916 | in the context of building the standard documentation, but some |
| 917 | are more general. |
| 918 | |
| 919 | \begin{description} |
| 920 | \item[\program{mkhowto}] |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 921 | This is the primary script used to format third-party |
| 922 | documents. It contains all the logic needed to ``get it |
| 923 | right.'' The proper way to use this script is to make a |
| 924 | symbolic link to it or run it in place; the actual script file |
| 925 | must be stored as part of the documentation source tree, |
| 926 | though it may be used to format documents outside the |
| 927 | tree. Use \program{mkhowto --help} for a list of command line |
| 928 | options. |
| 929 | |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 930 | \program{mkhowto} can be used for both \code{howto} and |
| 931 | \code{manual} class documents. (For the later, be sure to get |
| 932 | the latest version from the Python CVS repository rather than |
| 933 | the version distributed in the \file{latex-1.5.2.tgz} source |
| 934 | archive.) |
| 935 | |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 936 | XXX Need more here. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 937 | \end{description} |
| 938 | |
| 939 | |
| 940 | \section{Future Directions \label{futures}} |
| 941 | |
| 942 | The history of the Python documentation is full of changes, most of |
| 943 | which have been fairly small and evolutionary. There has been a |
| 944 | great deal of discussion about making large changes in the markup |
| 945 | languages and tools used to process the documentation. This section |
| 946 | deals with the nature of the changes and what appears to be the most |
| 947 | likely path of future development. |
| 948 | |
| 949 | \subsection{Structured Documentation \label{structured}} |
| 950 | |
| 951 | Most of the small changes to the \LaTeX{} markup have been made |
| 952 | with an eye to divorcing the markup from the presentation, making |
| 953 | both a bit more maintainable. Over the course of 1998, a large |
| 954 | number of changes were made with exactly this in mind; previously, |
| 955 | changes had been made but in a less systematic manner and with |
| 956 | more concern for not needing to update the existing content. The |
| 957 | result has been a highly structured and semantically loaded markup |
| 958 | language implemented in \LaTeX. With almost no basic \TeX{} or |
| 959 | \LaTeX{} markup in use, however, the markup syntax is about the |
| 960 | only evidence of \LaTeX{} in the actual document sources. |
| 961 | |
| 962 | One side effect of this is that while we've been able to use |
| 963 | standard ``engines'' for manipulating the documents, such as |
| 964 | \LaTeX{} and \LaTeX2HTML, most of the actual transformations have |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 965 | been created specifically for Python. The \LaTeX{} document |
| 966 | classes and \LaTeX2HTML support are both complete implementations |
| 967 | of the specific markup designed for these documents. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 968 | |
| 969 | Combining highly customized markup with the somewhat esoteric |
| 970 | systems used to process the documents leads us to ask some |
| 971 | questions: Can we do this more easily? and, Can we do this |
| 972 | better? After a great deal of discussion with the community, we |
| 973 | have determined that actively pursuing modern structured |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 974 | documentation systems is worth some investment of time. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 975 | |
| 976 | There appear to be two real contenders in this arena: the Standard |
| 977 | General Markup Language (SGML), and the Extensible Markup Language |
| 978 | (XML). Both of these standards have advantages and disadvantages, |
| 979 | and many advantages are shared. |
| 980 | |
| 981 | SGML offers advantages which may appeal most to authors, |
| 982 | especially those using ordinary text editors. There are also |
| 983 | additional abilities to define content models. A number of |
| 984 | high-quality tools with demonstrated maturity is available, but |
| 985 | most are not free; for those which are, portability issues remain |
| 986 | a problem. |
| 987 | |
| 988 | The advantages of XML include the availability of a large number |
| 989 | of evolving tools. Unfortunately, many of the associated |
| 990 | standards are still evolving, and the tools will have to follow |
| 991 | along. This means that developing a robust tool set that uses |
| 992 | more than the basic XML 1.0 recommendation is not possible in the |
| 993 | short term. The promised availability of a wide variety of |
| 994 | high-quality tools which support some of the most important |
| 995 | related standards is not immediate. Many tools are likely to be |
| 996 | free. |
| 997 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 998 | XXX Eventual migration to SGML/XML. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 999 | |
| 1000 | \subsection{Discussion Forums \label{discussion}} |
| 1001 | |
| 1002 | Discussion of the future of the Python documentation and related |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 1003 | topics takes place in the Documentation Special Interest Group, or |
| 1004 | ``Doc-SIG.'' Information on the group, including mailing list |
| 1005 | archives and subscription information, is available at |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1006 | \url{http://www.python.org/sigs/doc-sig/}. The SIG is open to all |
| 1007 | interested parties. |
| 1008 | |
| 1009 | Comments and bug reports on the standard documents should be sent |
| 1010 | to \email{python-docs@python.org}. This may include comments |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1011 | about formatting, content, grammatical and spelling errors, or |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 1012 | this document. You can also send comments on this document |
| 1013 | directly to the author at \email{fdrake@acm.org}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1014 | |
| 1015 | \end{document} |