diff options
author | Fred Drake <fdrake@acm.org> | 1998-03-12 06:41:40 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1998-03-12 06:41:40 (GMT) |
commit | 0ee9f727c9e4437d615f6f5877d9f0383d99e726 (patch) | |
tree | 010183dad6d808c686e748b03c5227e9992292c3 /Doc | |
parent | 6a1eefe53584fe33e1f8e39ad3f1f2ffa6d8536a (diff) | |
download | cpython-0ee9f727c9e4437d615f6f5877d9f0383d99e726.zip cpython-0ee9f727c9e4437d615f6f5877d9f0383d99e726.tar.gz cpython-0ee9f727c9e4437d615f6f5877d9f0383d99e726.tar.bz2 |
\withsubitem{}: New macro. Change indexsubitem temporarily for another
macro. Intended usage:
\withsubitem{(in module foo)}{\ttindex{myfunc()}}
This allows indexing functions from other modules/class/whatnot
without being dependent on the exact expansions of several macros
internal to python.sty. It's also easier to read in the source!
Some new "logical" macros that seem to be useful:
\regexp{}: For regular expressions. To make it easier to keep the appearance
consistent.
\mimetype{}: Don't use \code{}!
\envvar{}: Environment variable. This does some indexing as well.
\character{}: Just a character we want to talk about in the text, but not
a Python constant.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/texinputs/python.sty | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/Doc/texinputs/python.sty b/Doc/texinputs/python.sty index e98b3ed..f281cb5 100644 --- a/Doc/texinputs/python.sty +++ b/Doc/texinputs/python.sty @@ -286,17 +286,9 @@ \label{\indexlabel} } +% these should dump an error or warning to the transcript \newcommand{\@thismodule}{$<<$ ERROR - NO CURRENT MODULE $>>$} - -% Add the defining entry for a module -\newcommand{\@modindex}[2]{% - \index{#1@{\idxcode{#1}} (#2module)|textbf}% - \setindexsubitem{(in module #1)}% - \if@UseModuleIndex% - \write\modindexfile{\protect\indexentry{#1@{\tt #1}}{\thepage}}% - \fi% - \renewcommand{\@thismodule}{#1} -} +\newcommand{\@thisclass}{$<<$ ERROR - NO CURRENT CLASS $>>$} \newcommand{\makemodindex}{ \newwrite\modindexfile @@ -308,6 +300,16 @@ \IfFileExists{#1}{\input{#1}}{\begin{theindex}\end{theindex}} } +% Add the defining entry for a module +\newcommand{\@modindex}[2]{% + \renewcommand{\@thismodule}{#1} + \setindexsubitem{(in module \@thismodule)}% + \index{#1@{\idxcode{#1}} (#2module)|textbf}% + \if@UseModuleIndex% + \write\modindexfile{\protect\indexentry{#1@{\tt #1}}{\thepage}}% + \fi% +} + % built-in & Python modules in the main distribution \newcommand{\bimodindex}[1]{\@modindex{#1}{built-in }} \newcommand{\stmodindex}[1]{\@modindex{#1}{standard }} @@ -321,6 +323,11 @@ \newcommand{\setindexsubitem}[1]{\renewcommand{\index@subitem}{#1}} \newcommand{\ttindex}[1]{\index{#1@{\idxcode{#1}} \index@subitem}} +\newcommand{\withsubitem}[2]{% + \begingroup% + \def\index@subitem{#1}#2% + \endgroup% +} % {fulllineitems} is used in one place in libregex.tex, but is really for % internal use in this file. @@ -371,6 +378,7 @@ }{\end{fulllineitems}} \newenvironment{classdesc}[2]{% + \renewcommand{\@thisclass}{#1}% \begin{fulllineitems}% \item[\code{\bfcode{#1}(\varvars{#2})}]% \ttindex{#1}% @@ -430,7 +438,7 @@ \newcommand{\dfn}[1]{\emph{#1}} \newcommand{\strong}[1]{{\bf #1}} % let's experiment with a new font: -\newcommand{\file}[1]{\mbox{`\small\textsf{#1}'}} +\newcommand{\file}[1]{`{\small\textsf{#1}}'} % Use this def/redef approach for \url{} since hyperref defined this already, % but only if we actually used hyperref: @@ -446,7 +454,7 @@ }% formatting "box". } \let\url=\pythonurl -\newcommand{\email}[1]{\mbox{\small\textsf{#1}}} +\newcommand{\email}[1]{{\small\textsf{#1}}} \newcommand{\varvars}[1]{{\def\,{\/{\char`\,}}\var{#1}}} @@ -472,6 +480,15 @@ \let\ctype=\code \let\cdata=\code +\newcommand{\mimetype}[1]{{\small\textsf{#1}}} +\newcommand{\regexp}[1]{$_\lceil$#1$^\rfloor$} +\newcommand{\envvar}[1]{% + \$#1% + \index{#1@{\$#1}}% + \index{environment variables!{\$#1}}% +} +\let\character=\samp + % constants defined in Python modules or C headers, not language constants: \let\constant=\code |