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 | 633a8d9 | 2000-06-30 15:54:18 +0000 | [diff] [blame] | 13 | BeOpen PythonLabs \\ |
| 14 | E-mail: \email{fdrake@beopen.com} |
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 |
| 24 | The Python language documentation has a substantial body of |
| 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 |
| 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} |
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 |
| 163 | Python documentation is the while \TeX{} is unstructured, \LaTeX{} was |
| 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 |
| 194 | printed components of the document marked up structurally. |
| 195 | |
| 196 | XXX This section will discuss what the markup looks like, and |
| 197 | explain the difference between an environment and a macro. |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 198 | |
| 199 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 200 | \section{Document Classes \label{classes}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 201 | |
| 202 | Two \LaTeX{} document classes are defined specifically for use with |
| 203 | the Python documentation. The \code{manual} class is for large |
| 204 | documents which are sectioned into chapters, and the \code{howto} |
| 205 | class is for smaller documents. |
| 206 | |
| 207 | The \code{manual} documents are larger and are used for most of the |
| 208 | standard documents. This document class is based on the standard |
| 209 | \LaTeX{} \code{report} class and is formatted very much like a long |
Fred Drake | 698d520 | 1999-11-10 15:54:57 +0000 | [diff] [blame] | 210 | technical report. The \citetitle[../ref/ref.html]{Python Reference |
| 211 | Manual} is a good example of a \code{manual} document, and the |
| 212 | \citetitle[../lib/lib.html]{Python Library Reference} is a large |
| 213 | example. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 214 | |
| 215 | The \code{howto} documents are shorter, and don't have the large |
| 216 | structure of the \code{manual} documents. This class is based on |
| 217 | the standard \LaTeX{} \code{article} class and is formatted somewhat |
| 218 | like the Linux Documentation Project's ``HOWTO'' series as done |
| 219 | originally using the LinuxDoc software. The original intent for the |
| 220 | document class was that it serve a similar role as the LDP's HOWTO |
| 221 | series, but the applicability of the class turns out to be somewhat |
| 222 | more broad. This class is used for ``how-to'' documents (this |
| 223 | document is an example) and for shorter reference manuals for small, |
| 224 | fairly cohesive module libraries. Examples of the later use include |
Fred Drake | 698d520 | 1999-11-10 15:54:57 +0000 | [diff] [blame] | 225 | the standard \citetitle[../mac/mac.html]{Macintosh Library Modules} |
| 226 | and |
Fred Drake | 6a547c7 | 2000-09-15 22:11:24 +0000 | [diff] [blame^] | 227 | \citetitle[http://starship.python.net/crew/fdrake/manuals/krb5py/krb5py.html]{Using |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 228 | Kerberos from Python}, which contains reference material for an |
| 229 | extension package. These documents are roughly equivalent to a |
| 230 | single chapter from a larger work. |
| 231 | |
| 232 | |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 233 | \section{Special Markup Constructs} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 234 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 235 | The Python document classes define a lot of new environments and |
| 236 | macros. This section contains the reference material for these |
| 237 | facilities. |
| 238 | |
Fred Drake | af2b714 | 2000-09-14 20:11:05 +0000 | [diff] [blame] | 239 | \subsection{Markup for the Preamble \label{preamble-info}} |
| 240 | |
| 241 | \begin{macrodesc}{release}{\p{ver}} |
| 242 | Set the version number for the software described in the |
| 243 | document. |
| 244 | \end{macrodesc} |
| 245 | |
| 246 | \begin{macrodesc}{setshortversion}{\p{sver}} |
| 247 | Specify the ``short'' version number of the documented software |
| 248 | to be \var{sver}. |
| 249 | \end{macrodesc} |
| 250 | |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 251 | \subsection{Meta-information Markup \label{meta-info}} |
| 252 | |
| 253 | \begin{macrodesc}{sectionauthor}{\p{author}\p{email}} |
| 254 | Identifies the author of the current section. \var{author} |
| 255 | should be the author's name such that it can be used for |
| 256 | presentation (though it isn't), and \var{email} should be the |
| 257 | author's email address. The domain name portion of |
| 258 | the address should be lower case. |
| 259 | |
| 260 | No presentation is generated from this markup, but it is used to |
| 261 | help keep track of contributions. |
| 262 | \end{macrodesc} |
| 263 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 264 | \subsection{Information Units \label{info-units}} |
| 265 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 266 | XXX Explain terminology, or come up with something more ``lay.'' |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 267 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 268 | There are a number of environments used to describe specific |
| 269 | features provided by modules. Each environment requires |
| 270 | parameters needed to provide basic information about what is being |
| 271 | described, and the environment content should be the description. |
| 272 | Most of these environments make entries in the general index (if |
| 273 | one is being produced for the document); if no index entry is |
| 274 | desired, non-indexing variants are available for many of these |
| 275 | environments. The environments have names of the form |
| 276 | \code{\var{feature}desc}, and the non-indexing variants are named |
| 277 | \code{\var{feature}descni}. The available variants are explicitly |
| 278 | included in the list below. |
| 279 | |
| 280 | For each of these environments, the first parameter, \var{name}, |
| 281 | provides the name by which the feature is accessed. |
| 282 | |
| 283 | Environments which describe features of objects within a module, |
| 284 | such as object methods or data attributes, allow an optional |
| 285 | \var{type name} parameter. When the feature is an attribute of |
| 286 | class instances, \var{type name} only needs to be given if the |
| 287 | class was not the most recently described class in the module; the |
| 288 | \var{name} value from the most recent \env{classdesc} is implied. |
| 289 | For features of built-in or extension types, the \var{type name} |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 290 | value should always be provided. Another special case includes |
| 291 | methods and members of general ``protocols,'' such as the |
| 292 | formatter and writer protocols described for the |
| 293 | \module{formatter} module: these may be documented without any |
| 294 | specific implementation classes, and will always require the |
| 295 | \var{type name} parameter to be provided. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 296 | |
| 297 | \begin{envdesc}{datadesc}{\p{name}} |
| 298 | This environment is used to document global data in a module, |
| 299 | including both variables and values used as ``defined |
| 300 | constants.'' Class and object attributes are not documented |
| 301 | using this environment. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 302 | \end{envdesc} |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 303 | \begin{envdesc}{datadescni}{\p{name}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 304 | Like \env{datadesc}, but without creating any index entries. |
| 305 | \end{envdesc} |
| 306 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 307 | \begin{envdesc}{excdesc}{\p{name}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 308 | Describe an exception. This may be either a string exception or |
| 309 | a class exception. |
| 310 | \end{envdesc} |
| 311 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 312 | \begin{envdesc}{funcdesc}{\p{name}\p{parameters}} |
| 313 | Describe a module-level function. \var{parameters} should |
| 314 | not include the parentheses used in the call syntax. Object |
| 315 | methods are not documented using this environment. Bound object |
| 316 | methods placed in the module namespace as part of the public |
| 317 | interface of the module are documented using this, as they are |
| 318 | equivalent to normal functions for most purposes. |
| 319 | |
| 320 | The description should include information about the parameters |
| 321 | required and how they are used (especially whether mutable |
| 322 | objects passed as parameters are modified), side effects, and |
| 323 | possible exceptions. A small example may be provided. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 324 | \end{envdesc} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 325 | \begin{envdesc}{funcdescni}{\p{name}\p{parameters}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 326 | Like \env{funcdesc}, but without creating any index entries. |
| 327 | \end{envdesc} |
| 328 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 329 | \begin{envdesc}{classdesc}{\p{name}\p{constructor parameters}} |
| 330 | Describe a class and its constructor. \var{constructor |
| 331 | parameters} should not include the \var{self} parameter or |
| 332 | the parentheses used in the call syntax. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 333 | \end{envdesc} |
| 334 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 335 | \begin{envdesc}{memberdesc}{\op{type name}\p{name}} |
| 336 | Describe an object data attribute. The description should |
| 337 | include information about the type of the data to be expected |
| 338 | and whether it may be changed directly. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 339 | \end{envdesc} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 340 | \begin{envdesc}{memberdescni}{\op{type name}\p{name}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 341 | Like \env{memberdesc}, but without creating any index entries. |
| 342 | \end{envdesc} |
| 343 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 344 | \begin{envdesc}{methoddesc}{\op{type name}\p{name}\p{parameters}} |
| 345 | Describe an object method. \var{parameters} should not include |
| 346 | the \var{self} parameter or the parentheses used in the call |
| 347 | syntax. The description should include similar information to |
| 348 | that described for \env{funcdesc}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 349 | \end{envdesc} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 350 | \begin{envdesc}{methoddescni}{\op{type name}\p{name}\p{parameters}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 351 | Like \env{methoddesc}, but without creating any index entries. |
| 352 | \end{envdesc} |
| 353 | |
| 354 | |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 355 | \subsection{Showing Code Examples} |
| 356 | |
| 357 | Examples of Python source code or interactive sessions are |
| 358 | represented as \env{verbatim} environments. This environment |
| 359 | is a standard part of \LaTeX{}. It is important to only use |
| 360 | spaces for indentation in code examples since \TeX{} drops tabs |
| 361 | instead of converting them to spaces. |
| 362 | |
| 363 | Representing an interactive session requires including the prompts |
| 364 | and output along with the Python code. No special markup is |
| 365 | required for interactive sessions. |
| 366 | |
| 367 | Within the \env{verbatim} environment, characters special to |
| 368 | \LaTeX{} do not need to be specially marked in any way. The entire |
| 369 | example will be presented in a monospaced font; no attempt at |
| 370 | ``pretty-printing'' is made, as the environment must work for |
| 371 | non-Python code and non-code displays. |
| 372 | |
| 373 | The Python Documentation Special Interest Group has discussed a |
| 374 | number of approaches to creating pretty-printed code displays and |
| 375 | interactive sessions; see the Doc-SIG area on the Python Web site |
| 376 | for more information on this topic. |
| 377 | |
| 378 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 379 | \subsection{Inline Markup} |
| 380 | |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 381 | The macros described in this section are used to mark just about |
| 382 | anything interesting in the document text. They may be used in |
| 383 | headings (though anything involving hyperlinks should be avoided |
| 384 | there) as well as in the body text. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 385 | |
| 386 | \begin{macrodesc}{bfcode}{\p{text}} |
| 387 | Like \macro{code}, but also makes the font bold-face. |
| 388 | \end{macrodesc} |
| 389 | |
| 390 | \begin{macrodesc}{cdata}{\p{name}} |
| 391 | The name of a C-language variable. |
| 392 | \end{macrodesc} |
| 393 | |
| 394 | \begin{macrodesc}{cfunction}{\p{name}} |
| 395 | The name of a C-language function. \var{name} should include the |
| 396 | function name and the trailing parentheses. |
| 397 | \end{macrodesc} |
| 398 | |
| 399 | \begin{macrodesc}{character}{\p{char}} |
| 400 | A character when discussing the character rather than a one-byte |
| 401 | string value. The character will be typeset as with \macro{samp}. |
| 402 | \end{macrodesc} |
| 403 | |
Fred Drake | 29a710f | 1999-11-10 22:51:18 +0000 | [diff] [blame] | 404 | \begin{macrodesc}{citetitle}{\op{url}\p{title}} |
| 405 | A title for a referenced publication. If \var{url} is specified, |
| 406 | the title will be made into a hyperlink when formatted as HTML. |
| 407 | \end{macrodesc} |
| 408 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 409 | \begin{macrodesc}{class}{\p{name}} |
| 410 | A class name; a dotted name may be used. |
| 411 | \end{macrodesc} |
| 412 | |
| 413 | \begin{macrodesc}{code}{\p{text}} |
| 414 | A short code fragment or literal constant value. Typically, it |
| 415 | should not include any spaces since no quotation marks are |
| 416 | added. |
| 417 | \end{macrodesc} |
| 418 | |
| 419 | \begin{macrodesc}{constant}{\p{name}} |
| 420 | The name of a ``defined'' constant. This may be a C-language |
| 421 | \code{\#define} or a Python variable that is not intended to be |
| 422 | changed. |
| 423 | \end{macrodesc} |
| 424 | |
| 425 | \begin{macrodesc}{ctype}{\p{name}} |
| 426 | The name of a C \keyword{typedef} or structure. For structures |
| 427 | defined without a \keyword{typedef}, use \code{\e ctype\{struct |
| 428 | struct_tag\}} to make it clear that the \keyword{struct} is |
| 429 | required. |
| 430 | \end{macrodesc} |
| 431 | |
| 432 | \begin{macrodesc}{deprecated}{\p{version}\p{what to do}} |
| 433 | Declare whatever is being described as being deprecated starting |
| 434 | with release \var{version}. The text given as \var{what to do} |
| 435 | should recommend something to use instead. |
| 436 | \end{macrodesc} |
| 437 | |
| 438 | \begin{macrodesc}{dfn}{\p{term}} |
| 439 | Mark the defining instance of \var{term} in the text. (No index |
| 440 | entries are generated.) |
| 441 | \end{macrodesc} |
| 442 | |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 443 | \begin{macrodesc}{e}{} |
| 444 | Produces a backslash. This is convenient in \macro{code} and |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 445 | similar macros, and is only defined there. To create a |
Fred Drake | 2b85341 | 2000-04-11 19:08:30 +0000 | [diff] [blame] | 446 | backslash in ordinary text (such as the contents of the |
| 447 | \macro{file} macro), use the standard \macro{textbackslash} macro. |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 448 | \end{macrodesc} |
| 449 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 450 | \begin{macrodesc}{email}{\p{address}} |
| 451 | An email address. Note that this is \emph{not} hyperlinked in |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 452 | any of the possible output formats. The domain name portion of |
| 453 | the address should be lower case. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 454 | \end{macrodesc} |
| 455 | |
| 456 | \begin{macrodesc}{emph}{\p{text}} |
| 457 | Emphasized text; this will be presented in an italic font. |
| 458 | \end{macrodesc} |
| 459 | |
| 460 | \begin{macrodesc}{envvar}{\p{name}} |
| 461 | An environment variable. Index entries are generated. |
| 462 | \end{macrodesc} |
| 463 | |
| 464 | \begin{macrodesc}{exception}{\p{name}} |
| 465 | The name of an exception. A dotted name may be used. |
| 466 | \end{macrodesc} |
| 467 | |
| 468 | \begin{macrodesc}{file}{\p{file or dir}} |
| 469 | The name of a file or directory. In the PDF and PostScript |
| 470 | outputs, single quotes and a font change are used to indicate |
| 471 | the file name, but no quotes are used in the HTML output. |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 472 | \strong{Warning:} The \macro{file} macro cannot be used in the |
| 473 | content of a section title due to processing limitations. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 474 | \end{macrodesc} |
| 475 | |
| 476 | \begin{macrodesc}{filenq}{\p{file or dir}} |
| 477 | Like \macro{file}, but single quotes are never used. This can |
| 478 | be used in conjunction with tables if a column will only contain |
| 479 | file or directory names. |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 480 | \strong{Warning:} The \macro{filenq} macro cannot be used in the |
| 481 | content of a section title due to processing limitations. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 482 | \end{macrodesc} |
| 483 | |
| 484 | \begin{macrodesc}{function}{\p{name}} |
| 485 | The name of a Python function; dotted names may be used. |
| 486 | \end{macrodesc} |
| 487 | |
| 488 | \begin{macrodesc}{kbd}{\p{key sequence}} |
| 489 | Mark a sequence of keystrokes. What form \var{key sequence} |
| 490 | takes may depend on platform- or application-specific |
| 491 | conventions. For example, an \program{xemacs} key sequence |
| 492 | may be marked like \code{\e kbd\{C-x C-f\}}. |
| 493 | \end{macrodesc} |
| 494 | |
| 495 | \begin{macrodesc}{keyword}{\p{name}} |
| 496 | The name of a keyword in a programming language. |
| 497 | \end{macrodesc} |
| 498 | |
| 499 | \begin{macrodesc}{makevar}{\p{name}} |
| 500 | The name of a \program{make} variable. |
| 501 | \end{macrodesc} |
| 502 | |
| 503 | \begin{macrodesc}{manpage}{\p{name}\p{section}} |
| 504 | A reference to a \UNIX{} manual page. |
| 505 | \end{macrodesc} |
| 506 | |
| 507 | \begin{macrodesc}{member}{\p{name}} |
| 508 | The name of a data attribute of an object. |
| 509 | \end{macrodesc} |
| 510 | |
| 511 | \begin{macrodesc}{method}{\p{name}} |
| 512 | The name of a method of an object. \var{name} should include the |
| 513 | method name and the trailing parentheses. A dotted name may be |
| 514 | used. |
| 515 | \end{macrodesc} |
| 516 | |
| 517 | \begin{macrodesc}{mimetype}{\p{name}} |
| 518 | The name of a MIME type. |
| 519 | \end{macrodesc} |
| 520 | |
| 521 | \begin{macrodesc}{module}{\p{name}} |
Fred Drake | 2b85341 | 2000-04-11 19:08:30 +0000 | [diff] [blame] | 522 | The name of a module; a dotted name may be used. This should |
| 523 | also be used for package names. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 524 | \end{macrodesc} |
| 525 | |
| 526 | \begin{macrodesc}{newsgroup}{\p{name}} |
| 527 | The name of a USENET newsgroup. |
| 528 | \end{macrodesc} |
| 529 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 530 | \begin{macrodesc}{program}{\p{name}} |
| 531 | The name of an executable program. This may differ from the |
| 532 | file name for the executable for some platforms. In particular, |
| 533 | the \file{.exe} (or other) extension should be omitted for DOS |
| 534 | and Windows programs. |
| 535 | \end{macrodesc} |
| 536 | |
Fred Drake | 29a710f | 1999-11-10 22:51:18 +0000 | [diff] [blame] | 537 | \begin{macrodesc}{programopt}{\p{option}} |
Fred Drake | ce44498 | 2000-04-11 18:52:52 +0000 | [diff] [blame] | 538 | A command-line option to an executable program. Use this only |
| 539 | for ``shot'' options, and include the leading hyphen. |
| 540 | \end{macrodesc} |
| 541 | |
| 542 | \begin{macrodesc}{longprogramopt}{\p{option}} |
| 543 | A long command-line option to an executable program. This |
| 544 | should only be used for long option names which will be prefixed |
| 545 | by two hyphens; the hyphens should not be provided as part of |
| 546 | \var{option}. |
Fred Drake | 29a710f | 1999-11-10 22:51:18 +0000 | [diff] [blame] | 547 | \end{macrodesc} |
| 548 | |
Fred Drake | 08c5d0c | 2000-09-11 05:22:30 +0000 | [diff] [blame] | 549 | \begin{macrodesc}{pep}{\p{number}} |
| 550 | A reference to a Python Enhancement Proposal. This generates |
| 551 | appropriate index entries. The text \samp{PEP \var{number}} is |
| 552 | generated; in the HTML output, this text is a hyperlink to an |
| 553 | online copy of the specified PEP. |
| 554 | \end{macrodesc} |
| 555 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 556 | \begin{macrodesc}{refmodule}{\op{key}\p{name}} |
| 557 | Like \macro{module}, but create a hyperlink to the documentation |
| 558 | for the named module. Note that the corresponding |
| 559 | \macro{declaremodule} must be in the same document. If the |
| 560 | \macro{declaremodule} defines a module key different from the |
| 561 | module name, it must also be provided as \var{key} to the |
| 562 | \macro{refmodule} macro. |
| 563 | \end{macrodesc} |
| 564 | |
| 565 | \begin{macrodesc}{regexp}{\p{string}} |
| 566 | Mark a regular expression. |
| 567 | \end{macrodesc} |
| 568 | |
| 569 | \begin{macrodesc}{rfc}{\p{number}} |
| 570 | A reference to an Internet Request for Comments. This generates |
| 571 | appropriate index entries. The text \samp{RFC \var{number}} is |
| 572 | generated; in the HTML output, this text is a hyperlink to an |
| 573 | online copy of the specified RFC. |
| 574 | \end{macrodesc} |
| 575 | |
| 576 | \begin{macrodesc}{samp}{\p{text}} |
| 577 | A short code sample, but possibly longer than would be given |
| 578 | using \macro{code}. Since quotation marks are added, spaces are |
| 579 | acceptable. |
| 580 | \end{macrodesc} |
| 581 | |
Fred Drake | af2b714 | 2000-09-14 20:11:05 +0000 | [diff] [blame] | 582 | \begin{macrodesc}{shortversion}{} |
| 583 | The ``short'' version number of the documented software, as |
| 584 | specified using the \macro{setshortversion} macro in the |
| 585 | preamble. For Python, the short version number for a release is |
| 586 | the first three characters of the \code{sys.version} value. For |
| 587 | example, versions 2.0b1 and 2.0.1 both have a short version of |
| 588 | 2.0. This may not apply for all packages; if |
| 589 | \macro{setshortversion} is not used, this produces an empty |
| 590 | expansion. See also the \macro{version} macro. |
| 591 | \end{macrodesc} |
| 592 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 593 | \begin{macrodesc}{strong}{\p{text}} |
| 594 | Strongly emphasized text; this will be presented using a bold |
| 595 | font. |
| 596 | \end{macrodesc} |
| 597 | |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 598 | \begin{macrodesc}{url}{\p{url}} |
| 599 | A URL (or URN). The URL will be presented as text. In the HTML |
| 600 | and PDF formatted versions, the URL will also be a hyperlink. |
| 601 | This can be used when referring to external resources. Note |
| 602 | that many characters are special to \LaTeX{} and this macro |
| 603 | does not always do the right thing. In particular, the tilde |
| 604 | character (\character{\~}) is mis-handled; encoding it as a |
| 605 | hex-sequence does work, use \samp{\%7e} in place of the tilde |
| 606 | character. |
| 607 | \end{macrodesc} |
| 608 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 609 | \begin{macrodesc}{var}{\p{name}} |
| 610 | The name of a variable or formal parameter in running text. |
| 611 | \end{macrodesc} |
| 612 | |
| 613 | \begin{macrodesc}{version}{} |
Fred Drake | af2b714 | 2000-09-14 20:11:05 +0000 | [diff] [blame] | 614 | The version number of the described software, as specified using |
| 615 | \macro{release} in the preamble. See also the |
| 616 | \macro{shortversion} macro. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 617 | \end{macrodesc} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 618 | |
Fred Drake | c26cc91 | 2000-05-02 17:43:44 +0000 | [diff] [blame] | 619 | \begin{macrodesc}{versionadded}{\p{version}} |
| 620 | The version of Python which added the described feature to the |
| 621 | library or C API. This is typically added to the end of the |
| 622 | first paragraph of the description before any availability |
| 623 | notes. The location should be selected so the explanation makes |
| 624 | sense and may vary as needed. |
| 625 | \end{macrodesc} |
| 626 | |
| 627 | \begin{macrodesc}{versionchanged}{\op{explanation}\p{version}} |
| 628 | The version of Python in which the named feature was changed in |
| 629 | some way (new parameters, changed side effects, etc.). |
| 630 | \var{explanation} should be a \emph{brief} explanation of the |
| 631 | change consisting of a non-capitalized sentence fragment; a |
| 632 | period will be appended by the formatting process. |
| 633 | This is typically added to the end of the first paragraph of the |
| 634 | description before any availability notes and after |
| 635 | \macro{versionadded}. The location should be selected so the |
| 636 | explanation makes sense and may vary as needed. |
| 637 | \end{macrodesc} |
| 638 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 639 | |
| 640 | \subsection{Module-specific Markup} |
| 641 | |
| 642 | The markup described in this section is used to provide information |
| 643 | about a module being documented. A typical use of this markup |
| 644 | appears at the top of the section used to document a module. A |
| 645 | typical example might look like this: |
| 646 | |
| 647 | \begin{verbatim} |
| 648 | \section{\module{spam} --- |
| 649 | Access to the SPAM facility} |
| 650 | |
| 651 | \declaremodule{extension}{spam} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 652 | \platform{Unix} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 653 | \modulesynopsis{Access to the SPAM facility of \UNIX{}.} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 654 | \moduleauthor{Jane Doe}{jane.doe@frobnitz.org} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 655 | \end{verbatim} |
| 656 | |
Fred Drake | 7932ed0 | 2000-08-11 17:37:33 +0000 | [diff] [blame] | 657 | Python packages\index{packages} --- collections of modules that can |
| 658 | be described as a unit --- are documented using the same markup as |
| 659 | modules. The name for a module in a package should be typed in |
| 660 | ``fully qualified'' form (i.e., it should include the package name). |
| 661 | For example, a module ``foo'' in package ``bar'' should be marked as |
| 662 | \samp{\e module\{bar.foo\}}, and the beginning of the reference |
| 663 | section would appear as: |
| 664 | |
| 665 | \begin{verbatim} |
| 666 | \section{\module{bar.foo} --- |
| 667 | Module from the \module{bar} package} |
| 668 | |
| 669 | \declaremodule{extension}{bar.foo} |
| 670 | \modulesynopsis{Nifty module from the \module{bar} package.} |
| 671 | \moduleauthor{Jane Doe}{jane.doe@frobnitz.org} |
| 672 | \end{verbatim} |
| 673 | |
| 674 | Note that the name of a package is also marked using |
| 675 | \macro{module}. |
| 676 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 677 | \begin{macrodesc}{declaremodule}{\op{key}\p{type}\p{name}} |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 678 | Requires two parameters: module type (\samp{standard}, |
| 679 | \samp{builtin}, \samp{extension}, or \samp{}), and the module |
| 680 | name. An optional parameter should be given as the basis for the |
| 681 | module's ``key'' used for linking to or referencing the section. |
| 682 | The ``key'' should only be given if the module's name contains any |
| 683 | underscores, and should be the name with the underscores stripped. |
| 684 | Note that the \var{type} parameter must be one of the values |
| 685 | listed above or an error will be printed. For modules which are |
| 686 | contained in packages, the fully-qualified name should be given as |
| 687 | \var{name} parameter. This should be the first thing after the |
| 688 | \macro{section} used to introduce the module. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 689 | \end{macrodesc} |
| 690 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 691 | \begin{macrodesc}{platform}{\p{specifier}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 692 | Specifies the portability of the module. \var{specifier} is a |
| 693 | comma-separated list of keys that specify what platforms the |
| 694 | module is available on. The keys are short identifiers; |
| 695 | examples that are in use include \samp{IRIX}, \samp{Mac}, |
| 696 | \samp{Windows}, and \samp{Unix}. It is important to use a key |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 697 | which has already been used when applicable. This is used to |
| 698 | provide annotations in the Module Index and the HTML and GNU info |
| 699 | output. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 700 | \end{macrodesc} |
| 701 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 702 | \begin{macrodesc}{modulesynopsis}{\p{text}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 703 | The \var{text} is a short, ``one line'' description of the |
| 704 | module that can be used as part of the chapter introduction. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 705 | This is must be placed after \macro{declaremodule}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 706 | The synopsis is used in building the contents of the table |
| 707 | inserted as the \macro{localmoduletable}. No text is |
| 708 | produced at the point of the markup. |
| 709 | \end{macrodesc} |
| 710 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 711 | \begin{macrodesc}{moduleauthor}{\p{name}\p{email}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 712 | This macro is used to encode information about who authored a |
| 713 | module. This is currently not used to generate output, but can be |
| 714 | used to help determine the origin of the module. |
| 715 | \end{macrodesc} |
| 716 | |
| 717 | |
| 718 | \subsection{Library-level Markup} |
| 719 | |
| 720 | This markup is used when describing a selection of modules. For |
Fred Drake | 698d520 | 1999-11-10 15:54:57 +0000 | [diff] [blame] | 721 | example, the \citetitle[../mac/mac.html]{Macintosh Library |
| 722 | Modules} document uses this to help provide an overview of the |
| 723 | modules in the collection, and many chapters in the |
| 724 | \citetitle[../lib/lib.html]{Python Library Reference} use it for |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 725 | the same purpose. |
| 726 | |
| 727 | \begin{macrodesc}{localmoduletable}{} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 728 | If a \file{.syn} file exists for the current |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 729 | chapter (or for the entire document in \code{howto} documents), a |
| 730 | \env{synopsistable} is created with the contents loaded from the |
| 731 | \file{.syn} file. |
| 732 | \end{macrodesc} |
| 733 | |
| 734 | |
| 735 | \subsection{Table Markup} |
| 736 | |
| 737 | There are three general-purpose table environments defined which |
| 738 | should be used whenever possible. These environments are defined |
| 739 | to provide tables of specific widths and some convenience for |
| 740 | formatting. These environments are not meant to be general |
| 741 | replacements for the standard \LaTeX{} table environments, but can |
| 742 | be used for an advantage when the documents are processed using |
| 743 | the tools for Python documentation processing. In particular, the |
| 744 | generated HTML looks good! There is also an advantage for the |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 745 | eventual conversion of the documentation to SGML (see section |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 746 | \ref{futures}, ``Future Directions''). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 747 | |
| 748 | Each environment is named \env{table\var{cols}}, where \var{cols} |
| 749 | is the number of columns in the table specified in lower-case |
| 750 | Roman numerals. Within each of these environments, an additional |
| 751 | macro, \macro{line\var{cols}}, is defined, where \var{cols} |
| 752 | matches the \var{cols} value of the corresponding table |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 753 | environment. These are supported for \var{cols} values of |
| 754 | \code{ii}, \code{iii}, and \code{iv}. These environments are all |
| 755 | built on top of the \env{tabular} environment. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 756 | |
Fred Drake | 2b85341 | 2000-04-11 19:08:30 +0000 | [diff] [blame] | 757 | Note that all tables in the standard Python documentation use |
| 758 | vertical lines between columns, and this must be specified in the |
| 759 | markup for each table. A general border around the outside of the |
| 760 | table is not used, but would be the responsibility of the |
| 761 | processor. |
| 762 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 763 | \begin{envdesc}{tableii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 764 | Create a two-column table using the \LaTeX{} column specifier |
| 765 | \var{colspec}. The column specifier should indicate vertical |
| 766 | bars between columns as appropriate for the specific table, but |
| 767 | should not specify vertical bars on the outside of the table |
| 768 | (that is considered a stylesheet issue). The \var{col1font} |
| 769 | parameter is used as a stylistic treatment of the first column |
| 770 | of the table: the first column is presented as |
| 771 | \code{\e\var{col1font}\{column1\}}. To avoid treating the first |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 772 | column specially, \var{col1font} may be \samp{textrm}. The |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 773 | column headings are taken from the values \var{heading1} and |
| 774 | \var{heading2}. |
| 775 | \end{envdesc} |
| 776 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 777 | \begin{macrodesc}{lineii}{\p{column1}\p{column2}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 778 | Create a single table row within a \env{tableii} environment. |
| 779 | The text for the first column will be generated by applying the |
| 780 | macro named by the \var{col1font} value when the \env{tableii} |
| 781 | was opened. |
| 782 | \end{macrodesc} |
| 783 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 784 | \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] | 785 | Like the \env{tableii} environment, but with a third column. |
| 786 | The heading for the third column is given by \var{heading3}. |
| 787 | \end{envdesc} |
| 788 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 789 | \begin{macrodesc}{lineiii}{\p{column1}\p{column2}\p{column3}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 790 | Like the \macro{lineii} macro, but with a third column. The |
| 791 | text for the third column is given by \var{column3}. |
| 792 | \end{macrodesc} |
| 793 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 794 | \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] | 795 | Like the \env{tableiii} environment, but with a fourth column. |
| 796 | The heading for the fourth column is given by \var{heading4}. |
| 797 | \end{envdesc} |
| 798 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 799 | \begin{macrodesc}{lineiv}{\p{column1}\p{column2}\p{column3}\p{column4}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 800 | Like the \macro{lineiii} macro, but with a fourth column. The |
| 801 | text for the fourth column is given by \var{column4}. |
| 802 | \end{macrodesc} |
| 803 | |
| 804 | |
| 805 | An additional table-like environment is \env{synopsistable}. The |
| 806 | table generated by this environment contains two columns, and each |
| 807 | row is defined by an alternate definition of |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 808 | \macro{modulesynopsis}. This environment is not normally used by |
| 809 | authors, but is created by the \macro{localmoduletable} macro. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 810 | |
| 811 | |
| 812 | \subsection{Reference List Markup \label{references}} |
| 813 | |
| 814 | Many sections include a list of references to module documentation |
| 815 | or external documents. These lists are created using the |
| 816 | \env{seealso} environment. This environment defines some |
| 817 | additional macros to support creating reference entries in a |
| 818 | reasonable manner. |
| 819 | |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 820 | The \env{seealso} environment is typically placed in a section |
| 821 | just before any sub-sections. This is done to ensure that |
| 822 | reference links related to the section are not hidden in a |
| 823 | subsection in the hypertext renditions of the documentation. |
| 824 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 825 | \begin{envdesc}{seealso}{} |
| 826 | This environment creates a ``See also:'' heading and defines the |
| 827 | markup used to describe individual references. |
| 828 | \end{envdesc} |
| 829 | |
Fred Drake | 4844998 | 2000-09-12 17:52:33 +0000 | [diff] [blame] | 830 | For each of the following macros, \var{why} should be one or more |
| 831 | complete sentences, starting with a capital letter (unless it |
| 832 | starts with an identifier, which should not be modified), and |
| 833 | ending with the apropriate punctuation. |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 834 | |
Fred Drake | b7cf378 | 2000-09-12 19:58:10 +0000 | [diff] [blame] | 835 | These macros are only defined within the content of the |
| 836 | \env{seealso} environment. |
| 837 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 838 | \begin{macrodesc}{seemodule}{\op{key}\p{name}\p{why}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 839 | Refer to another module. \var{why} should be a brief |
| 840 | explanation of why the reference may be interesting. The module |
| 841 | name is given in \var{name}, with the link key given in |
| 842 | \var{key} if necessary. In the HTML and PDF conversions, the |
| 843 | module name will be a hyperlink to the referred-to module. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 844 | \strong{Note:} The module must be documented in the same |
| 845 | document (the corresponding \macro{declaremodule} is required). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 846 | \end{macrodesc} |
| 847 | |
Fred Drake | 08c5d0c | 2000-09-11 05:22:30 +0000 | [diff] [blame] | 848 | \begin{macrodesc}{seepep}{\p{number}\p{title}\p{why}} |
| 849 | Refer to an Python Enhancement Proposal (PEP). \var{number} |
| 850 | should be the official number assigned by the PEP Editor, |
| 851 | \var{title} should be the human-readable title of the PEP as |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 852 | found in the official copy of the document, and \var{why} should |
Fred Drake | 08c5d0c | 2000-09-11 05:22:30 +0000 | [diff] [blame] | 853 | explain what's interesting about the PEP. This should be used |
| 854 | to refer the reader to PEPs which specify interfaces or language |
| 855 | features relevant to the material in the annotated section of the |
| 856 | documentation. |
| 857 | \end{macrodesc} |
| 858 | |
| 859 | \begin{macrodesc}{seerfc}{\p{number}\p{title}\p{why}} |
| 860 | Refer to an IETF Request for Comments (RFC). Otherwise very |
| 861 | similar to \macro{seepep}. This should be used |
| 862 | to refer the reader to PEPs which specify protocols or data |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 863 | formats relevant to the material in the annotated section of the |
| 864 | documentation. |
| 865 | \end{macrodesc} |
| 866 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 867 | \begin{macrodesc}{seetext}{\p{text}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 868 | Add arbitrary text \var{text} to the ``See also:'' list. This |
| 869 | 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] | 870 | using the \macro{url} macro. This should consist of one or more |
| 871 | complete sentences. |
| 872 | \end{macrodesc} |
| 873 | |
Fred Drake | 4844998 | 2000-09-12 17:52:33 +0000 | [diff] [blame] | 874 | \begin{macrodesc}{seetitle}{\op{url}\p{title}\p{why}} |
| 875 | Add a reference to an external document named \var{title}. If |
| 876 | \var{url} is given, the title is made a hyperlink in the HTML |
| 877 | version of the documentation, and displayed below the title in |
| 878 | the typeset versions of the documentation. |
| 879 | \end{macrodesc} |
| 880 | |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 881 | \begin{macrodesc}{seeurl}{\p{url}\p{why}} |
| 882 | References to specific on-line resources should be given using |
| 883 | the \macro{seeurl} macro. No title is associated with the |
| 884 | reference, but the \var{why} text may include a title marked |
| 885 | using the \macro{citetitle} macro. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 886 | \end{macrodesc} |
| 887 | |
| 888 | |
| 889 | \subsection{Index-generating Markup \label{indexing}} |
| 890 | |
| 891 | Effective index generation for technical documents can be very |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 892 | difficult, especially for someone familiar with the topic but not |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 893 | the creation of indexes. Much of the difficulty arises in the |
| 894 | area of terminology: including the terms an expert would use for a |
| 895 | concept is not sufficient. Coming up with the terms that a novice |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 896 | would look up is fairly difficult for an author who, typically, is |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 897 | an expert in the area she is writing on. |
| 898 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 899 | The truly difficult aspects of index generation are not areas with |
| 900 | which the documentation tools can help. However, ease |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 901 | of producing the index once content decisions are made is within |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 902 | the scope of the tools. Markup is provided which the processing |
| 903 | software is able to use to generate a variety of kinds of index |
| 904 | entry with minimal effort. Additionally, many of the environments |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 905 | described in section \ref{info-units}, ``Information Units,'' will |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 906 | generate appropriate entries into the general and module indexes. |
| 907 | |
| 908 | The following macro can be used to control the generation of index |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 909 | data, and should be used in the document preamble: |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 910 | |
| 911 | \begin{macrodesc}{makemodindex}{} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 912 | This should be used in the document preamble if a ``Module |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 913 | Index'' is desired for a document containing reference material |
| 914 | on many modules. This causes a data file |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 915 | \code{lib\var{jobname}.idx} to be created from the |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 916 | \macro{declaremodule} macros. This file can be processed by the |
| 917 | \program{makeindex} program to generate a file which can be |
| 918 | \macro{input} into the document at the desired location of the |
| 919 | module index. |
| 920 | \end{macrodesc} |
| 921 | |
| 922 | There are a number of macros that are useful for adding index |
| 923 | entries for particular concepts, many of which are specific to |
| 924 | programming languages or even Python. |
| 925 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 926 | \begin{macrodesc}{bifuncindex}{\p{name}} |
Fred Drake | ec8b905 | 1999-04-23 20:01:17 +0000 | [diff] [blame] | 927 | Add an index entry referring to a built-in function named |
| 928 | \var{name}; parentheses should not be included after |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 929 | \var{name}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 930 | \end{macrodesc} |
| 931 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 932 | \begin{macrodesc}{exindex}{\p{exception}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 933 | Add a reference to an exception named \var{exception}. The |
| 934 | exception may be either string- or class-based. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 935 | \end{macrodesc} |
| 936 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 937 | \begin{macrodesc}{kwindex}{\p{keyword}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 938 | Add a reference to a language keyword (not a keyword parameter |
| 939 | in a function or method call). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 940 | \end{macrodesc} |
| 941 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 942 | \begin{macrodesc}{obindex}{\p{object type}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 943 | Add an index entry for a built-in object type. |
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}{opindex}{\p{operator}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 947 | Add a reference to an operator, such as \samp{+}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 948 | \end{macrodesc} |
| 949 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 950 | \begin{macrodesc}{refmodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 951 | Add an index entry for module \var{module}; if \var{module} |
| 952 | contains an underscore, the optional parameter \var{key} should |
| 953 | be provided as the same string with underscores removed. An |
| 954 | index entry ``\var{module} (module)'' will be generated. This |
| 955 | is intended for use with non-standard modules implemented in |
| 956 | Python. |
| 957 | \end{macrodesc} |
| 958 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 959 | \begin{macrodesc}{refexmodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 960 | As for \macro{refmodindex}, but the index entry will be |
| 961 | ``\var{module} (extension module).'' This is intended for use |
| 962 | with non-standard modules not implemented in Python. |
| 963 | \end{macrodesc} |
| 964 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 965 | \begin{macrodesc}{refbimodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 966 | As for \macro{refmodindex}, but the index entry will be |
| 967 | ``\var{module} (built-in module).'' This is intended for use |
| 968 | with standard modules not implemented in Python. |
| 969 | \end{macrodesc} |
| 970 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 971 | \begin{macrodesc}{refstmodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 972 | As for \macro{refmodindex}, but the index entry will be |
| 973 | ``\var{module} (standard module).'' This is intended for use |
| 974 | with standard modules implemented in Python. |
| 975 | \end{macrodesc} |
| 976 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 977 | \begin{macrodesc}{stindex}{\p{statement}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 978 | Add an index entry for a statement type, such as \keyword{print} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 979 | or \keyword{try}/\keyword{finally}. |
| 980 | |
| 981 | XXX Need better examples of difference from \macro{kwindex}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 982 | \end{macrodesc} |
| 983 | |
| 984 | |
| 985 | Additional macros are provided which are useful for conveniently |
| 986 | creating general index entries which should appear at many places |
| 987 | in the index by rotating a list of words. These are simple macros |
| 988 | that simply use \macro{index} to build some number of index |
| 989 | entries. Index entries build using these macros contain both |
| 990 | primary and secondary text. |
| 991 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 992 | \begin{macrodesc}{indexii}{\p{word1}\p{word2}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 993 | Build two index entries. This is exactly equivalent to using |
| 994 | \code{\e index\{\var{word1}!\var{word2}\}} and |
| 995 | \code{\e index\{\var{word2}!\var{word1}\}}. |
| 996 | \end{macrodesc} |
| 997 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 998 | \begin{macrodesc}{indexiii}{\p{word1}\p{word2}\p{word3}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 999 | Build three index entries. This is exactly equivalent to using |
| 1000 | \code{\e index\{\var{word1}!\var{word2} \var{word3}\}}, |
| 1001 | \code{\e index\{\var{word2}!\var{word3}, \var{word1}\}}, and |
| 1002 | \code{\e index\{\var{word3}!\var{word1} \var{word2}\}}. |
| 1003 | \end{macrodesc} |
| 1004 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1005 | \begin{macrodesc}{indexiv}{\p{word1}\p{word2}\p{word3}\p{word4}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1006 | Build four index entries. This is exactly equivalent to using |
| 1007 | \code{\e index\{\var{word1}!\var{word2} \var{word3} \var{word4}\}}, |
| 1008 | \code{\e index\{\var{word2}!\var{word3} \var{word4}, \var{word1}\}}, |
| 1009 | \code{\e index\{\var{word3}!\var{word4}, \var{word1} \var{word2}\}}, |
| 1010 | and |
| 1011 | \code{\e index\{\var{word4}!\var{word1} \var{word2} \var{word3}\}}. |
| 1012 | \end{macrodesc} |
| 1013 | |
| 1014 | |
| 1015 | \section{Special Names} |
| 1016 | |
| 1017 | Many special names are used in the Python documentation, including |
| 1018 | the names of operating systems, programming languages, standards |
| 1019 | bodies, and the like. Many of these were assigned \LaTeX{} macros |
| 1020 | at some point in the distant past, and these macros lived on long |
| 1021 | past their usefulness. In the current markup, these entities are |
| 1022 | not assigned any special markup, but the preferred spellings are |
| 1023 | given here to aid authors in maintaining the consistency of |
| 1024 | presentation in the Python documentation. |
| 1025 | |
| 1026 | \begin{description} |
| 1027 | \item[POSIX] |
| 1028 | The name assigned to a particular group of standards. This is |
| 1029 | always uppercase. |
| 1030 | |
| 1031 | \item[Python] |
| 1032 | The name of our favorite programming language is always |
| 1033 | capitalized. |
Fred Drake | 4293468 | 2000-04-03 15:00:28 +0000 | [diff] [blame] | 1034 | |
| 1035 | \item[Unicode] |
| 1036 | The name of a character set and matching encoding. This is |
| 1037 | always written capitalized. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1038 | \end{description} |
| 1039 | |
| 1040 | |
| 1041 | \section{Processing Tools} |
| 1042 | |
| 1043 | \subsection{External Tools} |
| 1044 | |
| 1045 | Many tools are needed to be able to process the Python |
| 1046 | documentation if all supported formats are required. This |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1047 | section lists the tools used and when each is required. Consult |
| 1048 | the \file{Doc/README} file to see if there are specific version |
| 1049 | requirements for any of these. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1050 | |
| 1051 | \begin{description} |
| 1052 | \item[\program{dvips}] |
| 1053 | This program is a typical part of \TeX{} installations. It is |
| 1054 | used to generate PostScript from the ``device independent'' |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1055 | \file{.dvi} files. It is needed for the conversion to |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1056 | PostScript. |
| 1057 | |
| 1058 | \item[\program{emacs}] |
| 1059 | Emacs is the kitchen sink of programmers' editors, and a damn |
| 1060 | fine kitchen sink it is. It also comes with some of the |
| 1061 | processing needed to support the proper menu structures for |
| 1062 | Texinfo documents when an info conversion is desired. This is |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1063 | needed for the info conversion. Using \program{xemacs} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1064 | instead of FSF \program{emacs} may lead to instability in the |
| 1065 | conversion, but that's because nobody seems to maintain the |
| 1066 | Emacs Texinfo code in a portable manner. |
| 1067 | |
| 1068 | \item[\program{latex}] |
| 1069 | This is a world-class typesetter by Donald Knuth. It is used |
| 1070 | for the conversion to PostScript, and is needed for the HTML |
| 1071 | conversion as well (\LaTeX2HTML requires one of the |
| 1072 | intermediate files it creates). |
| 1073 | |
| 1074 | \item[\program{latex2html}] |
| 1075 | Probably the longest Perl script anyone ever attempted to |
| 1076 | maintain. This converts \LaTeX{} documents to HTML documents, |
| 1077 | and does a pretty reasonable job. It is required for the |
| 1078 | conversions to HTML and GNU info. |
| 1079 | |
| 1080 | \item[\program{lynx}] |
| 1081 | This is a text-mode Web browser which includes an |
| 1082 | HTML-to-plain text conversion. This is used to convert |
| 1083 | \code{howto} documents to text. |
| 1084 | |
| 1085 | \item[\program{make}] |
| 1086 | Just about any version should work for the standard documents, |
| 1087 | but GNU \program{make} is required for the experimental |
| 1088 | processes in \file{Doc/tools/sgmlconv/}, at least while |
| 1089 | they're experimental. |
| 1090 | |
| 1091 | \item[\program{makeindex}] |
| 1092 | This is a standard program for converting \LaTeX{} index data |
| 1093 | to a formatted index; it should be included with all \LaTeX{} |
| 1094 | installations. It is needed for the PDF and PostScript |
| 1095 | conversions. |
| 1096 | |
| 1097 | \item[\program{makeinfo}] |
| 1098 | GNU \program{makeinfo} is used to convert Texinfo documents to |
| 1099 | GNU info files. Since Texinfo is used as an intermediate |
| 1100 | format in the info conversion, this program is needed in that |
| 1101 | conversion. |
| 1102 | |
| 1103 | \item[\program{pdflatex}] |
| 1104 | pdf\TeX{} is a relatively new variant of \TeX, and is used to |
| 1105 | generate the PDF version of the manuals. It is typically |
| 1106 | installed as part of most of the large \TeX{} distributions. |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 1107 | \program{pdflatex} is pdf\TeX{} using the \LaTeX{} format. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1108 | |
| 1109 | \item[\program{perl}] |
| 1110 | Perl is required for \LaTeX2HTML{} and one of the scripts used |
| 1111 | to post-process \LaTeX2HTML output, as well as the |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1112 | HTML-to-Texinfo conversion. This is required for |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1113 | the HTML and GNU info conversions. |
| 1114 | |
| 1115 | \item[\program{python}] |
| 1116 | Python is used for many of the scripts in the |
| 1117 | \file{Doc/tools/} directory; it is required for all |
| 1118 | conversions. This shouldn't be a problem if you're interested |
| 1119 | in writing documentation for Python! |
| 1120 | \end{description} |
| 1121 | |
| 1122 | |
| 1123 | \subsection{Internal Tools} |
| 1124 | |
| 1125 | This section describes the various scripts that are used to |
| 1126 | implement various stages of document processing or to orchestrate |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1127 | entire build sequences. Most of these tools are only useful |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1128 | in the context of building the standard documentation, but some |
| 1129 | are more general. |
| 1130 | |
| 1131 | \begin{description} |
| 1132 | \item[\program{mkhowto}] |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 1133 | This is the primary script used to format third-party |
| 1134 | documents. It contains all the logic needed to ``get it |
| 1135 | right.'' The proper way to use this script is to make a |
| 1136 | symbolic link to it or run it in place; the actual script file |
| 1137 | must be stored as part of the documentation source tree, |
| 1138 | though it may be used to format documents outside the |
Fred Drake | ce44498 | 2000-04-11 18:52:52 +0000 | [diff] [blame] | 1139 | tree. Use \program{mkhowto} \longprogramopt{help} |
Fred Drake | d290c10 | 1999-11-09 18:03:00 +0000 | [diff] [blame] | 1140 | for a list of |
Fred Drake | d2a727f | 1999-05-27 21:45:54 +0000 | [diff] [blame] | 1141 | command line options. |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 1142 | |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 1143 | \program{mkhowto} can be used for both \code{howto} and |
| 1144 | \code{manual} class documents. (For the later, be sure to get |
| 1145 | the latest version from the Python CVS repository rather than |
| 1146 | the version distributed in the \file{latex-1.5.2.tgz} source |
| 1147 | archive.) |
| 1148 | |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 1149 | XXX Need more here. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1150 | \end{description} |
| 1151 | |
| 1152 | |
| 1153 | \section{Future Directions \label{futures}} |
| 1154 | |
| 1155 | The history of the Python documentation is full of changes, most of |
| 1156 | which have been fairly small and evolutionary. There has been a |
| 1157 | great deal of discussion about making large changes in the markup |
| 1158 | languages and tools used to process the documentation. This section |
| 1159 | deals with the nature of the changes and what appears to be the most |
| 1160 | likely path of future development. |
| 1161 | |
| 1162 | \subsection{Structured Documentation \label{structured}} |
| 1163 | |
| 1164 | Most of the small changes to the \LaTeX{} markup have been made |
| 1165 | with an eye to divorcing the markup from the presentation, making |
| 1166 | both a bit more maintainable. Over the course of 1998, a large |
| 1167 | number of changes were made with exactly this in mind; previously, |
| 1168 | changes had been made but in a less systematic manner and with |
| 1169 | more concern for not needing to update the existing content. The |
| 1170 | result has been a highly structured and semantically loaded markup |
| 1171 | language implemented in \LaTeX. With almost no basic \TeX{} or |
| 1172 | \LaTeX{} markup in use, however, the markup syntax is about the |
| 1173 | only evidence of \LaTeX{} in the actual document sources. |
| 1174 | |
| 1175 | One side effect of this is that while we've been able to use |
| 1176 | standard ``engines'' for manipulating the documents, such as |
| 1177 | \LaTeX{} and \LaTeX2HTML, most of the actual transformations have |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 1178 | been created specifically for Python. The \LaTeX{} document |
| 1179 | classes and \LaTeX2HTML support are both complete implementations |
| 1180 | of the specific markup designed for these documents. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1181 | |
| 1182 | Combining highly customized markup with the somewhat esoteric |
| 1183 | systems used to process the documents leads us to ask some |
| 1184 | questions: Can we do this more easily? and, Can we do this |
| 1185 | better? After a great deal of discussion with the community, we |
| 1186 | have determined that actively pursuing modern structured |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1187 | documentation systems is worth some investment of time. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1188 | |
| 1189 | There appear to be two real contenders in this arena: the Standard |
| 1190 | General Markup Language (SGML), and the Extensible Markup Language |
| 1191 | (XML). Both of these standards have advantages and disadvantages, |
| 1192 | and many advantages are shared. |
| 1193 | |
| 1194 | SGML offers advantages which may appeal most to authors, |
| 1195 | especially those using ordinary text editors. There are also |
| 1196 | additional abilities to define content models. A number of |
| 1197 | high-quality tools with demonstrated maturity is available, but |
| 1198 | most are not free; for those which are, portability issues remain |
| 1199 | a problem. |
| 1200 | |
| 1201 | The advantages of XML include the availability of a large number |
| 1202 | of evolving tools. Unfortunately, many of the associated |
| 1203 | standards are still evolving, and the tools will have to follow |
| 1204 | along. This means that developing a robust tool set that uses |
| 1205 | more than the basic XML 1.0 recommendation is not possible in the |
| 1206 | short term. The promised availability of a wide variety of |
| 1207 | high-quality tools which support some of the most important |
| 1208 | related standards is not immediate. Many tools are likely to be |
| 1209 | free. |
| 1210 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1211 | XXX Eventual migration to SGML/XML. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1212 | |
| 1213 | \subsection{Discussion Forums \label{discussion}} |
| 1214 | |
| 1215 | Discussion of the future of the Python documentation and related |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 1216 | topics takes place in the Documentation Special Interest Group, or |
| 1217 | ``Doc-SIG.'' Information on the group, including mailing list |
| 1218 | archives and subscription information, is available at |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1219 | \url{http://www.python.org/sigs/doc-sig/}. The SIG is open to all |
| 1220 | interested parties. |
| 1221 | |
| 1222 | Comments and bug reports on the standard documents should be sent |
| 1223 | to \email{python-docs@python.org}. This may include comments |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1224 | about formatting, content, grammatical and spelling errors, or |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 1225 | this document. You can also send comments on this document |
| 1226 | directly to the author at \email{fdrake@acm.org}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1227 | |
| 1228 | \end{document} |