[Python-checkins] r62692 - in doctools/trunk/sphinx: latexwriter.py texinputs/sphinx.sty
georg.brandl
python-checkins at python.org
Sun May 4 10:14:03 CEST 2008
Author: georg.brandl
Date: Sun May 4 10:14:02 2008
New Revision: 62692
Log:
Fix bug in sphinx.sty and the latexwriter for objects without a defined module.
Modified:
doctools/trunk/sphinx/latexwriter.py
doctools/trunk/sphinx/texinputs/sphinx.sty
Modified: doctools/trunk/sphinx/latexwriter.py
==============================================================================
--- doctools/trunk/sphinx/latexwriter.py (original)
+++ doctools/trunk/sphinx/latexwriter.py Sun May 4 10:14:02 2008
@@ -310,9 +310,15 @@
elif d.env in ('datadesc', 'classdesc*', 'excdesc', 'csimplemacrodesc'):
t2 = "{%s}" % (d.name)
elif d.env == 'methoddesc':
- t2 = "[%s]{%s}{%s}" % (d.cls, d.name, d.params)
+ if d.cls:
+ t2 = "[%s]{%s}{%s}" % (d.cls, d.name, d.params)
+ else:
+ t2 = "{%s}{%s}" % (d.name, d.params)
elif d.env == 'memberdesc':
- t2 = "[%s]{%s}" % (d.cls, d.name)
+ if d.cls:
+ t2 = "[%s]{%s}" % (d.cls, d.name)
+ else:
+ t2 = "{%s}" % d.name
elif d.env == 'cfuncdesc':
t2 = "{%s}{%s}{%s}" % (d.type, d.name, d.params)
elif d.env == 'cmemberdesc':
Modified: doctools/trunk/sphinx/texinputs/sphinx.sty
==============================================================================
--- doctools/trunk/sphinx/texinputs/sphinx.sty (original)
+++ doctools/trunk/sphinx/texinputs/sphinx.sty Sun May 4 10:14:02 2008
@@ -270,6 +270,7 @@
\newcommand{\py at thismodule}{}
\newcommand{\py at thismodulekey}{}
\newcommand{\py at thismoduletype}{}
+\newcommand{\py at emptymodule}{}
% Module index types
\newcommand{\py at standardIndexModule}[1]{\py at modindex{#1}{standard }}
@@ -465,7 +466,11 @@
% \begin{funcdesc}{name}{args}
\newcommand{\funcline}[2]{%
\funclineni{#1}{#2}%
- \index{#1@{\py at idxcode{#1()}} (in module \py at thismodule)}}
+ \ifx\py at thismodule\py at emptymodule%
+ \index{#1@{\py at idxcode{#1()}}}%
+ \else%
+ \index{#1@{\py at idxcode{#1()}} (in module \py at thismodule)}%
+ \fi}
\newenvironment{funcdesc}[2]{
\begin{fulllineitems}
\funcline{#1}{#2}
@@ -483,7 +488,11 @@
% \begin{classdesc}{name}{constructor args}
\newcommand{\classline}[2]{
\py at sigline{\strong{class }\bfcode{#1}}{#2}%
- \index{#1@{\py at idxcode{#1}} (class in \py at thismodule)}}
+ \ifx\py at thismodule\py at emptymodule%
+ \index{#1@{\py at idxcode{#1}} (class)}%
+ \else%
+ \index{#1@{\py at idxcode{#1}} (class in \py at thismodule)}%
+ \fi}
\newenvironment{classdesc}[2]{
% Using \renewcommand doesn't work for this, for unknown reasons:
\global\def\py at thisclass{#1}
@@ -506,7 +515,11 @@
\global\def\py at thisclass{#1}
\begin{fulllineitems}
\item[\strong{class }\code{\bfcode{#1}}%
- \index{#1@{\py at idxcode{#1}} (class in \py at thismodule)}]
+ \ifx\py at thismodule\py at emptymodule%
+ \index{#1@{\py at idxcode{#1}} (class)}%
+ \else%
+ \index{#1@{\py at idxcode{#1}} (class in \py at thismodule)}%
+ \fi]
}{\end{fulllineitems}}
% \begin{excclassdesc}{name}{constructor args}
@@ -516,7 +529,11 @@
\global\def\py at thisclass{#1}
\begin{fulllineitems}
\py at sigline{\strong{exception }\bfcode{#1}}{#2}%
- \index{#1@{\py at idxcode{#1}} (exception in \py at thismodule)}
+ \ifx\py at thismodule\py at emptymodule%
+ \index{#1@{\py at idxcode{#1}} (exception)}%
+ \else%
+ \index{#1@{\py at idxcode{#1}} (exception in \py at thismodule)}%
+ \fi
}{\end{fulllineitems}}
% There is no corresponding {excclassdesc*} environment. To describe
@@ -589,13 +606,21 @@
\newenvironment{excdesc}[1]{
\begin{fulllineitems}
\item[\strong{exception }\bfcode{#1}%
- \index{#1@{\py at idxcode{#1}} (exception in \py at thismodule)}]
+ \ifx\py at thismodule\py at emptymodule%
+ \index{#1@{\py at idxcode{#1}} (exception)}%
+ \else%
+ \index{#1@{\py at idxcode{#1}} (exception in \py at thismodule)}%
+ \fi]
}{\end{fulllineitems}}
% Module data or constants: ----------------------------------------------
% \begin{datadesc}{name}
\newcommand{\dataline}[1]{%
- \datalineni{#1}\index{#1@{\py at idxcode{#1}} (data in \py at thismodule)}}
+ \datalineni{#1}\ifx\py at thismodule\py at emptymodule%
+ \index{#1@{\py at idxcode{#1}} (data)}%
+ \else%
+ \index{#1@{\py at idxcode{#1}} (data in \py at thismodule)}%
+ \fi}
\newenvironment{datadesc}[1]{
\begin{fulllineitems}
\dataline{#1}
More information about the Python-checkins
mailing list