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