summaryrefslogtreecommitdiff
path: root/sphinx/texinputs
diff options
context:
space:
mode:
authorMarcio Mazza <marciomazza@gmail.com>2011-12-04 14:43:46 -0200
committerMarcio Mazza <marciomazza@gmail.com>2011-12-04 14:43:46 -0200
commitb51a578f2ae5bcc20a9ff5ee87730bc25cf56c06 (patch)
treead0351bee2ee3db3cbad432c6e0e3b6783887da4 /sphinx/texinputs
parentc755656b3eeea072d5e41cda51864c17327caf26 (diff)
downloadsphinx-b51a578f2ae5bcc20a9ff5ee87730bc25cf56c06.tar.gz
Make the 'bibliography TOC fix' specific to document class howto/manual (article/report)
Diffstat (limited to 'sphinx/texinputs')
-rw-r--r--sphinx/texinputs/sphinx.sty15
-rw-r--r--sphinx/texinputs/sphinxhowto.cls11
-rw-r--r--sphinx/texinputs/sphinxmanual.cls11
3 files changed, 28 insertions, 9 deletions
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index 84c1ca1e..08adec9e 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -402,10 +402,15 @@
}
-% Fix the index and bibliography environments to add an entry to the Table of
+% Fix the index 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.
%
+% A similiar fix must be done to the bibliography environment, although
+% dependant on document class. In particular, the '\addcontentsline' command
+% should use 'chapter' for a report and 'section' for an article.
+% See sphinxmanual.cls and sphinxhowto.cls for specific fixes.
+%
\let\py@OldTheindex=\theindex
\renewcommand{\theindex}{
\cleardoublepage
@@ -414,14 +419,6 @@
\addcontentsline{toc}{chapter}{\indexname}
}
-\let\py@OldThebibliography=\thebibliography
-\renewcommand{\thebibliography}[1]{
- \cleardoublepage
- \phantomsection
- \py@OldThebibliography{1}
- \addcontentsline{toc}{chapter}{\bibname}
-}
-
% Include hyperref last.
\RequirePackage[colorlinks,breaklinks,
linkcolor=InnerLinkColor,filecolor=OuterLinkColor,
diff --git a/sphinx/texinputs/sphinxhowto.cls b/sphinx/texinputs/sphinxhowto.cls
index 1ebdd434..f4e3d2f4 100644
--- a/sphinx/texinputs/sphinxhowto.cls
+++ b/sphinx/texinputs/sphinxhowto.cls
@@ -79,3 +79,14 @@
\pagenumbering{arabic} % ToC & chapters
\thispagestyle{empty}
+
+% Fix the bibliography environment to add an entry to the Table of
+% Contents.
+% For an article document class this environment is a section,
+% so no page break before it.
+\let\py@OldThebibliography=\thebibliography
+\renewcommand{\thebibliography}[1]{
+ \phantomsection
+ \py@OldThebibliography{1}
+ \addcontentsline{toc}{section}{\bibname}
+}
diff --git a/sphinx/texinputs/sphinxmanual.cls b/sphinx/texinputs/sphinxmanual.cls
index 57517798..57fad1a9 100644
--- a/sphinx/texinputs/sphinxmanual.cls
+++ b/sphinx/texinputs/sphinxmanual.cls
@@ -120,3 +120,14 @@
%
\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}
+
+% Fix the bibliography environment to add an entry to the Table of
+% Contents.
+% For a report document class this environment is a chapter.
+\let\py@OldThebibliography=\thebibliography
+\renewcommand{\thebibliography}[1]{
+ \cleardoublepage
+ \phantomsection
+ \py@OldThebibliography{1}
+ \addcontentsline{toc}{chapter}{\bibname}
+}