summaryrefslogtreecommitdiff
path: root/sphinx/texinputs/sphinx.sty
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-12-29 00:11:06 +0100
committerGeorg Brandl <georg@python.org>2008-12-29 00:11:06 +0100
commit4bf099d8d918da17f38cd82a099d23a764e0db8c (patch)
treed547fcdcf5da1ba25a4e6a92973b4547eeb503f4 /sphinx/texinputs/sphinx.sty
parent9c80f3ece26e7fc5cbb3e3abec4ae3c697bb6604 (diff)
downloadsphinx-4bf099d8d918da17f38cd82a099d23a764e0db8c.tar.gz
Close #23: Added a ``classmethod`` directive along with ``method``
and ``staticmethod``.
Diffstat (limited to 'sphinx/texinputs/sphinx.sty')
-rw-r--r--sphinx/texinputs/sphinx.sty29
1 files changed, 29 insertions, 0 deletions
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index e5ed4d79..bb247664 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -451,6 +451,35 @@
\fi
}{\end{fulllineitems}}
+% class method ----------------------------------------------------------
+% \begin{classmethoddesc}[classname]{methodname}{args}
+\newcommand{\classmethodline}[3][\@undefined]{
+ \classmethodlineni{#2}{#3}
+ \ifx\@undefined#1\relax
+ \index{#2@{\py@idxcode{#2()}} (\py@thisclass\ class method)}
+ \else
+ \index{#2@{\py@idxcode{#2()}} (#1 class method)}
+ \fi
+}
+\newenvironment{classmethoddesc}[3][\@undefined]{
+ \begin{fulllineitems}
+ \ifx\@undefined#1\relax
+ \classmethodline{#2}{#3}
+ \else
+ \def\py@thisclass{#1}
+ \classmethodline{#2}{#3}
+ \fi
+}{\end{fulllineitems}}
+
+% similar to {classmethoddesc}, but doesn't add to the index
+% (never actually uses the optional argument)
+\newcommand{\classmethodlineni}[3][\py@classbadkey]{%
+ \py@sigline{class \bfcode{#2}}{#3}}
+\newenvironment{classmethoddescni}[3][\py@classbadkey]{
+ \begin{fulllineitems}
+ \classmethodlineni{#2}{#3}
+}{\end{fulllineitems}}
+
% object data attribute --------------------------------------------------
% \begin{memberdesc}[classname]{membername}
\newcommand{\memberline}[2][\py@classbadkey]{%