summaryrefslogtreecommitdiff
path: root/Doc/texinputs/python.sty
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1998-03-09 16:35:36 +0000
committerFred Drake <fdrake@acm.org>1998-03-09 16:35:36 +0000
commitb390daf704c9b58af510c3414feb97bee5710d7c (patch)
treed7f3dbed02fc88742a078d39dca8884c7e88c230 /Doc/texinputs/python.sty
parent8fcad7beb1b98af740c341efd2b7313f30a517f7 (diff)
downloadcpython-git-b390daf704c9b58af510c3414feb97bee5710d7c.tar.gz
Adjust the index support a bit to make it easier to deal with module index.
Don't generate the mod???.idx file if it wasn't requested with the new command \makemodindex. Change the format of mod???.idx to match that of "normal" .idx files. This lets us use makeindex for it and not need a special script.
Diffstat (limited to 'Doc/texinputs/python.sty')
-rw-r--r--Doc/texinputs/python.sty61
1 files changed, 38 insertions, 23 deletions
diff --git a/Doc/texinputs/python.sty b/Doc/texinputs/python.sty
index 177cf2a7b0..e98b3edb4f 100644
--- a/Doc/texinputs/python.sty
+++ b/Doc/texinputs/python.sty
@@ -269,26 +269,52 @@
\newcommand{\refstmodindex}[1]{\refmodule{#1}{standard }}
% support for the module index
-\if@usemoduleindex
- \newwrite\modindexfile
- \openout\modindexfile=mod\jobname.idx
-\fi
+\newif\if@UseModuleIndex
+\@UseModuleIndexfalse
+
+\newcommand{\indexlabel}{genindex}
+
+% Fix the theindex environment to add an entry to the Table of
+% Contents; this is much nicer than just having to jump to the end of
+% the book and flip around, especially with multiple indexes.
+%
+\let\OldTheindex=\theindex
+\renewcommand{\theindex}{
+ \cleardoublepage
+ \OldTheindex
+ \addcontentsline{toc}{chapter}{\indexname}
+ \label{\indexlabel}
+}
+
+\newcommand{\@thismodule}{$<<$ ERROR - NO CURRENT MODULE $>>$}
% Add the defining entry for a module
-\newcommand{\defmodindex}[2]{%
+\newcommand{\@modindex}[2]{%
\index{#1@{\idxcode{#1}} (#2module)|textbf}%
\setindexsubitem{(in module #1)}%
- \if@usemoduleindex%
- \write\modindexfile{#1 \thepage}%
- \fi}
+ \if@UseModuleIndex%
+ \write\modindexfile{\protect\indexentry{#1@{\tt #1}}{\thepage}}%
+ \fi%
+ \renewcommand{\@thismodule}{#1}
+}
+
+\newcommand{\makemodindex}{
+ \newwrite\modindexfile
+ \openout\modindexfile=mod\jobname.idx
+ \@UseModuleIndextrue
+}
+
+\newcommand{\inputindex}[1]{
+ \IfFileExists{#1}{\input{#1}}{\begin{theindex}\end{theindex}}
+}
% built-in & Python modules in the main distribution
-\newcommand{\bimodindex}[1]{\defmodindex{#1}{built-in }}
-\newcommand{\stmodindex}[1]{\defmodindex{#1}{standard }}
+\newcommand{\bimodindex}[1]{\@modindex{#1}{built-in }}
+\newcommand{\stmodindex}[1]{\@modindex{#1}{standard }}
% Python & extension modules outside the main distribution
-\newcommand{\modindex}[1]{\defmodindex{#1}{}}
-\newcommand{\exmodindex}[1]{\defmodindex{#1}{extension }}
+\newcommand{\modindex}[1]{\@modindex{#1}{}}
+\newcommand{\exmodindex}[1]{\@modindex{#1}{extension }}
% Additional string for an index entry
\newcommand{\index@subitem}{}
@@ -534,17 +560,6 @@
}{\par}
-% Fix the theindex environment to add an entry to the Table of
-% Contents; this is much nicer than just having to jump to the end of
-% the book and flip around, especially with multiple indexes.
-%
-\let\OldTheindex=\theindex
-\renewcommand{\theindex}{
- \cleardoublepage
- \OldTheindex
- \addcontentsline{toc}{chapter}{\indexname}
-}
-
% Allow the release number to be specified independently of the
% \date{}. This allows the date to reflect the document's date and
% release to specify the Python release that is documented.