[Python-modules-commits] [sphinx] 01/06: Import sphinx_1.4.4.orig.tar.gz
Dmitry Shachnev
mitya57 at moszumanska.debian.org
Thu Jun 16 15:07:45 UTC 2016
This is an automated email from the git hooks/post-receive script.
mitya57 pushed a commit to branch master
in repository sphinx.
commit 61f7a9ff04ae1740146eb3d5726ba87b7ee05b08
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date: Thu Jun 16 17:56:41 2016 +0300
Import sphinx_1.4.4.orig.tar.gz
---
CHANGES | 23 ++++++++++
PKG-INFO | 2 +-
Sphinx.egg-info/PKG-INFO | 2 +-
Sphinx.egg-info/SOURCES.txt | 2 +
doc/config.rst | 2 +-
doc/theming.rst | 2 +
doc/tutorial.rst | 13 ++++--
setup.cfg | 4 +-
sphinx/__init__.py | 6 +--
sphinx/environment.py | 2 +-
sphinx/ext/mathbase.py | 2 +-
sphinx/io.py | 4 +-
sphinx/texinputs/iftex.sty | 97 +++++++++++++++++++++++++++++++++++++++
sphinx/texinputs/needspace.sty | 35 ++++++++++++++
sphinx/texinputs/sphinx.sty | 80 ++++++++++++++++++++------------
sphinx/texinputs/sphinxmanual.cls | 49 +++++---------------
sphinx/transforms.py | 18 ++++++++
sphinx/util/inspect.py | 2 +-
sphinx/writers/latex.py | 9 ++--
tests/path.py | 3 ++
tests/run.py | 2 +-
tests/test_api_translator.py | 2 +-
tests/test_autodoc.py | 67 ++++++++++++++++-----------
tests/test_autodoc_py35.py | 37 ++++++++-------
tests/test_build.py | 2 +-
tests/test_build_applehelp.py | 1 -
tests/test_build_gettext.py | 2 +-
tests/test_build_html.py | 16 +++----
tests/test_build_latex.py | 7 +--
tests/test_catalogs.py | 1 +
tests/test_config.py | 26 ++++++-----
tests/test_directive_code.py | 8 ++--
tests/test_domain_cpp.py | 12 ++---
tests/test_domain_rst.py | 2 +-
tests/test_ext_githubpages.py | 2 -
tests/test_ext_ifconfig.py | 2 -
tests/test_ext_math.py | 4 ++
tests/test_highlighting.py | 2 +-
tests/test_intl.py | 12 ++---
tests/test_markup.py | 5 +-
tests/test_search.py | 2 +
tests/test_util_i18n.py | 3 +-
tests/test_util_nodes.py | 3 --
tests/util.py | 3 +-
utils/reindent.py | 36 +++++++++------
utils/release-checklist | 14 ++++--
46 files changed, 427 insertions(+), 203 deletions(-)
diff --git a/CHANGES b/CHANGES
index 2b7f4d0..25b6282 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,26 @@
+Release 1.4.4 (released Jun 12, 2016)
+=====================================
+
+Bugs fixed
+----------
+
+* #2630: Latex sphinx.sty Notice Enviroment formatting problem
+* #2632: Warning directives fail in quote environment latex build
+* #2633: Sphinx crashes with old styled indices
+* Fix a ``\begin{\minipage}`` typo in sphinx.sty from 1.4.2 (ref: 68becb1)
+* #2622: Latex produces empty pages after title and table of contents
+* #2640: 1.4.2 LaTeX crashes if code-block inside warning directive
+* Let LaTeX use straight quotes also in inline code (ref #2627)
+* #2351: latex crashes if enumerated lists are placed on footnotes
+* #2646: latex crashes if math contains twice empty lines
+* #2480: `sphinx.ext.autodoc`: memory addresses were shown
+* latex: allow code-blocks appearing inside lists and quotes at maximal nesting depth (ref #777, #2624, #2651)
+* #2635: Latex code directives produce inconsistent frames based on viewing resolution
+* #2639: Sphinx now bundles iftex.sty
+* Failed to build PDF with framed.sty 0.95
+* Sphinx now bundles needspace.sty
+
+
Release 1.4.3 (released Jun 5, 2016)
====================================
diff --git a/PKG-INFO b/PKG-INFO
index b2d718e..2f4d2df 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Sphinx
-Version: 1.4.3
+Version: 1.4.4
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
diff --git a/Sphinx.egg-info/PKG-INFO b/Sphinx.egg-info/PKG-INFO
index b2d718e..2f4d2df 100644
--- a/Sphinx.egg-info/PKG-INFO
+++ b/Sphinx.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Sphinx
-Version: 1.4.3
+Version: 1.4.4
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
diff --git a/Sphinx.egg-info/SOURCES.txt b/Sphinx.egg-info/SOURCES.txt
index 22cc247..f4e6661 100644
--- a/Sphinx.egg-info/SOURCES.txt
+++ b/Sphinx.egg-info/SOURCES.txt
@@ -378,6 +378,8 @@ sphinx/search/non-minified-js/swedish-stemmer.js
sphinx/search/non-minified-js/turkish-stemmer.js
sphinx/texinputs/Makefile
sphinx/texinputs/fncychap.sty
+sphinx/texinputs/iftex.sty
+sphinx/texinputs/needspace.sty
sphinx/texinputs/newfloat.sty
sphinx/texinputs/python.ist
sphinx/texinputs/sphinx.sty
diff --git a/doc/config.rst b/doc/config.rst
index dd978fe..b45f9df 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -56,7 +56,7 @@ General configuration
.. confval:: extensions
- A list of strings that are module names of Sphinx extensions. These can be
+ A list of strings that are module names of :ref:`extensions`. These can be
extensions coming with Sphinx (named ``sphinx.ext.*``) or custom ones.
Note that you can extend :data:`sys.path` within the conf file if your
diff --git a/doc/theming.rst b/doc/theming.rst
index f124542..d778992 100644
--- a/doc/theming.rst
+++ b/doc/theming.rst
@@ -81,6 +81,8 @@ that has to return the directory with themes in it::
Builtin themes
--------------
+.. cssclass:: longtable
+
+--------------------+--------------------+
| **Theme overview** | |
+--------------------+--------------------+
diff --git a/doc/tutorial.rst b/doc/tutorial.rst
index 385746f..bced21a 100644
--- a/doc/tutorial.rst
+++ b/doc/tutorial.rst
@@ -300,12 +300,17 @@ features of intersphinx.
More topics to be covered
-------------------------
-- Other extensions (math, viewcode, doctest)
+- :doc:`Other extensions <extensions>`:
+
+ * :doc:`ext/math`,
+ * :doc:`ext/viewcode`,
+ * :doc:`ext/doctest`,
+ * ...
- Static files
-- Selecting a theme
-- Templating
+- :doc:`Selecting a theme <theming>`
+- :ref:`Templating <templating>`
- Using extensions
-- Writing extensions
+- :ref:`Writing extensions <dev-extensions>`
.. rubric:: Footnotes
diff --git a/setup.cfg b/setup.cfg
index 967678b..956804f 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -26,6 +26,6 @@ universal = 1
[flake8]
max-line-length = 95
-ignore = E113,E116,E221,E226,E241,E251
-exclude = ez_setup.py,utils/*,tests/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*
+ignore = E113,E116,E221,E226,E241,E251,E901
+exclude = tests/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*
diff --git a/sphinx/__init__.py b/sphinx/__init__.py
index 7203fde..252f24e 100644
--- a/sphinx/__init__.py
+++ b/sphinx/__init__.py
@@ -15,13 +15,13 @@
import sys
from os import path
-__version__ = '1.4.3'
-__released__ = '1.4.3' # used when Sphinx builds its own docs
+__version__ = '1.4.4'
+__released__ = '1.4.4' # used when Sphinx builds its own docs
# version info for better programmatic use
# possible values for 3rd element: 'alpha', 'beta', 'rc', 'final'
# 'final' has 0 as the last element
-version_info = (1, 4, 3, 'final', 0)
+version_info = (1, 4, 4, 'final', 0)
package_dir = path.abspath(path.dirname(__file__))
diff --git a/sphinx/environment.py b/sphinx/environment.py
index 78b4822..9d4c174 100644
--- a/sphinx/environment.py
+++ b/sphinx/environment.py
@@ -76,7 +76,7 @@ default_settings = {
# or changed to properly invalidate pickle files.
#
# NOTE: increase base version by 2 to have distinct numbers for Py2 and 3
-ENV_VERSION = 48 + (sys.version_info[0] - 2)
+ENV_VERSION = 49 + (sys.version_info[0] - 2)
dummy_reporter = Reporter('', 4, 4)
diff --git a/sphinx/ext/mathbase.py b/sphinx/ext/mathbase.py
index 13a560c..ddcec49 100644
--- a/sphinx/ext/mathbase.py
+++ b/sphinx/ext/mathbase.py
@@ -58,7 +58,7 @@ def wrap_displaymath(math, label, numbering):
begin = r'\begin{align*}%s\!\begin{aligned}' % labeldef
end = r'\end{aligned}\end{align*}'
for part in parts:
- equations.append('%s\\\\\n' % part)
+ equations.append('%s\\\\\n' % part.strip())
return '%s\n%s%s' % (begin, ''.join(equations), end)
diff --git a/sphinx/io.py b/sphinx/io.py
index 8d9970e..56d1336 100644
--- a/sphinx/io.py
+++ b/sphinx/io.py
@@ -15,7 +15,7 @@ from six import string_types, text_type
from sphinx.transforms import ApplySourceWorkaround, ExtraTranslatableNodes, Locale, \
CitationReferences, DefaultSubstitutions, MoveModuleTargets, HandleCodeBlocks, \
- AutoNumbering, SortIds, RemoveTranslatableInline
+ AutoNumbering, AutoIndexUpgrader, SortIds, RemoveTranslatableInline
from sphinx.util import import_object, split_docinfo
@@ -59,7 +59,7 @@ class SphinxStandaloneReader(SphinxBaseReader):
"""
transforms = [ApplySourceWorkaround, ExtraTranslatableNodes, Locale, CitationReferences,
DefaultSubstitutions, MoveModuleTargets, HandleCodeBlocks,
- AutoNumbering, SortIds, RemoveTranslatableInline]
+ AutoNumbering, AutoIndexUpgrader, SortIds, RemoveTranslatableInline]
class SphinxI18nReader(SphinxBaseReader):
diff --git a/sphinx/texinputs/iftex.sty b/sphinx/texinputs/iftex.sty
new file mode 100755
index 0000000..7651466
--- /dev/null
+++ b/sphinx/texinputs/iftex.sty
@@ -0,0 +1,97 @@
+%%
+%% This is file `iftex.sty',
+
+%%
+%% __________________________________
+%% Copyright © 2010–2013 Persian TeX Group
+%%
+%% License information appended.
+%%
+%%
+\csname iftexloaded\endcsname
+\let\iftexloaded\endinput
+\expandafter\ifx\csname ProvidesPackage\endcsname\relax\else
+ \ProvidesPackage{iftex}
+ [2013/04/04 v0.2 Provides if(tex) conditional for PDFTeX, XeTeX, and LuaTeX]
+\fi
+\def\RequirePDFTeX{%
+ \ifPDFTeX\else
+ \begingroup
+ \errorcontextlines=-1\relax
+ \newlinechar=10\relax
+ \errmessage{^^J
+ ********************************************^^J
+ * PDFTeX is required to compile this document.^^J
+ * Sorry!^^J
+ ********************************************}%
+ \endgroup
+ \fi}
+\def\RequireXeTeX{%
+ \ifXeTeX\else
+ \begingroup
+ \errorcontextlines=-1\relax
+ \newlinechar=10\relax
+ \errmessage{^^J
+ ********************************************^^J
+ * XeTeX is required to compile this document.^^J
+ * Sorry!^^J
+ ********************************************}%
+ \endgroup
+ \fi}
+\def\RequireLuaTeX{%
+ \ifLuaTeX\else
+ \begingroup
+ \errorcontextlines=-1\relax
+ \newlinechar=10\relax
+ \errmessage{^^J
+ ********************************************^^J
+ * LuaTeX is required to compile this document.^^J
+ * Sorry!^^J
+ ********************************************}%
+ \endgroup
+ \fi}
+\expandafter\ifx\csname ifPDFTeX\endcsname\relax\else
+ \expandafter\endinput
+\fi
+\expandafter\ifx\csname ifXeTeX\endcsname\relax\else
+ \expandafter\endinput
+\fi
+\expandafter\ifx\csname ifLuaTeX\endcsname\relax\else
+ \expandafter\endinput
+\fi
+\newif\ifPDFTeX
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname pdfmatch\endcsname\relax
+ \PDFTeXfalse
+\else
+ \PDFTeXtrue
+\fi
+\newif\ifXeTeX
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname XeTeXinterchartoks\endcsname\relax
+ \XeTeXfalse
+\else
+ \XeTeXtrue
+\fi
+\newif\ifLuaTeX
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname directlua\endcsname\relax
+ \LuaTeXfalse
+\else
+ \LuaTeXtrue
+\fi
+%%
+%% Copyright © 2010–2013 by Persian TeX Group <persian-tex at tug.org>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Persian TeX Group.
+%%
+%%
+%%
+%%
+%%
+%% End of file `iftex.sty'.
diff --git a/sphinx/texinputs/needspace.sty b/sphinx/texinputs/needspace.sty
new file mode 100644
index 0000000..113d872
--- /dev/null
+++ b/sphinx/texinputs/needspace.sty
@@ -0,0 +1,35 @@
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{needspace}[2010/09/12 v1.3d reserve vertical space]
+
+\newcommand{\needspace}[1]{%
+ \begingroup
+ \setlength{\dimen@}{#1}%
+ \vskip\z@\@plus\dimen@
+ \penalty -100\vskip\z@\@plus -\dimen@
+ \vskip\dimen@
+ \penalty 9999%
+ \vskip -\dimen@
+ \vskip\z at skip % hide the previous |\vskip| from |\addvspace|
+ \endgroup
+}
+
+\newcommand{\Needspace}{\@ifstar{\@sneedsp@}{\@needsp@}}
+
+\newcommand{\@sneedsp@}[1]{\par \penalty-100\begingroup
+ \setlength{\dimen@}{#1}%
+ \dimen at ii\pagegoal \advance\dimen at ii-\pagetotal
+ \ifdim \dimen@>\dimen at ii
+ \break
+ \fi\endgroup}
+
+\newcommand{\@needsp@}[1]{\par \penalty-100\begingroup
+ \setlength{\dimen@}{#1}%
+ \dimen at ii\pagegoal \advance\dimen at ii-\pagetotal
+ \ifdim \dimen@>\dimen at ii
+ \ifdim \dimen at ii>\z@
+ \vfil
+ \fi
+ \break
+ \fi\endgroup}
+
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index cc8c6d5..9b09b2b 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -21,6 +21,7 @@
% For framing code-blocks and warning type notices, and shadowing topics
\RequirePackage{framed}
\newif\ifSphinx at inframed % flag set if we are in a framed environment
+% ifthen not used anymore and will be removed at Sphinx-1.5
\RequirePackage{ifthen}
% The xcolor package draws better fcolorboxes around verbatim code
\IfFileExists{xcolor.sty}{
@@ -144,7 +145,10 @@
% Some custom font markup commands.
%
\newcommand{\strong}[1]{{\textbf{#1}}}
-\newcommand{\code}[1]{\texttt{#1}}
+% let \code and \bfcode use straight quotes (\@noligs patched by upquote)
+% use \scantokens to handle e.g. \item[{\code{'fontenc'}}], too late for
+% \code to change catcodes.
+\newcommand{\code}[1]{{\@noligs\scantokens{\texttt{#1}}}}
\newcommand{\bfcode}[1]{\code{\bfseries#1}}
\newcommand{\email}[1]{\textsf{#1}}
\newcommand{\tablecontinued}[1]{\textsf{#1}}
@@ -217,11 +221,19 @@
\hb at xt@\z@{\hss\begin{minipage}{\wd\@tempboxa}%
\SphinxVerbatimTitle
\end{minipage}\hss}\fi
- \hrule\@height\fboxrule\relax
- \hbox{\vrule\@width\fboxrule\relax
+ % draw frame border _latest_ to avoid pdf viewer issue
+ \kern\fboxrule
+ \hbox{\kern\fboxrule
\vbox{\vskip\fboxsep\copy\@tempboxa\vskip\fboxsep}%
- \vrule\@width\fboxrule\relax}%
- \hrule\@height\fboxrule\relax}%
+ \kern-\wd\@tempboxa\kern-\fboxrule
+ \vrule\@width\fboxrule
+ \kern\wd\@tempboxa
+ \vrule\@width\fboxrule}%
+ \kern-\dimexpr\fboxsep+\ht\@tempboxa+\dp\@tempboxa
+ +\fboxsep+\fboxrule\relax
+ \hrule\@height\fboxrule
+ \kern\dimexpr\fboxsep+\ht\@tempboxa+\dp\@tempboxa+\fboxsep\relax
+ \hrule\@height\fboxrule}%
}}%
\endgroup
\global\Sphinx at myfirstframedpassfalse
@@ -328,6 +340,10 @@
\discretionary{\copy\Sphinxvisiblespacebox}{\Sphinxafterbreak}
{\kern\fontdimen2\font}%
}%
+ % go around fancyvrb's check of @currenvir (for case of minipage below)
+ \renewcommand*{\VerbatimEnvironment}{\gdef\FV at EnvironName{Verbatim}}%
+ % go around fancyvrb's check of current list depth
+ \def\@toodeep {\advance\@listdepth\@ne}%
% Allow breaks at special characters using \PYG... macros.
\Sphinxbreaksatspecials
% The list environment is needed to control perfectly the vertical space.
@@ -335,20 +351,19 @@
% - if caption: vertical space above caption = (\abovecaptionskip + D) with
% D = \baselineskip-\FrameHeightAdjust, and then \smallskip above frame.
% - if no caption: (\smallskip + D) above frame. By default D=6pt.
- \list{}{%
- \setlength\parskip{0pt}%
- \setlength\itemsep{0ex}%
- \setlength\topsep{0ex}%
- \setlength\parsep{0pt}% let's not forget this one!
- \setlength\partopsep{0pt}%
- \setlength\leftmargin{0pt}%
- }%
- \item
+ % Use trivlist rather than list to avoid possible "too deeply nested" error.
+ \itemsep \z at skip
+ \topsep \z at skip
+ \partopsep \z at skip% trivlist will set \parsep to \parskip = zero (see above)
+ % \leftmargin will be set to zero by trivlist
+ \rightmargin\z@
+ \parindent \z@% becomes \itemindent. Default zero, but perhaps overwritten.
+ \trivlist\item\relax
% use a minipage if we are already inside a framed environment
- \relax\ifSphinx at inframed\noindent\begin{\minipage}{\linewidth}\fi
+ \ifSphinx at inframed\noindent\begin{minipage}{\linewidth}\fi
\MakeFramed {% adapted over from framed.sty's snugshade environment
- \advance\hsize-\width\@totalleftmargin\z@\linewidth\hsize
- \@setminipage }%
+ \advance\hsize-\width\@totalleftmargin\z@\linewidth\hsize
+ \@setminipage }%
\small
% For grid placement from \strut's in \FancyVerbFormatLine
\lineskip\z at skip
@@ -359,8 +374,7 @@
\endOriginalVerbatim
\par\unskip\@minipagefalse\endMakeFramed
\ifSphinx at inframed\end{minipage}\fi
- \endlist
- % LaTeX environments always revert local changes on exit, here e.g. \parskip
+ \endtrivlist
}
% define macro to frame contents and add shadow on right and bottom
@@ -404,7 +418,7 @@
\newenvironment{SphinxShadowBox}
{\def\FrameCommand {\Sphinx at ShadowFBox }%
% configure framed.sty not to add extra vertical spacing
- \OuterFrameSep \z at skip
+ \ifdefined\OuterFrameSep \OuterFrameSep\z at skip \fi
% the \trivlist will add the vertical spacing on top and bottom which is
% typical of center environment as used in Sphinx <= 1.4.1
% the \noindent has the effet of an extra blank line on top, to
@@ -520,7 +534,7 @@
% configure framed.sty's parameters to obtain same vertical spacing
% as for "light" boxes. We need for this to manually insert parskip glue and
% revert a skip done by framed before the frame.
- \setlength{\OuterFrameSep}{0pt}
+ \ifdefined\OuterFrameSep \OuterFrameSep\z at skip \fi
\vspace{\FrameHeightAdjust}
% copied/adapted from framed.sty's snugshade
\def\FrameCommand##1{\hskip\@totalleftmargin
@@ -530,7 +544,12 @@
\ifSphinx at inframed
\noindent\begin{minipage}{\linewidth}
\else
- \vspace{\parskip}
+ % handle case where notice is first thing in a list item (or is quoted)
+ \if at inlabel
+ \noindent\par\vspace{-\baselineskip}
+ \else
+ \vspace{\parskip}
+ \fi
\fi
\MakeFramed {\Sphinx at inframedtrue
\advance\hsize-\width \@totalleftmargin\z@ \linewidth\hsize
@@ -549,7 +568,8 @@
\ifvoid\@mpfootins\else
\vskip\skip\@mpfootins\normalcolor\footnoterule\unvbox\@mpfootins
\fi
- \@minipagefalse\endMakeFramed
+ \@minipagefalse
+ \endMakeFramed
\ifSphinx at inframed\end{minipage}\fi
% arrange for similar spacing below frame as for "light" boxes.
\vskip .4\baselineskip
@@ -565,7 +585,8 @@
% counteract previous possible negative skip (French lists!):
% (we can't cancel that any earlier \vskip introduced a potential pagebreak)
\ifdim\lastskip<\z@\vskip-\lastskip\fi
- \nobreak\vbox{\noindent\rule[.4\baselineskip]{\linewidth}{0.5pt}}\allowbreak
+ \nobreak\vbox{\noindent\kern\@totalleftmargin
+ \rule[.4\baselineskip]{\linewidth}{0.5pt}\hss}\allowbreak
}
% Some are quite plain:
@@ -752,12 +773,12 @@
\fi%
}
-\providecommand*{\DUprovidelength}[2]{
- \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
+\providecommand*{\DUprovidelength}[2]{%
+ \ifdefined#1\else\newlength{#1}\setlength{#1}{#2}\fi
}
\DUprovidelength{\DUlineblockindent}{2.5em}
-\ifthenelse{\isundefined{\DUlineblock}}{
+\ifdefined\DUlineblock\else
\newenvironment{DUlineblock}[1]{%
\list{}{\setlength{\partopsep}{\parskip}
\addtolength{\partopsep}{\baselineskip}
@@ -768,8 +789,7 @@
\raggedright
}
{\endlist}
-}{}
-
+\fi
% From footmisc.sty: allows footnotes in titles
\let\FN at sf@@footnote\footnote
@@ -823,7 +843,7 @@
% Define literal-block environment
\RequirePackage{newfloat}
\DeclareFloatingEnvironment{literal-block}
-\ifx\thechapter\undefined
+\ifx\c at chapter\undefined
\SetupFloatingEnvironment{literal-block}{within=section,placement=h}
\else
\SetupFloatingEnvironment{literal-block}{within=chapter,placement=h}
diff --git a/sphinx/texinputs/sphinxmanual.cls b/sphinx/texinputs/sphinxmanual.cls
index e9862db..69d0573 100644
--- a/sphinx/texinputs/sphinxmanual.cls
+++ b/sphinx/texinputs/sphinxmanual.cls
@@ -77,52 +77,27 @@
\end{flushright}%\par
\@thanks
\end{titlepage}%
- \cleardoublepage%
\setcounter{footnote}{0}%
\let\thanks\relax\let\maketitle\relax
%\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
}
-
-% Catch the end of the {abstract} environment, but here make sure the abstract
-% is followed by a blank page if the 'openright' option is used.
-%
-\let\py at OldEndAbstract=\endabstract
-\renewcommand{\endabstract}{
- \if at openright
- \ifodd\value{page}
- \typeout{Adding blank page after the abstract.}
- \vfil\pagebreak
- \fi
- \fi
- \py at OldEndAbstract
-}
-
-% This wraps the \tableofcontents macro with all the magic to get the spacing
-% right and have the right number of pages if the 'openright' option has been
-% used. This eliminates a fair amount of crud in the individual document files.
-%
\let\py at OldTableofcontents=\tableofcontents
\renewcommand{\tableofcontents}{%
+ % before resetting page counter, let's do the right thing.
+ \if at openright\cleardoublepage\else\clearpage\fi
\pagenumbering{roman}%
- \setcounter{page}{1}%
- \pagebreak%
\pagestyle{plain}%
- {%
- \parskip = 0mm%
- \py at OldTableofcontents%
- \if at openright%
- \ifodd\value{page}%
- \typeout{Adding blank page after the table of contents.}%
- \pagebreak\hspace{0pt}%
- \fi%
- \fi%
- \cleardoublepage%
- }%
+ \begingroup
+ \parskip \z at skip
+ \py at OldTableofcontents
+ \endgroup
+ % before resetting page counter, let's do the right thing.
+ \if at openright\cleardoublepage\else\clearpage\fi
\pagenumbering{arabic}%
- \@ifundefined{fancyhf}{}{\pagestyle{normal}}%
+ \ifdefined\fancyhf\pagestyle{normal}\fi
}
-\pagenumbering{alph}
+%\pagenumbering{alph}%
% This is needed to get the width of the section # area wide enough in the
% library reference. Doing it here keeps it the same for all the manuals.
@@ -135,7 +110,7 @@
% For a report document class this environment is a chapter.
\let\py at OldThebibliography=\thebibliography
\renewcommand{\thebibliography}[1]{
- \cleardoublepage
+ \if at openright\cleardoublepage\else\clearpage\fi
\phantomsection
\py at OldThebibliography{1}
\addcontentsline{toc}{chapter}{\bibname}
@@ -147,7 +122,7 @@
\@ifclassloaded{memoir}{}{
\let\py at OldTheindex=\theindex
\renewcommand{\theindex}{
- \cleardoublepage
+ \if at openright\cleardoublepage\else\clearpage\fi
\phantomsection
\py at OldTheindex
\addcontentsline{toc}{chapter}{\indexname}
diff --git a/sphinx/transforms.py b/sphinx/transforms.py
index abeab7d..cb4a577 100644
--- a/sphinx/transforms.py
+++ b/sphinx/transforms.py
@@ -170,6 +170,24 @@ class ApplySourceWorkaround(Transform):
apply_source_workaround(n)
+class AutoIndexUpgrader(Transform):
+ """
+ Detect old style; 4 column based indices and automatically upgrade to new style.
+ """
+ default_priority = 210
+
+ def apply(self):
+ env = self.document.settings.env
+ for node in self.document.traverse(addnodes.index):
+ if 'entries' in node and any(len(entry) == 4 for entry in node['entries']):
+ msg = ('4 column based index found. '
+ 'It might be a bug of extensions you use: %r' % node['entries'])
+ env.warn_node(msg, node)
+ for i, entry in enumerate(node['entries']):
+ if len(entry) == 4:
+ node['entries'][i] = entry + (None,)
+
+
class ExtraTranslatableNodes(Transform):
"""
make nodes translatable
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py
index 5dc2008..dbd578e 100644
--- a/sphinx/util/inspect.py
+++ b/sphinx/util/inspect.py
@@ -20,7 +20,7 @@ from sphinx.util import force_decode
# relatively import this module
inspect = __import__('inspect')
-memory_address_re = re.compile(r' at 0x[0-9a-f]{8,16}(?=>$)')
+memory_address_re = re.compile(r' at 0x[0-9a-f]{8,16}(?=>)')
if PY3:
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index b5b03ba..5bd6685 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -961,9 +961,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
def visit_collected_footnote(self, node):
self.in_footnote += 1
if 'footnotetext' in node:
- self.body.append('\\footnotetext[%s]{\sphinxAtStartFootnote%%' % node['number'])
+ self.body.append('\\footnotetext[%s]{\sphinxAtStartFootnote%%\n' % node['number'])
else:
- self.body.append('\\footnote[%s]{\sphinxAtStartFootnote%%' % node['number'])
+ self.body.append('\\footnote[%s]{\sphinxAtStartFootnote%%\n' % node['number'])
def depart_collected_footnote(self, node):
self.body.append('}')
@@ -1303,12 +1303,15 @@ class LaTeXTranslator(nodes.NodeVisitor):
depart_field_body = depart_definition
def visit_paragraph(self, node):
- # insert blank line, if the paragraph follows a non-paragraph node in a compound
index = node.parent.index(node)
if (index > 0 and isinstance(node.parent, nodes.compound) and
not isinstance(node.parent[index - 1], nodes.paragraph) and
not isinstance(node.parent[index - 1], nodes.compound)):
+ # insert blank line, if the paragraph follows a non-paragraph node in a compound
self.body.append('\\noindent\n')
+ elif index == 0 and isinstance(node.parent, nodes.footnote):
+ # don't insert blank line, if the paragraph is first child of a footnote
+ pass
else:
self.body.append('\n')
diff --git a/tests/path.py b/tests/path.py
index 901c9ce..959b548 100755
--- a/tests/path.py
+++ b/tests/path.py
@@ -206,10 +206,13 @@ class path(text_type):
class _repr_text(text_type):
def __repr__(self):
return self._repr
+
+
class _repr_bin(binary_type):
def __repr__(self):
return self._repr
+
def repr_as(string, repr_):
wrapper = _repr_text if isinstance(string, text_type) else _repr_bin
proxy = wrapper(string)
diff --git a/tests/run.py b/tests/run.py
index b4bbf98..0ca6ad1 100755
--- a/tests/run.py
+++ b/tests/run.py
@@ -16,6 +16,7 @@ import sys
import traceback
from path import path
+import nose
testroot = os.path.dirname(__file__) or '.'
sys.path.insert(0, os.path.abspath(os.path.join(testroot, os.path.pardir)))
@@ -47,5 +48,4 @@ tempdir.makedirs()
print('Running Sphinx test suite (with Python %s)...' % sys.version.split()[0])
sys.stdout.flush()
-import nose
nose.main()
diff --git a/tests/test_api_translator.py b/tests/test_api_translator.py
index 8f0f88a..e8cfcb4 100644
--- a/tests/test_api_translator.py
+++ b/tests/test_api_translator.py
@@ -67,7 +67,7 @@ def test_html_with_set_translator_for_html_and_html_translator_class(
assert translator_class.__name__ == 'ConfHTMLTranslator'
-## this test break test_websupport.test_comments test. why?
+# this test break test_websupport.test_comments test. why?
# @with_app(
# buildername='dirhtml',
# srcdir=(test_roots / 'test-api-set-translator'),
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py
index 1834848..7477464 100644
--- a/tests/test_autodoc.py
+++ b/tests/test_autodoc.py
@@ -11,7 +11,7 @@
"""
# "raises" imported for usage by autodoc
-from util import TestApp, Struct, raises, SkipTest
+from util import TestApp, Struct, raises, SkipTest # NOQA
from nose.tools import with_setup, eq_
from six import StringIO
@@ -22,6 +22,7 @@ from sphinx.ext.autodoc import AutoDirective, add_documenter, \
app = None
+
def setup_module():
global app
app = TestApp()
@@ -38,6 +39,7 @@ def teardown_module():
directive = options = None
+
def setup_test():
global options, directive
global processed_docstrings, processed_signatures, _warnings
@@ -73,19 +75,19 @@ def setup_test():
_warnings = []
+processed_docstrings = []
+processed_signatures = []
+
def warnfunc(msg):
_warnings.append(msg)
-processed_docstrings = []
-
def process_docstring(app, what, name, obj, options, lines):
processed_docstrings.append((what, name))
if name == 'bar':
lines.extend(['42', ''])
-processed_signatures = []
def process_signature(app, what, name, obj, options, args, retann):
processed_signatures.append((what, name))
@@ -164,25 +166,28 @@ def test_format_signature():
# test for functions
def f(a, b, c=1, **d):
pass
+
def g(a='\n'):
pass
assert formatsig('function', 'f', f, None, None) == '(a, b, c=1, **d)'
assert formatsig('function', 'f', f, 'a, b, c, d', None) == '(a, b, c, d)'
- assert formatsig('function', 'f', f, None, 'None') == \
- '(a, b, c=1, **d) -> None'
+ assert formatsig('function', 'f', f, None, 'None') == '(a, b, c=1, **d) -> None'
assert formatsig('function', 'g', g, None, None) == r"(a='\\n')"
# test for classes
class D:
pass
+
class E(object):
pass
# no signature for classes without __init__
for C in (D, E):
assert formatsig('class', 'D', C, None, None) == ''
+
class F:
def __init__(self, a, b=None):
pass
+
class G(F, object):
pass
for C in (F, G):
@@ -191,6 +196,7 @@ def test_format_signature():
# __init__ have signature at first line of docstring
directive.env.config.autoclass_content = 'both'
+
class F2:
'''some docstring for F2.'''
def __init__(self, *args, **kw):
@@ -211,8 +217,10 @@ def test_format_signature():
class H:
def foo1(self, b, *c):
pass
+
def foo2(b, *c):
pass
+
def foo3(self, d='\n'):
pass
assert formatsig('method', 'H.foo', H.foo1, None, None) == '(b, *c)'
@@ -431,6 +439,7 @@ def test_docstring_processing():
lid = app.connect('autodoc-process-docstring',
cut_lines(1, 1, ['function']))
+
def f():
"""
first line
@@ -441,6 +450,7 @@ def test_docstring_processing():
app.disconnect(lid)
lid = app.connect('autodoc-process-docstring', between('---', ['function']))
+
def g():
"""
first line
@@ -452,8 +462,9 @@ def test_docstring_processing():
assert process('function', 'g', g) == ['second line', '']
app.disconnect(lid)
- lid = app.connect('autodoc-process-docstring', between('---', ['function'],
- exclude=True))
+ lid = app.connect('autodoc-process-docstring',
+ between('---', ['function'], exclude=True))
+
def h():
"""
first line
@@ -522,7 +533,7 @@ def test_new_documenter():
def assert_result_contains(item, objtype, name, **kw):
inst = AutoDirective._registry[objtype](directive, name)
inst.generate(**kw)
- #print '\n'.join(directive.result)
+ # print '\n'.join(directive.result)
assert len(_warnings) == 0, _warnings
assert item in directive.result
del directive.result[:]
@@ -535,6 +546,7 @@ def test_new_documenter():
def test_attrgetter_using():
def assert_getter_works(objtype, name, obj, attrs=[], **kw):
getattr_spy = []
+
def special_getattr(obj, name, *defargs):
if name in attrs:
getattr_spy.append((obj, name))
@@ -556,12 +568,10 @@ def test_attrgetter_using():
options.members = ALL
options.inherited_members = False
- assert_getter_works('class', 'test_autodoc.Class', Class,
- ['meth'])
+ assert_getter_works('class', 'test_autodoc.Class', Class, ['meth'])
options.inherited_members = True
- assert_getter_works('class', 'test_autodoc.Class', Class,
- ['meth', 'inheritedmeth'])
+ assert_getter_works('class', 'test_autodoc.Class', Class, ['meth', 'inheritedmeth'])
@with_setup(setup_test)
@@ -578,7 +588,7 @@ def test_generate():
inst = AutoDirective._registry[objtype](directive, name)
inst.generate(**kw)
assert directive.result
- #print '\n'.join(directive.result)
+ # print '\n'.join(directive.result)
assert len(_warnings) == 0, _warnings
del directive.result[:]
@@ -586,13 +596,12 @@ def test_generate():
del processed_docstrings[:]
del processed_signatures[:]
assert_works(objtype, name, **kw)
- assert set(processed_docstrings) | set(processed_signatures) == \
- set(items)
+ assert set(processed_docstrings) | set(processed_signatures) == set(items)
def assert_result_contains(item, objtype, name, **kw):
inst = AutoDirective._registry[objtype](directive, name)
inst.generate(**kw)
- #print '\n'.join(directive.result)
+ # print '\n'.join(directive.result)
assert len(_warnings) == 0, _warnings
assert item in directive.result
del directive.result[:]
@@ -604,17 +613,17 @@ def test_generate():
assert len(_warnings) == 0, _warnings
items = list(reversed(items))
lineiter = iter(directive.result)
- #for line in directive.result:
- # if line.strip():
- # print repr(line)
+ # for line in directive.result:
+ # if line.strip():
+ # print repr(line)
while items:
item = items.pop()
for line in lineiter:
if line == item:
break
else: # ran out of items!
... 952 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/sphinx.git
More information about the Python-modules-commits
mailing list