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 | |
| 8 | % Now override the stuff that includes author information: |
| 9 | |
| 10 | \author{Fred L. Drake, Jr.} |
| 11 | \authoraddress{ |
| 12 | Corporation for National Research Initiatives (CNRI) \\ |
| 13 | 1895 Preston White Drive, Reston, Va 20191, USA \\ |
| 14 | E-mail: \email{fdrake@acm.org} |
| 15 | } |
| 16 | \date{\today} |
| 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. |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 36 | |
| 37 | [Notes and questions in brackets, like this, are notes to myself while |
| 38 | developing this document.] |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 39 | \end{abstract} |
| 40 | |
| 41 | \tableofcontents |
| 42 | |
| 43 | |
| 44 | \section{Introduction} |
| 45 | |
| 46 | Python's documentation has long been considered to be good for a |
| 47 | free programming language. There are a number of reasons for this, |
| 48 | the most important being the early commitment of Python's creator, |
| 49 | Guido van Rossum, to providing documentation on the language and its |
| 50 | libraries, and the continuing involvement of the user community in |
| 51 | providing assistance for creating and maintaining documentation. |
| 52 | |
| 53 | The involvement of the community takes many forms, from authoring to |
| 54 | bug reports to just plain complaining when aspects of the |
| 55 | documentation could be easier to use. All of these forms of input |
| 56 | from the community have proved useful during the time I've been |
| 57 | involved in maintaining the documentation. |
| 58 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 59 | This document is aimed at authors and potential authors of |
| 60 | documentation for Python. Among this group, it is aimed primarily |
| 61 | at people contributing to the standard documentation and developing |
| 62 | additional documents using the same tools as the standard |
| 63 | documents. This guide will be less useful for authors using the |
| 64 | Python documentation tools for topics other than Python, and less |
| 65 | useful still for authors not using the tools at all. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 66 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 67 | The material in this guide is intended to assist authors using the |
| 68 | Python documentation tools. It includes information on the source |
| 69 | distribution of the standard documentation, a discussion of the |
| 70 | Python document classes, reference material on the markup defined in |
| 71 | the document classes, a list of the tools need for processing |
| 72 | documents, and reference material on the tools provided with the |
| 73 | documentation resources. At the end, there is also a section |
| 74 | discussing future directions for the Python documentation. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 75 | |
| 76 | \section{Directory Structure} |
| 77 | |
| 78 | The source distribution for the standard Python documentation |
| 79 | contains a large number of directories. While third-party documents |
| 80 | do not need to be placed into this structure or need to be placed |
| 81 | within a similar structure, it can be helpful to know where to look |
| 82 | for examples and tools when developing new documents using the |
| 83 | Python documentation tools. This section describes this directory |
| 84 | structure. |
| 85 | |
| 86 | The documentation sources are usually placed within the Python |
| 87 | source distribution as the top-level subdirectory \file{Doc/}, but |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 88 | are independent of the Python source distribution. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 89 | |
| 90 | The \file{Doc/} directory contains a few files and several |
| 91 | subdirectories. The files are mostly self-explanatory, including a |
| 92 | \file{README} and a \file{Makefile}. The directories fall into |
| 93 | three categories: |
| 94 | |
| 95 | \begin{definitions} |
| 96 | \term{Document Sources} |
| 97 | The \LaTeX{} sources for each document are placed in a |
| 98 | separate directory. These directories are given short, |
| 99 | three-character names. |
| 100 | |
| 101 | \term{Format-Specific Output} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 102 | Most output formats have a directory which contains a |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 103 | \file{Makefile} which controls the generation of that format |
| 104 | and provides storage for the formatted documents. The only |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 105 | variations within this category are the Portable Document |
| 106 | Format (PDF) and PostScript versions are placed in the |
| 107 | directories \file{paper-a4/} and \file{paper-letter/}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 108 | |
| 109 | \term{Supplemental Files} |
| 110 | Some additional directories are used to store supplemental |
| 111 | files used for the various processes. Directories are |
| 112 | included for the shared \LaTeX{} document classes, the |
| 113 | \LaTeX2HTML support, template files for various document |
| 114 | components, and the scripts used to perform various steps in |
| 115 | the formatting processes. |
| 116 | \end{definitions} |
| 117 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 118 | |
| 119 | \section{\LaTeX{} Syntax Primer \label{latex-primer}} |
| 120 | |
| 121 | [This section will discuss what the markup looks like, and explain |
| 122 | the difference between an environment and a macro.] |
| 123 | |
| 124 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 125 | \section{Document Classes} |
| 126 | |
| 127 | Two \LaTeX{} document classes are defined specifically for use with |
| 128 | the Python documentation. The \code{manual} class is for large |
| 129 | documents which are sectioned into chapters, and the \code{howto} |
| 130 | class is for smaller documents. |
| 131 | |
| 132 | The \code{manual} documents are larger and are used for most of the |
| 133 | standard documents. This document class is based on the standard |
| 134 | \LaTeX{} \code{report} class and is formatted very much like a long |
| 135 | technical report. |
| 136 | |
| 137 | The \code{howto} documents are shorter, and don't have the large |
| 138 | structure of the \code{manual} documents. This class is based on |
| 139 | the standard \LaTeX{} \code{article} class and is formatted somewhat |
| 140 | like the Linux Documentation Project's ``HOWTO'' series as done |
| 141 | originally using the LinuxDoc software. The original intent for the |
| 142 | document class was that it serve a similar role as the LDP's HOWTO |
| 143 | series, but the applicability of the class turns out to be somewhat |
| 144 | more broad. This class is used for ``how-to'' documents (this |
| 145 | document is an example) and for shorter reference manuals for small, |
| 146 | fairly cohesive module libraries. Examples of the later use include |
| 147 | the standard \emph{Macintosh Library Modules} and \emph{Using |
| 148 | Kerberos from Python}, which contains reference material for an |
| 149 | extension package. These documents are roughly equivalent to a |
| 150 | single chapter from a larger work. |
| 151 | |
| 152 | |
| 153 | \section{Python-specific Markup} |
| 154 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 155 | The Python document classes define a lot of new environments and |
| 156 | macros. This section contains the reference material for these |
| 157 | facilities. |
| 158 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 159 | \subsection{Information Units \label{info-units}} |
| 160 | |
| 161 | Most of the environments should be described here: \env{excdesc}, |
| 162 | \env{funcdesc}, etc. |
| 163 | |
| 164 | \begin{envdesc}{datadesc}{\{\var{name}\}} |
| 165 | \end{envdesc} |
| 166 | \begin{envdesc}{datadesc}{\{\var{name}\}} |
| 167 | Like \env{datadesc}, but without creating any index entries. |
| 168 | \end{envdesc} |
| 169 | |
| 170 | \begin{envdesc}{excdesc}{\{\var{name}\}} |
| 171 | Describe an exception. This may be either a string exception or |
| 172 | a class exception. |
| 173 | \end{envdesc} |
| 174 | |
| 175 | \begin{envdesc}{funcdesc}{\{\var{name}\}\{\var{parameter list}\}} |
| 176 | \end{envdesc} |
| 177 | \begin{envdesc}{funcdescni}{\{\var{name}\}\{\var{parameter list}\}} |
| 178 | Like \env{funcdesc}, but without creating any index entries. |
| 179 | \end{envdesc} |
| 180 | |
| 181 | \begin{envdesc}{classdesc}{\{\var{name}\}\{\var{constructor parameter list}\}} |
| 182 | \end{envdesc} |
| 183 | |
| 184 | \begin{envdesc}{memberdesc}{\{\var{name}\}} |
| 185 | \end{envdesc} |
| 186 | \begin{envdesc}{memberdescni}{\{\var{name}\}} |
| 187 | Like \env{memberdesc}, but without creating any index entries. |
| 188 | \end{envdesc} |
| 189 | |
| 190 | \begin{envdesc}{methoddesc}{{[}\var{class name}{]}\{\var{name}\}\{\var{parameter list}\}} |
| 191 | \end{envdesc} |
| 192 | \begin{envdesc}{methoddescni}{{[}\var{class name}{]}\{\var{name}\}\{\var{parameter list}\}} |
| 193 | Like \env{methoddesc}, but without creating any index entries. |
| 194 | \end{envdesc} |
| 195 | |
| 196 | |
| 197 | \subsection{Inline Markup} |
| 198 | |
| 199 | This is where to explain \macro{code}, \macro{function}, |
| 200 | \macro{email}, etc. |
| 201 | |
| 202 | |
| 203 | \subsection{Module-specific Markup} |
| 204 | |
| 205 | The markup described in this section is used to provide information |
| 206 | about a module being documented. A typical use of this markup |
| 207 | appears at the top of the section used to document a module. A |
| 208 | typical example might look like this: |
| 209 | |
| 210 | \begin{verbatim} |
| 211 | \section{\module{spam} --- |
| 212 | Access to the SPAM facility} |
| 213 | |
| 214 | \declaremodule{extension}{spam} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 215 | \platform{Unix} |
| 216 | \modulesynopsis{Access to the SPAM facility of Unix.} |
| 217 | \moduleauthor{Jane Doe}{jane.doe@frobnitz.org} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 218 | \end{verbatim} |
| 219 | |
| 220 | \begin{macrodesc}{declaremodule}{{[}\var{key}{]}\{\var{type}\}\{\var{name}\}} |
| 221 | Requires two parameters: module type (standard, builtin, |
| 222 | extension), and the module name. An optional parameter should be |
| 223 | given as the basis for the module's ``key'' used for linking to or |
| 224 | referencing the section. The ``key'' should only be given if the |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 225 | module's name contains any underscores, and should be the name |
| 226 | with the underscores stripped. This should be the first thing |
| 227 | after the \macro{section} used to introduce the module. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 228 | \end{macrodesc} |
| 229 | |
| 230 | \begin{macrodesc}{platform}{\{\var{specifier}\}} |
| 231 | Specifies the portability of the module. \var{specifier} is a |
| 232 | comma-separated list of keys that specify what platforms the |
| 233 | module is available on. The keys are short identifiers; |
| 234 | examples that are in use include \samp{IRIX}, \samp{Mac}, |
| 235 | \samp{Windows}, and \samp{Unix}. It is important to use a key |
| 236 | which has already been used when applicable. |
| 237 | \end{macrodesc} |
| 238 | |
| 239 | \begin{macrodesc}{modulesynopsis}{\{\var{text}\}} |
| 240 | The \var{text} is a short, ``one line'' description of the |
| 241 | module that can be used as part of the chapter introduction. |
| 242 | This is typically placed just after \macro{declaremodule}. |
| 243 | The synopsis is used in building the contents of the table |
| 244 | inserted as the \macro{localmoduletable}. No text is |
| 245 | produced at the point of the markup. |
| 246 | \end{macrodesc} |
| 247 | |
| 248 | \begin{macrodesc}{moduleauthor}{\{\var{name}\}\{\var{email}\}} |
| 249 | This macro is used to encode information about who authored a |
| 250 | module. This is currently not used to generate output, but can be |
| 251 | used to help determine the origin of the module. |
| 252 | \end{macrodesc} |
| 253 | |
| 254 | |
| 255 | \subsection{Library-level Markup} |
| 256 | |
| 257 | This markup is used when describing a selection of modules. For |
| 258 | example, the \emph{Macintosh Library Modules} document uses this |
| 259 | to help provide an overview of the modules in the collection, and |
| 260 | many chapters in the \emph{Python Library Reference} use it for |
| 261 | the same purpose. |
| 262 | |
| 263 | \begin{macrodesc}{localmoduletable}{} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 264 | If a \file{.syn} file exists for the current |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 265 | chapter (or for the entire document in \code{howto} documents), a |
| 266 | \env{synopsistable} is created with the contents loaded from the |
| 267 | \file{.syn} file. |
| 268 | \end{macrodesc} |
| 269 | |
| 270 | |
| 271 | \subsection{Table Markup} |
| 272 | |
| 273 | There are three general-purpose table environments defined which |
| 274 | should be used whenever possible. These environments are defined |
| 275 | to provide tables of specific widths and some convenience for |
| 276 | formatting. These environments are not meant to be general |
| 277 | replacements for the standard \LaTeX{} table environments, but can |
| 278 | be used for an advantage when the documents are processed using |
| 279 | the tools for Python documentation processing. In particular, the |
| 280 | generated HTML looks good! There is also an advantage for the |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 281 | eventual conversion of the documentation to SGML (see Section |
| 282 | \ref{futures}, ``Future Directions''). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 283 | |
| 284 | Each environment is named \env{table\var{cols}}, where \var{cols} |
| 285 | is the number of columns in the table specified in lower-case |
| 286 | Roman numerals. Within each of these environments, an additional |
| 287 | macro, \macro{line\var{cols}}, is defined, where \var{cols} |
| 288 | matches the \var{cols} value of the corresponding table |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 289 | environment. These are supported for \var{cols} values of |
| 290 | \code{ii}, \code{iii}, and \code{iv}. These environments are all |
| 291 | built on top of the \env{tabular} environment. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 292 | |
| 293 | \begin{envdesc}{tableii}{\{\var{colspec}\}\{\var{col1font}\}\{\var{heading1}\}\{\var{heading2}\}} |
| 294 | Create a two-column table using the \LaTeX{} column specifier |
| 295 | \var{colspec}. The column specifier should indicate vertical |
| 296 | bars between columns as appropriate for the specific table, but |
| 297 | should not specify vertical bars on the outside of the table |
| 298 | (that is considered a stylesheet issue). The \var{col1font} |
| 299 | parameter is used as a stylistic treatment of the first column |
| 300 | of the table: the first column is presented as |
| 301 | \code{\e\var{col1font}\{column1\}}. To avoid treating the first |
| 302 | column specially, \var{col1font} may be \code{textrm}. The |
| 303 | column headings are taken from the values \var{heading1} and |
| 304 | \var{heading2}. |
| 305 | \end{envdesc} |
| 306 | |
| 307 | \begin{macrodesc}{lineii}{\{\var{column1}\}\{\var{column2}\}} |
| 308 | Create a single table row within a \env{tableii} environment. |
| 309 | The text for the first column will be generated by applying the |
| 310 | macro named by the \var{col1font} value when the \env{tableii} |
| 311 | was opened. |
| 312 | \end{macrodesc} |
| 313 | |
| 314 | \begin{envdesc}{tableiii}{\{\var{colspec}\}\{\var{col1font}\}\{\var{heading1}\}\{\var{heading2}\}\{\var{heading3}\}} |
| 315 | Like the \env{tableii} environment, but with a third column. |
| 316 | The heading for the third column is given by \var{heading3}. |
| 317 | \end{envdesc} |
| 318 | |
| 319 | \begin{macrodesc}{lineiii}{\{\var{column1}\}\{\var{column2}\}\{\var{column3}\}} |
| 320 | Like the \macro{lineii} macro, but with a third column. The |
| 321 | text for the third column is given by \var{column3}. |
| 322 | \end{macrodesc} |
| 323 | |
| 324 | \begin{envdesc}{tableiv}{\{\var{colspec}\}\{\var{col1font}\}\{\var{heading1}\}\{\var{heading2}\}\{\var{heading3}\}\{\var{heading4}\}} |
| 325 | Like the \env{tableiii} environment, but with a fourth column. |
| 326 | The heading for the fourth column is given by \var{heading4}. |
| 327 | \end{envdesc} |
| 328 | |
| 329 | \begin{macrodesc}{lineiv}{\{\var{column1}\}\{\var{column2}\}\{\var{column3}\}\{\var{column4}\}} |
| 330 | Like the \macro{lineiii} macro, but with a fourth column. The |
| 331 | text for the fourth column is given by \var{column4}. |
| 332 | \end{macrodesc} |
| 333 | |
| 334 | |
| 335 | An additional table-like environment is \env{synopsistable}. The |
| 336 | table generated by this environment contains two columns, and each |
| 337 | row is defined by an alternate definition of |
| 338 | \macro{modulesynopsis}. This environment is not normally use by |
| 339 | the user, but is created by the \macro{localmoduletable} macro. |
| 340 | |
| 341 | |
| 342 | \subsection{Reference List Markup \label{references}} |
| 343 | |
| 344 | Many sections include a list of references to module documentation |
| 345 | or external documents. These lists are created using the |
| 346 | \env{seealso} environment. This environment defines some |
| 347 | additional macros to support creating reference entries in a |
| 348 | reasonable manner. |
| 349 | |
| 350 | \begin{envdesc}{seealso}{} |
| 351 | This environment creates a ``See also:'' heading and defines the |
| 352 | markup used to describe individual references. |
| 353 | \end{envdesc} |
| 354 | |
| 355 | \begin{macrodesc}{seemodule}{{[}\var{key}{]}\{\var{name}\}\{\var{why}\}} |
| 356 | Refer to another module. \var{why} should be a brief |
| 357 | explanation of why the reference may be interesting. The module |
| 358 | name is given in \var{name}, with the link key given in |
| 359 | \var{key} if necessary. In the HTML and PDF conversions, the |
| 360 | module name will be a hyperlink to the referred-to module. |
| 361 | \end{macrodesc} |
| 362 | |
| 363 | \begin{macrodesc}{seetext}{\{\var{text}\}} |
| 364 | Add arbitrary text \var{text} to the ``See also:'' list. This |
| 365 | can be used to refer to off-line materials or on-line materials |
| 366 | using the \macro{url} macro. |
| 367 | \end{macrodesc} |
| 368 | |
| 369 | |
| 370 | \subsection{Index-generating Markup \label{indexing}} |
| 371 | |
| 372 | Effective index generation for technical documents can be very |
| 373 | difficult, especially for someone familliar with the topic but not |
| 374 | the creation of indexes. Much of the difficulty arises in the |
| 375 | area of terminology: including the terms an expert would use for a |
| 376 | concept is not sufficient. Coming up with the terms that a novice |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 377 | would look up is fairly difficult for an author who, typically, is |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 378 | an expert in the area she is writing on. |
| 379 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 380 | The truly difficult aspects of index generation are not areas with |
| 381 | which the documentation tools can help. However, ease |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 382 | of producing the index once content decisions are make is within |
| 383 | the scope of the tools. Markup is provided which the processing |
| 384 | software is able to use to generate a variety of kinds of index |
| 385 | entry with minimal effort. Additionally, many of the environments |
| 386 | described in Section \ref{info-units}, ``Information Units,'' will |
| 387 | generate appropriate entries into the general and module indexes. |
| 388 | |
| 389 | The following macro can be used to control the generation of index |
| 390 | data, and should be used in the document prologue: |
| 391 | |
| 392 | \begin{macrodesc}{makemodindex}{} |
| 393 | This should be used in the document prologue if a ``Module |
| 394 | Index'' is desired for a document containing reference material |
| 395 | on many modules. This causes a data file |
| 396 | \code{lib\macro{jobname}.idx} to be created from the |
| 397 | \macro{declaremodule} macros. This file can be processed by the |
| 398 | \program{makeindex} program to generate a file which can be |
| 399 | \macro{input} into the document at the desired location of the |
| 400 | module index. |
| 401 | \end{macrodesc} |
| 402 | |
| 403 | There are a number of macros that are useful for adding index |
| 404 | entries for particular concepts, many of which are specific to |
| 405 | programming languages or even Python. |
| 406 | |
| 407 | \begin{macrodesc}{bifuncindex}{\{\var{name}\}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 408 | Add a index entry referring to a built-in function named |
| 409 | \var{name}; parenthesis should not be included after |
| 410 | \var{name}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 411 | \end{macrodesc} |
| 412 | |
| 413 | \begin{macrodesc}{exindex}{\{\var{exception}\}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 414 | Add a reference to an exception named \var{exception}. The |
| 415 | exception may be either string- or class-based. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 416 | \end{macrodesc} |
| 417 | |
| 418 | \begin{macrodesc}{kwindex}{\{\var{keyword}\}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 419 | Add a reference to a language keyword (not a keyword parameter |
| 420 | in a function or method call). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 421 | \end{macrodesc} |
| 422 | |
| 423 | \begin{macrodesc}{obindex}{\{\var{object type}\}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 424 | Add an index entry for a built-in object type. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 425 | \end{macrodesc} |
| 426 | |
| 427 | \begin{macrodesc}{opindex}{\{\var{operator}\}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 428 | Add a reference to an operator, such as \samp{+}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 429 | \end{macrodesc} |
| 430 | |
| 431 | \begin{macrodesc}{refmodindex}{{[}\var{key}{]}\{\var{module}\}} |
| 432 | Add an index entry for module \var{module}; if \var{module} |
| 433 | contains an underscore, the optional parameter \var{key} should |
| 434 | be provided as the same string with underscores removed. An |
| 435 | index entry ``\var{module} (module)'' will be generated. This |
| 436 | is intended for use with non-standard modules implemented in |
| 437 | Python. |
| 438 | \end{macrodesc} |
| 439 | |
| 440 | \begin{macrodesc}{refexmodindex}{{[}\var{key}{]}\{\var{module}\}} |
| 441 | As for \macro{refmodindex}, but the index entry will be |
| 442 | ``\var{module} (extension module).'' This is intended for use |
| 443 | with non-standard modules not implemented in Python. |
| 444 | \end{macrodesc} |
| 445 | |
| 446 | \begin{macrodesc}{refbimodindex}{{[}\var{key}{]}\{\var{module}\}} |
| 447 | As for \macro{refmodindex}, but the index entry will be |
| 448 | ``\var{module} (built-in module).'' This is intended for use |
| 449 | with standard modules not implemented in Python. |
| 450 | \end{macrodesc} |
| 451 | |
| 452 | \begin{macrodesc}{refstmodindex}{{[}\var{key}{]}\{\var{module}\}} |
| 453 | As for \macro{refmodindex}, but the index entry will be |
| 454 | ``\var{module} (standard module).'' This is intended for use |
| 455 | with standard modules implemented in Python. |
| 456 | \end{macrodesc} |
| 457 | |
| 458 | \begin{macrodesc}{stindex}{\{\var{statement}\}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 459 | Add an index entry for a statement type, such as \keyword{print} |
| 460 | or \keyword{try}/\keyword{finally}. [XXX Need better examples |
| 461 | of difference from \macro{kwindex}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 462 | \end{macrodesc} |
| 463 | |
| 464 | |
| 465 | Additional macros are provided which are useful for conveniently |
| 466 | creating general index entries which should appear at many places |
| 467 | in the index by rotating a list of words. These are simple macros |
| 468 | that simply use \macro{index} to build some number of index |
| 469 | entries. Index entries build using these macros contain both |
| 470 | primary and secondary text. |
| 471 | |
| 472 | \begin{macrodesc}{indexii}{\{\var{word1}\}\{\var{word2}\}} |
| 473 | Build two index entries. This is exactly equivalent to using |
| 474 | \code{\e index\{\var{word1}!\var{word2}\}} and |
| 475 | \code{\e index\{\var{word2}!\var{word1}\}}. |
| 476 | \end{macrodesc} |
| 477 | |
| 478 | \begin{macrodesc}{indexiii}{\{\var{word1}\}\{\var{word2}\}\{\var{word3}\}} |
| 479 | Build three index entries. This is exactly equivalent to using |
| 480 | \code{\e index\{\var{word1}!\var{word2} \var{word3}\}}, |
| 481 | \code{\e index\{\var{word2}!\var{word3}, \var{word1}\}}, and |
| 482 | \code{\e index\{\var{word3}!\var{word1} \var{word2}\}}. |
| 483 | \end{macrodesc} |
| 484 | |
| 485 | \begin{macrodesc}{indexiv}{\{\var{word1}\}\{\var{word2}\}\{\var{word3}\}\{\var{word4}\}} |
| 486 | Build four index entries. This is exactly equivalent to using |
| 487 | \code{\e index\{\var{word1}!\var{word2} \var{word3} \var{word4}\}}, |
| 488 | \code{\e index\{\var{word2}!\var{word3} \var{word4}, \var{word1}\}}, |
| 489 | \code{\e index\{\var{word3}!\var{word4}, \var{word1} \var{word2}\}}, |
| 490 | and |
| 491 | \code{\e index\{\var{word4}!\var{word1} \var{word2} \var{word3}\}}. |
| 492 | \end{macrodesc} |
| 493 | |
| 494 | |
| 495 | \section{Special Names} |
| 496 | |
| 497 | Many special names are used in the Python documentation, including |
| 498 | the names of operating systems, programming languages, standards |
| 499 | bodies, and the like. Many of these were assigned \LaTeX{} macros |
| 500 | at some point in the distant past, and these macros lived on long |
| 501 | past their usefulness. In the current markup, these entities are |
| 502 | not assigned any special markup, but the preferred spellings are |
| 503 | given here to aid authors in maintaining the consistency of |
| 504 | presentation in the Python documentation. |
| 505 | |
| 506 | \begin{description} |
| 507 | \item[POSIX] |
| 508 | The name assigned to a particular group of standards. This is |
| 509 | always uppercase. |
| 510 | |
| 511 | \item[Python] |
| 512 | The name of our favorite programming language is always |
| 513 | capitalized. |
| 514 | \end{description} |
| 515 | |
| 516 | |
| 517 | \section{Processing Tools} |
| 518 | |
| 519 | \subsection{External Tools} |
| 520 | |
| 521 | Many tools are needed to be able to process the Python |
| 522 | documentation if all supported formats are required. This |
| 523 | section lists the tools used and when each is required. |
| 524 | |
| 525 | \begin{description} |
| 526 | \item[\program{dvips}] |
| 527 | This program is a typical part of \TeX{} installations. It is |
| 528 | used to generate PostScript from the ``device independent'' |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 529 | \file{.dvi} files. It is needed for the conversion to |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 530 | PostScript. |
| 531 | |
| 532 | \item[\program{emacs}] |
| 533 | Emacs is the kitchen sink of programmers' editors, and a damn |
| 534 | fine kitchen sink it is. It also comes with some of the |
| 535 | processing needed to support the proper menu structures for |
| 536 | Texinfo documents when an info conversion is desired. This is |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 537 | needed for the info conversion. Using \program{xemacs} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 538 | instead of FSF \program{emacs} may lead to instability in the |
| 539 | conversion, but that's because nobody seems to maintain the |
| 540 | Emacs Texinfo code in a portable manner. |
| 541 | |
| 542 | \item[\program{latex}] |
| 543 | This is a world-class typesetter by Donald Knuth. It is used |
| 544 | for the conversion to PostScript, and is needed for the HTML |
| 545 | conversion as well (\LaTeX2HTML requires one of the |
| 546 | intermediate files it creates). |
| 547 | |
| 548 | \item[\program{latex2html}] |
| 549 | Probably the longest Perl script anyone ever attempted to |
| 550 | maintain. This converts \LaTeX{} documents to HTML documents, |
| 551 | and does a pretty reasonable job. It is required for the |
| 552 | conversions to HTML and GNU info. |
| 553 | |
| 554 | \item[\program{lynx}] |
| 555 | This is a text-mode Web browser which includes an |
| 556 | HTML-to-plain text conversion. This is used to convert |
| 557 | \code{howto} documents to text. |
| 558 | |
| 559 | \item[\program{make}] |
| 560 | Just about any version should work for the standard documents, |
| 561 | but GNU \program{make} is required for the experimental |
| 562 | processes in \file{Doc/tools/sgmlconv/}, at least while |
| 563 | they're experimental. |
| 564 | |
| 565 | \item[\program{makeindex}] |
| 566 | This is a standard program for converting \LaTeX{} index data |
| 567 | to a formatted index; it should be included with all \LaTeX{} |
| 568 | installations. It is needed for the PDF and PostScript |
| 569 | conversions. |
| 570 | |
| 571 | \item[\program{makeinfo}] |
| 572 | GNU \program{makeinfo} is used to convert Texinfo documents to |
| 573 | GNU info files. Since Texinfo is used as an intermediate |
| 574 | format in the info conversion, this program is needed in that |
| 575 | conversion. |
| 576 | |
| 577 | \item[\program{pdflatex}] |
| 578 | pdf\TeX{} is a relatively new variant of \TeX, and is used to |
| 579 | generate the PDF version of the manuals. It is typically |
| 580 | installed as part of most of the large \TeX{} distributions. |
| 581 | \program{pdflatex} is PDF\TeX{} using the \LaTeX{} format. |
| 582 | |
| 583 | \item[\program{perl}] |
| 584 | Perl is required for \LaTeX2HTML{} and one of the scripts used |
| 585 | to post-process \LaTeX2HTML output, as well as the |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 586 | HTML-to-Texinfo conversion. This is required for |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 587 | the HTML and GNU info conversions. |
| 588 | |
| 589 | \item[\program{python}] |
| 590 | Python is used for many of the scripts in the |
| 591 | \file{Doc/tools/} directory; it is required for all |
| 592 | conversions. This shouldn't be a problem if you're interested |
| 593 | in writing documentation for Python! |
| 594 | \end{description} |
| 595 | |
| 596 | |
| 597 | \subsection{Internal Tools} |
| 598 | |
| 599 | This section describes the various scripts that are used to |
| 600 | implement various stages of document processing or to orchestrate |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 601 | entire build sequences. Most of these tools are only useful |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 602 | in the context of building the standard documentation, but some |
| 603 | are more general. |
| 604 | |
| 605 | \begin{description} |
| 606 | \item[\program{mkhowto}] |
| 607 | \end{description} |
| 608 | |
| 609 | |
| 610 | \section{Future Directions \label{futures}} |
| 611 | |
| 612 | The history of the Python documentation is full of changes, most of |
| 613 | which have been fairly small and evolutionary. There has been a |
| 614 | great deal of discussion about making large changes in the markup |
| 615 | languages and tools used to process the documentation. This section |
| 616 | deals with the nature of the changes and what appears to be the most |
| 617 | likely path of future development. |
| 618 | |
| 619 | \subsection{Structured Documentation \label{structured}} |
| 620 | |
| 621 | Most of the small changes to the \LaTeX{} markup have been made |
| 622 | with an eye to divorcing the markup from the presentation, making |
| 623 | both a bit more maintainable. Over the course of 1998, a large |
| 624 | number of changes were made with exactly this in mind; previously, |
| 625 | changes had been made but in a less systematic manner and with |
| 626 | more concern for not needing to update the existing content. The |
| 627 | result has been a highly structured and semantically loaded markup |
| 628 | language implemented in \LaTeX. With almost no basic \TeX{} or |
| 629 | \LaTeX{} markup in use, however, the markup syntax is about the |
| 630 | only evidence of \LaTeX{} in the actual document sources. |
| 631 | |
| 632 | One side effect of this is that while we've been able to use |
| 633 | standard ``engines'' for manipulating the documents, such as |
| 634 | \LaTeX{} and \LaTeX2HTML, most of the actual transformations have |
| 635 | been created specifically for this documentation. The \LaTeX{} |
| 636 | document classes and \LaTeX2HTML support are both complete |
| 637 | implementations of the specific markup designed for these |
| 638 | documents. |
| 639 | |
| 640 | Combining highly customized markup with the somewhat esoteric |
| 641 | systems used to process the documents leads us to ask some |
| 642 | questions: Can we do this more easily? and, Can we do this |
| 643 | better? After a great deal of discussion with the community, we |
| 644 | have determined that actively pursuing modern structured |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 645 | documentation systems is worth some investment of time. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 646 | |
| 647 | There appear to be two real contenders in this arena: the Standard |
| 648 | General Markup Language (SGML), and the Extensible Markup Language |
| 649 | (XML). Both of these standards have advantages and disadvantages, |
| 650 | and many advantages are shared. |
| 651 | |
| 652 | SGML offers advantages which may appeal most to authors, |
| 653 | especially those using ordinary text editors. There are also |
| 654 | additional abilities to define content models. A number of |
| 655 | high-quality tools with demonstrated maturity is available, but |
| 656 | most are not free; for those which are, portability issues remain |
| 657 | a problem. |
| 658 | |
| 659 | The advantages of XML include the availability of a large number |
| 660 | of evolving tools. Unfortunately, many of the associated |
| 661 | standards are still evolving, and the tools will have to follow |
| 662 | along. This means that developing a robust tool set that uses |
| 663 | more than the basic XML 1.0 recommendation is not possible in the |
| 664 | short term. The promised availability of a wide variety of |
| 665 | high-quality tools which support some of the most important |
| 666 | related standards is not immediate. Many tools are likely to be |
| 667 | free. |
| 668 | |
| 669 | [Eventual migration to SGML/XML.] |
| 670 | |
| 671 | \subsection{Discussion Forums \label{discussion}} |
| 672 | |
| 673 | Discussion of the future of the Python documentation and related |
| 674 | topics takes place in the ``Doc-SIG'' special interest group. |
| 675 | Information on the group, including mailing list archives and |
| 676 | subscriptions, is available at |
| 677 | \url{http://www.python.org/sigs/doc-sig/}. The SIG is open to all |
| 678 | interested parties. |
| 679 | |
| 680 | Comments and bug reports on the standard documents should be sent |
| 681 | to \email{python-docs@python.org}. This may include comments |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame^] | 682 | about formatting, content, grammatical errors, or this document. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 683 | |
| 684 | \end{document} |