mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '1.6-release'
Fixed conflicts: tests/test_build_html5.py Also updated tests/test_build_latex.py
This commit is contained in:
commit
e277cb7285
22
CHANGES
22
CHANGES
@ -57,6 +57,9 @@ Release 1.6 beta4 (in development)
|
|||||||
Incompatible changes
|
Incompatible changes
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
* LaTeX package ``threeparttable`` is not used and not loaded by Sphinx
|
||||||
|
anymore (refs #3686, #3532, #3377)
|
||||||
|
|
||||||
Deprecated
|
Deprecated
|
||||||
----------
|
----------
|
||||||
|
|
||||||
@ -70,6 +73,13 @@ Bugs fixed
|
|||||||
----------
|
----------
|
||||||
|
|
||||||
* LaTeX tables do not allow multiple paragraphs in a header cell
|
* LaTeX tables do not allow multiple paragraphs in a header cell
|
||||||
|
* LATEXOPTS is not passed over correctly to pdflatex since 1.6b3
|
||||||
|
* #3532: Figure or literal block captions in cells of short tables cause havoc
|
||||||
|
in PDF output
|
||||||
|
* Fix: in PDF captions of tables are rendered differently whether table is of
|
||||||
|
longtable class or not (refs #3686)
|
||||||
|
* #3725: Todo looks different from note in LaTeX output
|
||||||
|
* #3479: stub-columns have no effect in LaTeX output
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
@ -91,8 +101,7 @@ Features added
|
|||||||
--------------
|
--------------
|
||||||
|
|
||||||
* ``LATEXMKOPTS`` variable for the Makefile in ``$BUILDDIR/latex`` to pass
|
* ``LATEXMKOPTS`` variable for the Makefile in ``$BUILDDIR/latex`` to pass
|
||||||
options to ``latexmk`` when executing ``make latexpdf``. Default is ``-f``.
|
options to ``latexmk`` when executing ``make latexpdf`` (refs #3695, #3720)
|
||||||
(refs #3695)
|
|
||||||
* Add a new event `env-check-consistency` to check consistency to extensions
|
* Add a new event `env-check-consistency` to check consistency to extensions
|
||||||
* Add `Domain.check_consistency()` to check consistency
|
* Add `Domain.check_consistency()` to check consistency
|
||||||
|
|
||||||
@ -141,7 +150,7 @@ Dependencies
|
|||||||
* (updated) latex output is tested with Ubuntu trusty's texlive packages (Feb.
|
* (updated) latex output is tested with Ubuntu trusty's texlive packages (Feb.
|
||||||
2014) and earlier tex installations may not be fully compliant, particularly
|
2014) and earlier tex installations may not be fully compliant, particularly
|
||||||
regarding Unicode engines xelatex and lualatex
|
regarding Unicode engines xelatex and lualatex
|
||||||
* (added) latexmk is requirement for ``make latexpdf`` on Unix-like platforms
|
* (added) latexmk is required for ``make latexpdf`` on Unix-like platforms
|
||||||
(refs: #3082)
|
(refs: #3082)
|
||||||
|
|
||||||
Incompatible changes
|
Incompatible changes
|
||||||
@ -232,8 +241,8 @@ Features added
|
|||||||
* #3476: setuptools: Support multiple builders
|
* #3476: setuptools: Support multiple builders
|
||||||
* latex: merged cells in LaTeX tables allow code-blocks, lists, blockquotes...
|
* latex: merged cells in LaTeX tables allow code-blocks, lists, blockquotes...
|
||||||
as do normal cells (refs: #3435)
|
as do normal cells (refs: #3435)
|
||||||
* HTML buildre uses experimental HTML5 writer if ``html_experimental_html5_writer`` is True
|
* HTML builder uses experimental HTML5 writer if ``html_experimental_html5_writer`` is True
|
||||||
and docutils 0.13 and newer is installed.
|
and docutils 0.13 or later is installed.
|
||||||
* LaTeX macros to customize space before and after tables in PDF output (refs #3504)
|
* LaTeX macros to customize space before and after tables in PDF output (refs #3504)
|
||||||
* #3348: Show decorators in literalinclude and viewcode directives
|
* #3348: Show decorators in literalinclude and viewcode directives
|
||||||
* #3108: Show warning if :start-at: and other literalinclude options does not
|
* #3108: Show warning if :start-at: and other literalinclude options does not
|
||||||
@ -254,6 +263,7 @@ Features added
|
|||||||
Jeroen Demeyer.
|
Jeroen Demeyer.
|
||||||
* Add a new extension; ``sphinx.ext.imgconverter``. It converts images in the
|
* Add a new extension; ``sphinx.ext.imgconverter``. It converts images in the
|
||||||
document to appropriate format for builders
|
document to appropriate format for builders
|
||||||
|
* latex: Use templates to render tables (refs #3389, 2a37b0e)
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
@ -284,7 +294,7 @@ Deprecated
|
|||||||
removed at Sphinx 1.7. Extension authors please use ``sphinxadmonition``
|
removed at Sphinx 1.7. Extension authors please use ``sphinxadmonition``
|
||||||
instead (as Sphinx does since 1.5.)
|
instead (as Sphinx does since 1.5.)
|
||||||
* ``Sphinx.status_iterator()`` and ``Sphinx.old_status_iterator()`` is now
|
* ``Sphinx.status_iterator()`` and ``Sphinx.old_status_iterator()`` is now
|
||||||
deprecated. Please use ``sphinx.util:status_iterator()`` intead.
|
deprecated. Please use ``sphinx.util:status_iterator()`` instead.
|
||||||
* ``Sphinx._directive_helper()`` is deprecated. Please use
|
* ``Sphinx._directive_helper()`` is deprecated. Please use
|
||||||
``sphinx.util.docutils.directive_helper()`` instead.
|
``sphinx.util.docutils.directive_helper()`` instead.
|
||||||
* ``BuildEnvironment.set_warnfunc()`` is now deprecated
|
* ``BuildEnvironment.set_warnfunc()`` is now deprecated
|
||||||
|
@ -182,30 +182,18 @@ The builder's "name" must be given to the **-b** command-line option of
|
|||||||
.. versionchanged:: 1.6
|
.. versionchanged:: 1.6
|
||||||
Use of ``latexmk`` on GNU/Linux or Mac OS X.
|
Use of ``latexmk`` on GNU/Linux or Mac OS X.
|
||||||
|
|
||||||
Since 1.6, ``make latexpdf`` (or ``make -C "<builddir>/latex"`` after a
|
Since 1.6, and on GNU/Linux and Mac OS X, ``make latexpdf`` (or
|
||||||
``sphinx-build`` run) uses ``latexmk`` (on GNU/Linux and Mac OS X).
|
``make -C "<builddir>/latex"`` after a ``sphinx-build`` run) uses
|
||||||
It invokes it with option ``-f`` which attempts to complete targets
|
``latexmk``. One can pass to ``latexmk`` options via the ``LATEXMKOPTS``
|
||||||
even in case of LaTeX processing errors. This can be overridden via
|
Makefile variable. For example:
|
||||||
``LATEXMKOPTS`` variable, for example:
|
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
make latexpdf LATEXMKOPTS=""
|
make latexpdf LATEXMKOPTS="-silent"
|
||||||
|
|
||||||
The ``pdflatex`` calls themselves obey the ``LATEXOPTS`` variable whose
|
reduces console output to a minimum. To pass options directly to the
|
||||||
default is ``--interaction=nonstopmode`` (same as ``-interaction
|
``pdflatex`` executable, use variable ``LATEXOPTS`` (for example
|
||||||
nonstopmode``.) In order to stop the
|
``LATEXOPTS="--interaction=nonstopmode"``).
|
||||||
compilation on first error one can use ``--halt-on-error``.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
make latexpdf LATEXMKOPTS="-silent" LATEXOPTS="--halt-on-error"
|
|
||||||
|
|
||||||
In case the first ``pdflatex`` run aborts with an error, this will stop
|
|
||||||
further ``latexmk`` processing (no ``-f`` option). The console output
|
|
||||||
will be kept to a bare minimum during target processing (``-silent``).
|
|
||||||
|
|
||||||
.. autoattribute:: name
|
.. autoattribute:: name
|
||||||
|
|
||||||
|
@ -1611,17 +1611,16 @@ These options influence LaTeX output. See further :doc:`latex`.
|
|||||||
|
|
||||||
.. confval:: latex_use_latex_multicolumn
|
.. confval:: latex_use_latex_multicolumn
|
||||||
|
|
||||||
If ``False`` (default), the LaTeX writer uses for merged cells in grid
|
The default is ``False``: it means that Sphinx's own macros are used for
|
||||||
tables Sphinx's own macros. They have the advantage to allow the same
|
merged cells from grid tables. They allow general contents (literal blocks,
|
||||||
contents as in non-merged cells (inclusive of literal blocks, lists,
|
lists, blockquotes, ...) but may have problems if the
|
||||||
blockquotes, ...). But they assume that the columns are separated by the
|
:rst:dir:`tabularcolumns` directive was used to inject LaTeX mark-up of the
|
||||||
standard vertical rule. Further, in case the :rst:dir:`tabularcolumns`
|
type ``>{..}``, ``<{..}``, ``@{..}`` as column specification.
|
||||||
directive was employed to inject more macros (using LaTeX's mark-up of the
|
|
||||||
type ``>{..}``, ``<{..}``, ``@{..}``) the multicolumn cannot ignore these
|
Setting to ``True`` means to use LaTeX's standard ``\multicolumn``; this is
|
||||||
extra macros, contrarily to LaTeX's own ``\multicolumn``; but Sphinx's
|
incompatible with literal blocks in the horizontally merged cell, and also
|
||||||
version does arrange for ignoring ``\columncolor`` like the standard
|
with multiple paragraphs in such cell if the table is rendered using
|
||||||
``\multicolumn`` does. Setting to ``True`` means to use LaTeX's standard
|
``tabulary``.
|
||||||
``\multicolumn`` macro.
|
|
||||||
|
|
||||||
.. versionadded:: 1.6
|
.. versionadded:: 1.6
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ from sphinx.locale import _
|
|||||||
from sphinx.environment import NoUri
|
from sphinx.environment import NoUri
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
from sphinx.util.nodes import set_source_info
|
from sphinx.util.nodes import set_source_info
|
||||||
|
from sphinx.util.texescape import tex_escape_map
|
||||||
from docutils.parsers.rst import Directive
|
from docutils.parsers.rst import Directive
|
||||||
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
|
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
|
||||||
|
|
||||||
@ -209,6 +210,17 @@ def depart_todo_node(self, node):
|
|||||||
self.depart_admonition(node)
|
self.depart_admonition(node)
|
||||||
|
|
||||||
|
|
||||||
|
def latex_visit_todo_node(self, node):
|
||||||
|
# type: (nodes.NodeVisitor, todo_node) -> None
|
||||||
|
title = node.pop(0).astext().translate(tex_escape_map)
|
||||||
|
self.body.append(u'\n\\begin{sphinxadmonition}{note}{%s:}' % title)
|
||||||
|
|
||||||
|
|
||||||
|
def latex_depart_todo_node(self, node):
|
||||||
|
# type: (nodes.NodeVisitor, todo_node) -> None
|
||||||
|
self.body.append('\\end{sphinxadmonition}\n')
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
# type: (Sphinx) -> Dict[unicode, Any]
|
# type: (Sphinx) -> Dict[unicode, Any]
|
||||||
app.add_event('todo-defined')
|
app.add_event('todo-defined')
|
||||||
@ -219,7 +231,7 @@ def setup(app):
|
|||||||
app.add_node(todolist)
|
app.add_node(todolist)
|
||||||
app.add_node(todo_node,
|
app.add_node(todo_node,
|
||||||
html=(visit_todo_node, depart_todo_node),
|
html=(visit_todo_node, depart_todo_node),
|
||||||
latex=(visit_todo_node, depart_todo_node),
|
latex=(latex_visit_todo_node, latex_depart_todo_node),
|
||||||
text=(visit_todo_node, depart_todo_node),
|
text=(visit_todo_node, depart_todo_node),
|
||||||
man=(visit_todo_node, depart_todo_node),
|
man=(visit_todo_node, depart_todo_node),
|
||||||
texinfo=(visit_todo_node, depart_todo_node))
|
texinfo=(visit_todo_node, depart_todo_node))
|
||||||
|
@ -11,8 +11,9 @@
|
|||||||
\centering
|
\centering
|
||||||
<%- endif %>
|
<%- endif %>
|
||||||
<% if table.caption -%>
|
<% if table.caption -%>
|
||||||
\begin{threeparttable}
|
\sphinxcapstartof{table}
|
||||||
\capstart\caption{<%= ''.join(table.caption) %>}<%= labels %>
|
\sphinxcaption{<%= ''.join(table.caption) %>}<%= labels %>
|
||||||
|
\sphinxaftercaption
|
||||||
<% endif -%>
|
<% endif -%>
|
||||||
\begin{tabular}[t]<%= table.get_colspec() -%>
|
\begin{tabular}[t]<%= table.get_colspec() -%>
|
||||||
\hline
|
\hline
|
||||||
@ -22,8 +23,5 @@
|
|||||||
<%- endif -%>
|
<%- endif -%>
|
||||||
<%=- ''.join(table.body) %>
|
<%=- ''.join(table.body) %>
|
||||||
\end{tabular}
|
\end{tabular}
|
||||||
<%- if table.caption %>
|
|
||||||
\end{threeparttable}
|
|
||||||
<%- endif %>
|
|
||||||
\par
|
\par
|
||||||
\sphinxattableend\end{savenotes}
|
\sphinxattableend\end{savenotes}
|
||||||
|
@ -11,8 +11,9 @@
|
|||||||
\centering
|
\centering
|
||||||
<%- endif %>
|
<%- endif %>
|
||||||
<% if table.caption -%>
|
<% if table.caption -%>
|
||||||
\begin{threeparttable}
|
\sphinxcapstartof{table}
|
||||||
\capstart\caption{<%= ''.join(table.caption) %>}<%= labels %>
|
\sphinxcaption{<%= ''.join(table.caption) %>}<%= labels %>
|
||||||
|
\sphinxaftercaption
|
||||||
<% endif -%>
|
<% endif -%>
|
||||||
\begin{tabulary}{\linewidth}[t]<%= table.get_colspec() -%>
|
\begin{tabulary}{\linewidth}[t]<%= table.get_colspec() -%>
|
||||||
\hline
|
\hline
|
||||||
@ -22,8 +23,5 @@
|
|||||||
<%- endif -%>
|
<%- endif -%>
|
||||||
<%=- ''.join(table.body) %>
|
<%=- ''.join(table.body) %>
|
||||||
\end{tabulary}
|
\end{tabulary}
|
||||||
<%- if table.caption %>
|
|
||||||
\end{threeparttable}
|
|
||||||
<%- endif %>
|
|
||||||
\par
|
\par
|
||||||
\sphinxattableend\end{savenotes}
|
\sphinxattableend\end{savenotes}
|
||||||
|
@ -14,10 +14,10 @@ ALLIMGS = $(wildcard *.png *.gif *.jpg *.jpeg)
|
|||||||
|
|
||||||
# Prefix for archive names
|
# Prefix for archive names
|
||||||
ARCHIVEPRREFIX =
|
ARCHIVEPRREFIX =
|
||||||
# Additional LaTeX options (used via latexmkrc/latexmkjarc file)
|
# Additional LaTeX options (passed via variables in latexmkrc/latexmkjarc file)
|
||||||
LATEXOPTS = --interaction=nonstopmode
|
export LATEXOPTS =
|
||||||
# Additional latexmk options
|
# Additional latexmk options
|
||||||
LATEXMKOPTS = -f
|
LATEXMKOPTS =
|
||||||
# format: pdf or dvi
|
# format: pdf or dvi
|
||||||
FMT = pdf
|
FMT = pdf
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
$latex = 'platex $LATEXOPTS -kanji=utf8 %O %S';
|
$latex = 'platex ' . $ENV{'LATEXOPTS'} . ' -kanji=utf8 %O %S';
|
||||||
$dvipdf = 'dvipdfmx %O -o %D %S';
|
$dvipdf = 'dvipdfmx %O -o %D %S';
|
||||||
$makeindex = 'rm -f %D; mendex -U -f -d %B.dic -s python.ist %S || echo "mendex exited with error code $? (ignoring)" && : >> %D';
|
$makeindex = 'rm -f %D; mendex -U -f -d %B.dic -s python.ist %S || echo "mendex exited with error code $? (ignoring)" && : >> %D';
|
||||||
add_cus_dep( "glo", "gls", 0, "makeglo" );
|
add_cus_dep( "glo", "gls", 0, "makeglo" );
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
$latex = 'latex $LATEXOPTS %O %S';
|
$latex = 'latex ' . $ENV{'LATEXOPTS'} . ' %O %S';
|
||||||
$pdflatex = 'pdflatex $LATEXOPTS %O %S';
|
$pdflatex = 'pdflatex ' . $ENV{'LATEXOPTS'} . ' %O %S';
|
||||||
$lualatex = 'lualatex $LATEXOPTS %O %S';
|
$lualatex = 'lualatex ' . $ENV{'LATEXOPTS'} . ' %O %S';
|
||||||
$xelatex = 'xelatex --no-pdf $LATEXOPTS %O %S';
|
$xelatex = 'xelatex --no-pdf ' . $ENV{'LATEXOPTS'} . ' %O %S';
|
||||||
$makeindex = 'makeindex -s python.ist %O -o %D %S';
|
$makeindex = 'makeindex -s python.ist %O -o %D %S';
|
||||||
add_cus_dep( "glo", "gls", 0, "makeglo" );
|
add_cus_dep( "glo", "gls", 0, "makeglo" );
|
||||||
sub makeglo {
|
sub makeglo {
|
||||||
|
@ -77,40 +77,63 @@
|
|||||||
#1\dimexpr\linewidth-\arrayrulewidth\relax-\tw@\tabcolsep-\arrayrulewidth\relax}}
|
#1\dimexpr\linewidth-\arrayrulewidth\relax-\tw@\tabcolsep-\arrayrulewidth\relax}}
|
||||||
% using here T (for Tabulary) feels less of a problem than the X could be
|
% using here T (for Tabulary) feels less of a problem than the X could be
|
||||||
\newcolumntype{T}{J}%
|
\newcolumntype{T}{J}%
|
||||||
|
% For tables allowing pagebreaks
|
||||||
\RequirePackage{longtable}
|
\RequirePackage{longtable}
|
||||||
% For table captions.
|
% User interface to set-up whitespace before and after tables:
|
||||||
\RequirePackage{threeparttable}
|
|
||||||
% fixing the LaTeX mess of vertical spaces with threeparttable and longtable
|
|
||||||
% The user interface:
|
|
||||||
\newcommand*\sphinxtablepre {0pt}%
|
\newcommand*\sphinxtablepre {0pt}%
|
||||||
\newcommand*\sphinxtablepost{\medskipamount}%
|
\newcommand*\sphinxtablepost{\medskipamount}%
|
||||||
|
\newcommand*\sphinxbelowcaptionspace{.5\sphinxbaselineskip}%
|
||||||
% as one can not use \baselineskip from inside longtable (it is zero there)
|
% as one can not use \baselineskip from inside longtable (it is zero there)
|
||||||
% we need \sphinxbaselineskip, which defaults to \baselineskip
|
% we need \sphinxbaselineskip, which defaults to \baselineskip
|
||||||
\newcommand*\sphinxbelowcaptionspace{.5\sphinxbaselineskip}%
|
|
||||||
\def\sphinxbaselineskip{\baselineskip}%
|
\def\sphinxbaselineskip{\baselineskip}%
|
||||||
% Helper macros, not a priori for user customization
|
% These commands are inserted by the table templates
|
||||||
\def\sphinxatlongtablestart
|
\def\sphinxatlongtablestart
|
||||||
{\par
|
{\par
|
||||||
\vskip\parskip
|
\vskip\parskip
|
||||||
\vskip\dimexpr\sphinxtablepre\relax % adjust vertical position
|
\vskip\dimexpr\sphinxtablepre\relax % adjust vertical position
|
||||||
\vbox{}% get correct baseline from above
|
\vbox{}% get correct baseline from above
|
||||||
\LTpre\z@skip\LTpost\z@skip % set to zero longtable's own skips
|
\LTpre\z@skip\LTpost\z@skip % set to zero longtable's own skips
|
||||||
\edef\sphinxbaselineskip{\dimexpr\the\dimexpr\baselineskip\relax\relax}}%
|
\edef\sphinxbaselineskip{\dimexpr\the\dimexpr\baselineskip\relax\relax}%
|
||||||
|
}%
|
||||||
\def\sphinxatlongtableend{\prevdepth\z@\vskip\sphinxtablepost\relax}%
|
\def\sphinxatlongtableend{\prevdepth\z@\vskip\sphinxtablepost\relax}%
|
||||||
% the longtable template inserts a \strut at caption's end
|
|
||||||
\def\sphinxlongtablecapskipadjust
|
\def\sphinxlongtablecapskipadjust
|
||||||
{\dimexpr-\dp\strutbox-\sphinxbaselineskip
|
{\dimexpr-\dp\strutbox-\sphinxbaselineskip+\sphinxbelowcaptionspace\relax}%
|
||||||
+\sphinxbelowcaptionspace\relax}%
|
% Now for tables not using longtable
|
||||||
% tabular(y) with or without threeparttable
|
|
||||||
\def\sphinxattablestart
|
\def\sphinxattablestart
|
||||||
{\par
|
{\par
|
||||||
\vskip\dimexpr\sphinxtablepre\relax
|
\vskip\dimexpr\sphinxtablepre\relax
|
||||||
\belowcaptionskip\sphinx@TPTbelowcaptionskip}%
|
}%
|
||||||
\let\sphinxattableend\sphinxatlongtableend
|
\let\sphinxattableend\sphinxatlongtableend
|
||||||
% the tabular(y) templates use [t] vertical placement parameter
|
% longtable's wraps captions to a maximal width of \LTcapwidth
|
||||||
\def\sphinx@TPTbelowcaptionskip
|
% so we do the same for all tables
|
||||||
{\dimexpr-1.2\baselineskip % .2\baselineskip hardcoded in threeparttable
|
\newcommand*\sphinxcapstartof[1]{%
|
||||||
+\sphinxbelowcaptionspace\relax }%
|
\vskip\parskip
|
||||||
|
\vbox{}% force baselineskip for good positioning by capstart of hyperanchor
|
||||||
|
\def\@captype{#1}%
|
||||||
|
\capstart
|
||||||
|
% move back vertically to compensate space inserted by next paragraph
|
||||||
|
\vskip-\baselineskip\vskip-\parskip
|
||||||
|
}%
|
||||||
|
\newcommand\sphinxcaption[2][\LTcapwidth]{%
|
||||||
|
\noindent\hb@xt@\linewidth{\hss
|
||||||
|
\vtop{\@tempdima\dimexpr#1\relax
|
||||||
|
% don't exceed linewidth for the caption width
|
||||||
|
\ifdim\@tempdima>\linewidth\hsize\linewidth\else\hsize\@tempdima\fi
|
||||||
|
% longtable ignores \abovecaptionskip/\belowcaptionskip, so do the same here
|
||||||
|
\abovecaptionskip\z@skip
|
||||||
|
\belowcaptionskip\z@skip
|
||||||
|
\caption[{#2}]%
|
||||||
|
{\strut\ignorespaces#2\ifhmode\unskip\@finalstrut\strutbox\fi}%
|
||||||
|
}\hss}%
|
||||||
|
\par\prevdepth\dp\strutbox
|
||||||
|
}%
|
||||||
|
\newcommand\sphinxaftercaption
|
||||||
|
{% this default definition serves with a caption *above* a table, to make sure
|
||||||
|
% its last baseline is \sphinxbelowcaptionspace above table top
|
||||||
|
\nobreak
|
||||||
|
\vskip\dimexpr\sphinxbelowcaptionspace\relax
|
||||||
|
\vskip-\baselineskip\vskip-\parskip
|
||||||
|
}%
|
||||||
% varwidth is crucial for our handling of general contents in merged cells
|
% varwidth is crucial for our handling of general contents in merged cells
|
||||||
\RequirePackage{varwidth}
|
\RequirePackage{varwidth}
|
||||||
% but addition of a compatibility patch with hyperref is needed
|
% but addition of a compatibility patch with hyperref is needed
|
||||||
@ -597,6 +620,7 @@
|
|||||||
%
|
%
|
||||||
\newenvironment{sphinxfigure-in-table}[1][\linewidth]{%
|
\newenvironment{sphinxfigure-in-table}[1][\linewidth]{%
|
||||||
\def\@captype{figure}%
|
\def\@captype{figure}%
|
||||||
|
\sphinxsetvskipsforfigintablecaption
|
||||||
\begin{minipage}{#1}%
|
\begin{minipage}{#1}%
|
||||||
}{\end{minipage}}
|
}{\end{minipage}}
|
||||||
% store original \caption macro for use with figures in longtable and tabulary
|
% store original \caption macro for use with figures in longtable and tabulary
|
||||||
@ -605,7 +629,9 @@
|
|||||||
{\ifx\equation$%$% this is trick to identify tabulary first pass
|
{\ifx\equation$%$% this is trick to identify tabulary first pass
|
||||||
\firstchoice@false\else\firstchoice@true\fi
|
\firstchoice@false\else\firstchoice@true\fi
|
||||||
\spx@originalcaption }
|
\spx@originalcaption }
|
||||||
|
\newcommand*\sphinxsetvskipsforfigintablecaption
|
||||||
|
{\abovecaptionskip\smallskipamount
|
||||||
|
\belowcaptionskip\smallskipamount}
|
||||||
|
|
||||||
%% FOOTNOTES
|
%% FOOTNOTES
|
||||||
%
|
%
|
||||||
|
@ -332,6 +332,7 @@ class Table(object):
|
|||||||
self.caption = None # type: List[unicode]
|
self.caption = None # type: List[unicode]
|
||||||
self.caption_footnotetexts = [] # type: List[unicode]
|
self.caption_footnotetexts = [] # type: List[unicode]
|
||||||
self.header_footnotetexts = [] # type: List[unicode]
|
self.header_footnotetexts = [] # type: List[unicode]
|
||||||
|
self.stubs = [] # type: List[int]
|
||||||
|
|
||||||
# current position
|
# current position
|
||||||
self.col = 0
|
self.col = 0
|
||||||
@ -1332,6 +1333,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
self.table.colcount += 1
|
self.table.colcount += 1
|
||||||
if 'colwidth' in node:
|
if 'colwidth' in node:
|
||||||
self.table.colwidths.append(node['colwidth'])
|
self.table.colwidths.append(node['colwidth'])
|
||||||
|
if 'stub' in node:
|
||||||
|
self.table.stubs.append(self.table.colcount - 1)
|
||||||
|
|
||||||
def depart_colspec(self, node):
|
def depart_colspec(self, node):
|
||||||
# type: (nodes.Node) -> None
|
# type: (nodes.Node) -> None
|
||||||
@ -1442,7 +1445,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
self.needs_linetrimming = 1
|
self.needs_linetrimming = 1
|
||||||
if len(node.traverse(nodes.paragraph)) >= 2:
|
if len(node.traverse(nodes.paragraph)) >= 2:
|
||||||
self.table.has_oldproblematic = True
|
self.table.has_oldproblematic = True
|
||||||
if isinstance(node.parent.parent, nodes.thead):
|
if isinstance(node.parent.parent, nodes.thead) or (cell.col in self.table.stubs):
|
||||||
if len(node) == 1 and isinstance(node[0], nodes.paragraph) and node.astext() == '':
|
if len(node) == 1 and isinstance(node[0], nodes.paragraph) and node.astext() == '':
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
@ -130,3 +130,22 @@ longtable having problematic cell
|
|||||||
- cell2-2
|
- cell2-2
|
||||||
* - cell3-1
|
* - cell3-1
|
||||||
- cell3-2
|
- cell3-2
|
||||||
|
|
||||||
|
longtable having both stub columns and problematic cell
|
||||||
|
-------------------------------------------------------
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:class: longtable
|
||||||
|
:header-rows: 1
|
||||||
|
:stub-columns: 2
|
||||||
|
|
||||||
|
* - header1
|
||||||
|
- header2
|
||||||
|
- header3
|
||||||
|
* - + instub1-1a
|
||||||
|
+ instub1-1b
|
||||||
|
- instub1-2
|
||||||
|
- notinstub1-3
|
||||||
|
* - cell2-1
|
||||||
|
- cell2-2
|
||||||
|
- cell2-3
|
||||||
|
@ -133,3 +133,21 @@ table having problematic cell
|
|||||||
- cell2-2
|
- cell2-2
|
||||||
* - cell3-1
|
* - cell3-1
|
||||||
- cell3-2
|
- cell3-2
|
||||||
|
|
||||||
|
table having both stub columns and problematic cell
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:header-rows: 1
|
||||||
|
:stub-columns: 2
|
||||||
|
|
||||||
|
* - header1
|
||||||
|
- header2
|
||||||
|
- header3
|
||||||
|
* - + instub1-1a
|
||||||
|
+ instub1-1b
|
||||||
|
- instub1-2
|
||||||
|
- notinstub1-3
|
||||||
|
* - cell2-1
|
||||||
|
- cell2-2
|
||||||
|
- cell2-3
|
||||||
|
@ -129,6 +129,7 @@ def test_pep_0420_disabled_top_level_verify(make_app, apidoc):
|
|||||||
print(app._status.getvalue())
|
print(app._status.getvalue())
|
||||||
print(app._warning.getvalue())
|
print(app._warning.getvalue())
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.apidoc(
|
@pytest.mark.apidoc(
|
||||||
coderoot=(rootdir / 'roots' / 'test-apidoc-trailing-underscore'))
|
coderoot=(rootdir / 'roots' / 'test-apidoc-trailing-underscore'))
|
||||||
def test_trailing_underscore(make_app, apidoc):
|
def test_trailing_underscore(make_app, apidoc):
|
||||||
@ -147,6 +148,7 @@ def test_trailing_underscore(make_app, apidoc):
|
|||||||
assert "package_ package\n" in rst
|
assert "package_ package\n" in rst
|
||||||
assert "package_.module_ module\n" in rst
|
assert "package_.module_ module\n" in rst
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.apidoc(
|
@pytest.mark.apidoc(
|
||||||
coderoot=(rootdir / 'root'),
|
coderoot=(rootdir / 'root'),
|
||||||
options=[
|
options=[
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
:copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
|
:copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
|
||||||
:license: BSD, see LICENSE for details.
|
:license: BSD, see LICENSE for details.
|
||||||
"""
|
"""
|
||||||
import codecs
|
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
|
||||||
from sphinx.application import ExtensionError
|
from sphinx.application import ExtensionError
|
||||||
|
@ -448,11 +448,13 @@ def test_html_output(app, cached_etree_parse, fname, expect):
|
|||||||
app.build()
|
app.build()
|
||||||
check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect)
|
check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('html', testroot='build-html-translator')
|
@pytest.mark.sphinx('html', testroot='build-html-translator')
|
||||||
def test_html_translator(app):
|
def test_html_translator(app):
|
||||||
app.build()
|
app.build()
|
||||||
assert app.builder.docwriter.visitor.depart_with_node == 10
|
assert app.builder.docwriter.visitor.depart_with_node == 10
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("fname,expect", flat_dict({
|
@pytest.mark.parametrize("fname,expect", flat_dict({
|
||||||
'index.html': [
|
'index.html': [
|
||||||
(".//li[@class='toctree-l3']/a", '1.1.1. Foo A1', True),
|
(".//li[@class='toctree-l3']/a", '1.1.1. Foo A1', True),
|
||||||
|
@ -31,7 +31,7 @@ from test_build_html import ENV_WARNINGS
|
|||||||
LATEX_ENGINES = ['pdflatex', 'lualatex', 'xelatex']
|
LATEX_ENGINES = ['pdflatex', 'lualatex', 'xelatex']
|
||||||
DOCCLASSES = ['howto', 'manual']
|
DOCCLASSES = ['howto', 'manual']
|
||||||
STYLEFILES = ['article.cls', 'fancyhdr.sty', 'titlesec.sty', 'amsmath.sty',
|
STYLEFILES = ['article.cls', 'fancyhdr.sty', 'titlesec.sty', 'amsmath.sty',
|
||||||
'framed.sty', 'color.sty', 'fancyvrb.sty', 'threeparttable.sty',
|
'framed.sty', 'color.sty', 'fancyvrb.sty',
|
||||||
'fncychap.sty', 'geometry.sty', 'kvoptions.sty', 'hyperref.sty']
|
'fncychap.sty', 'geometry.sty', 'kvoptions.sty', 'hyperref.sty']
|
||||||
|
|
||||||
LATEX_WARNINGS = ENV_WARNINGS + """\
|
LATEX_WARNINGS = ENV_WARNINGS + """\
|
||||||
@ -492,7 +492,7 @@ def test_footnote(app, status, warning):
|
|||||||
assert ('\\bibitem[bar]{\\detokenize{bar}}'
|
assert ('\\bibitem[bar]{\\detokenize{bar}}'
|
||||||
'{\\phantomsection\\label{\\detokenize{footnote:bar}} '
|
'{\\phantomsection\\label{\\detokenize{footnote:bar}} '
|
||||||
'\ncite\n}') in result
|
'\ncite\n}') in result
|
||||||
assert '\\caption{Table caption \\sphinxfootnotemark[4]' in result
|
assert '\\sphinxcaption{Table caption \\sphinxfootnotemark[4]' in result
|
||||||
assert ('\\hline%\n\\begin{footnotetext}[4]\\sphinxAtStartFootnote\n'
|
assert ('\\hline%\n\\begin{footnotetext}[4]\\sphinxAtStartFootnote\n'
|
||||||
'footnote in table caption\n%\n\\end{footnotetext}\\ignorespaces %\n'
|
'footnote in table caption\n%\n\\end{footnotetext}\\ignorespaces %\n'
|
||||||
'\\begin{footnotetext}[5]\\sphinxAtStartFootnote\n'
|
'\\begin{footnotetext}[5]\\sphinxAtStartFootnote\n'
|
||||||
@ -501,7 +501,7 @@ def test_footnote(app, status, warning):
|
|||||||
assert ('Information about VIDIOC\\_CROPCAP %\n'
|
assert ('Information about VIDIOC\\_CROPCAP %\n'
|
||||||
'\\begin{footnote}[6]\\sphinxAtStartFootnote\n'
|
'\\begin{footnote}[6]\\sphinxAtStartFootnote\n'
|
||||||
'footnote in table not in header\n%\n\\end{footnote}\n\\\\\n\\hline\n'
|
'footnote in table not in header\n%\n\\end{footnote}\n\\\\\n\\hline\n'
|
||||||
'\\end{tabulary}\n\\end{threeparttable}\n'
|
'\\end{tabulary}\n'
|
||||||
'\\par\n\\sphinxattableend\\end{savenotes}\n') in result
|
'\\par\n\\sphinxattableend\\end{savenotes}\n') in result
|
||||||
|
|
||||||
|
|
||||||
@ -517,7 +517,8 @@ def test_reference_in_caption_and_codeblock_in_footnote(app, status, warning):
|
|||||||
'{\\hyperref[\\detokenize{index:authoryear}]'
|
'{\\hyperref[\\detokenize{index:authoryear}]'
|
||||||
'{\\sphinxcrossref{{[}AuthorYear{]}}}}.}' in result)
|
'{\\sphinxcrossref{{[}AuthorYear{]}}}}.}' in result)
|
||||||
assert '\\chapter{The section with a reference to {[}AuthorYear{]}}' in result
|
assert '\\chapter{The section with a reference to {[}AuthorYear{]}}' in result
|
||||||
assert '\\caption{The table title with a reference to {[}AuthorYear{]}}' in result
|
assert ('\\sphinxcaption{The table title with a reference'
|
||||||
|
' to {[}AuthorYear{]}}' in result)
|
||||||
assert '\\paragraph{The rubric title with a reference to {[}AuthorYear{]}}' in result
|
assert '\\paragraph{The rubric title with a reference to {[}AuthorYear{]}}' in result
|
||||||
assert ('\\chapter{The section with a reference to \\sphinxfootnotemark[4]}\n'
|
assert ('\\chapter{The section with a reference to \\sphinxfootnotemark[4]}\n'
|
||||||
'\\label{\\detokenize{index:the-section-with-a-reference-to}}'
|
'\\label{\\detokenize{index:the-section-with-a-reference-to}}'
|
||||||
@ -527,8 +528,8 @@ def test_reference_in_caption_and_codeblock_in_footnote(app, status, warning):
|
|||||||
'\\sphinxfootnotemark[6].}\\label{\\detokenize{index:id27}}\\end{figure}\n'
|
'\\sphinxfootnotemark[6].}\\label{\\detokenize{index:id27}}\\end{figure}\n'
|
||||||
'%\n\\begin{footnotetext}[6]\\sphinxAtStartFootnote\n'
|
'%\n\\begin{footnotetext}[6]\\sphinxAtStartFootnote\n'
|
||||||
'Footnote in caption\n%\n\\end{footnotetext}')in result
|
'Footnote in caption\n%\n\\end{footnotetext}')in result
|
||||||
assert ('\\caption{footnote \\sphinxfootnotemark[7] '
|
assert ('\\sphinxcaption{footnote \\sphinxfootnotemark[7] in '
|
||||||
'in caption of normal table}\\label{\\detokenize{index:id28}}') in result
|
'caption of normal table}\\label{\\detokenize{index:id28}}') in result
|
||||||
assert ('\\caption{footnote \\sphinxfootnotemark[8] '
|
assert ('\\caption{footnote \\sphinxfootnotemark[8] '
|
||||||
'in caption \\sphinxfootnotemark[9] of longtable\\strut}') in result
|
'in caption \\sphinxfootnotemark[9] of longtable\\strut}') in result
|
||||||
assert ('\\endlastfoot\n%\n\\begin{footnotetext}[8]\\sphinxAtStartFootnote\n'
|
assert ('\\endlastfoot\n%\n\\begin{footnotetext}[8]\\sphinxAtStartFootnote\n'
|
||||||
@ -894,10 +895,12 @@ def test_latex_table_tabulars(app, status, warning):
|
|||||||
# table having caption
|
# table having caption
|
||||||
table = tables['table having caption']
|
table = tables['table having caption']
|
||||||
assert ('\\begin{savenotes}\\sphinxattablestart\n\\centering\n'
|
assert ('\\begin{savenotes}\\sphinxattablestart\n\\centering\n'
|
||||||
'\\begin{threeparttable}\n\\capstart\\caption{caption for table}'
|
'\\sphinxcapstartof{table}\n'
|
||||||
'\\label{\\detokenize{tabular:id1}}' in table)
|
'\\sphinxcaption{caption for table}'
|
||||||
|
'\\label{\\detokenize{tabular:id1}}\n'
|
||||||
|
'\\sphinxaftercaption' in table)
|
||||||
assert ('\\begin{tabulary}{\\linewidth}[t]{|T|T|}' in table)
|
assert ('\\begin{tabulary}{\\linewidth}[t]{|T|T|}' in table)
|
||||||
assert ('\\hline\n\\end{tabulary}\n\\end{threeparttable}'
|
assert ('\\hline\n\\end{tabulary}'
|
||||||
'\n\\par\n\\sphinxattableend\\end{savenotes}' in table)
|
'\n\\par\n\\sphinxattableend\\end{savenotes}' in table)
|
||||||
|
|
||||||
# table having verbatim
|
# table having verbatim
|
||||||
@ -912,6 +915,13 @@ def test_latex_table_tabulars(app, status, warning):
|
|||||||
table = tables['table having both :widths: and problematic cell']
|
table = tables['table having both :widths: and problematic cell']
|
||||||
assert ('\\begin{tabular}[t]{|\\X{30}{100}|\\X{70}{100}|}' in table)
|
assert ('\\begin{tabular}[t]{|\\X{30}{100}|\\X{70}{100}|}' in table)
|
||||||
|
|
||||||
|
# table having both stub columns and problematic cell
|
||||||
|
table = tables['table having both stub columns and problematic cell']
|
||||||
|
assert ('&\\sphinxstyletheadfamily \n'
|
||||||
|
'instub1-2\n&\nnotinstub1-3\n\\\\\n'
|
||||||
|
'\\hline\\sphinxstyletheadfamily \n'
|
||||||
|
'cell2-1\n&' in table)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
|
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
|
||||||
reason='docutils-0.13 or above is required')
|
reason='docutils-0.13 or above is required')
|
||||||
@ -976,6 +986,13 @@ def test_latex_table_longtable(app, status, warning):
|
|||||||
table = tables['longtable having both :widths: and problematic cell']
|
table = tables['longtable having both :widths: and problematic cell']
|
||||||
assert ('\\begin{longtable}{|\\X{30}{100}|\\X{70}{100}|}' in table)
|
assert ('\\begin{longtable}{|\\X{30}{100}|\\X{70}{100}|}' in table)
|
||||||
|
|
||||||
|
# longtable having both stub columns and problematic cell
|
||||||
|
table = tables['longtable having both stub columns and problematic cell']
|
||||||
|
assert ('&\\sphinxstyletheadfamily \n'
|
||||||
|
'instub1-2\n&\nnotinstub1-3\n\\\\\n'
|
||||||
|
'\\hline\\sphinxstyletheadfamily \n'
|
||||||
|
'cell2-1\n&' in table)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
|
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
|
||||||
reason='docutils-0.13 or above is required')
|
reason='docutils-0.13 or above is required')
|
||||||
|
@ -517,4 +517,3 @@ def test_literalinclude_pydecorators(app, status, warning):
|
|||||||
' pass\n'
|
' pass\n'
|
||||||
)
|
)
|
||||||
assert actual == expect
|
assert actual == expect
|
||||||
|
|
||||||
|
@ -537,6 +537,7 @@ def test_templates():
|
|||||||
{2:'IDpE8Numerics'})
|
{2:'IDpE8Numerics'})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_template_args():
|
def test_template_args():
|
||||||
# from breathe#218
|
# from breathe#218
|
||||||
check('function',
|
check('function',
|
||||||
@ -550,6 +551,7 @@ def test_template_args():
|
|||||||
{2:"I0E21enable_if_not_array_t"})
|
{2:"I0E21enable_if_not_array_t"})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_attributes():
|
def test_attributes():
|
||||||
# style: C++
|
# style: C++
|
||||||
check('member', '[[]] int f', {1:'f__i', 2:'1f'})
|
check('member', '[[]] int f', {1:'f__i', 2:'1f'})
|
||||||
|
@ -122,21 +122,21 @@ def test_domain_js_find_obj(app, status, warning):
|
|||||||
assert (find_obj(None, None, u'NONEXISTANT', u'class') ==
|
assert (find_obj(None, None, u'NONEXISTANT', u'class') ==
|
||||||
(None, None))
|
(None, None))
|
||||||
assert (find_obj(None, None, u'NestedParentA', u'class') ==
|
assert (find_obj(None, None, u'NestedParentA', u'class') ==
|
||||||
( u'NestedParentA', (u'roles', u'class')))
|
(u'NestedParentA', (u'roles', u'class')))
|
||||||
assert (find_obj(None, None, u'NestedParentA.NestedChildA', u'class') ==
|
assert (find_obj(None, None, u'NestedParentA.NestedChildA', u'class') ==
|
||||||
( u'NestedParentA.NestedChildA', (u'roles', u'class')))
|
(u'NestedParentA.NestedChildA', (u'roles', u'class')))
|
||||||
assert (find_obj(None, 'NestedParentA', u'NestedChildA', u'class') ==
|
assert (find_obj(None, 'NestedParentA', u'NestedChildA', u'class') ==
|
||||||
( u'NestedParentA.NestedChildA', (u'roles', u'class')))
|
(u'NestedParentA.NestedChildA', (u'roles', u'class')))
|
||||||
assert (find_obj(None, None, u'NestedParentA.NestedChildA.subchild_1', u'func') ==
|
assert (find_obj(None, None, u'NestedParentA.NestedChildA.subchild_1', u'func') ==
|
||||||
( u'NestedParentA.NestedChildA.subchild_1', (u'roles', u'function')))
|
(u'NestedParentA.NestedChildA.subchild_1', (u'roles', u'function')))
|
||||||
assert (find_obj(None, u'NestedParentA', u'NestedChildA.subchild_1', u'func') ==
|
assert (find_obj(None, u'NestedParentA', u'NestedChildA.subchild_1', u'func') ==
|
||||||
( u'NestedParentA.NestedChildA.subchild_1', (u'roles', u'function')))
|
(u'NestedParentA.NestedChildA.subchild_1', (u'roles', u'function')))
|
||||||
assert (find_obj(None, u'NestedParentA.NestedChildA', u'subchild_1', u'func') ==
|
assert (find_obj(None, u'NestedParentA.NestedChildA', u'subchild_1', u'func') ==
|
||||||
( u'NestedParentA.NestedChildA.subchild_1', (u'roles', u'function')))
|
(u'NestedParentA.NestedChildA.subchild_1', (u'roles', u'function')))
|
||||||
assert (find_obj(u'module_a.submodule', u'ModTopLevel', u'mod_child_2', u'meth') ==
|
assert (find_obj(u'module_a.submodule', u'ModTopLevel', u'mod_child_2', u'meth') ==
|
||||||
( u'module_a.submodule.ModTopLevel.mod_child_2', (u'module', u'method')))
|
(u'module_a.submodule.ModTopLevel.mod_child_2', (u'module', u'method')))
|
||||||
assert (find_obj(u'module_b.submodule', u'ModTopLevel', u'module_a.submodule', u'mod') ==
|
assert (find_obj(u'module_b.submodule', u'ModTopLevel', u'module_a.submodule', u'mod') ==
|
||||||
( u'module_a.submodule', (u'module', u'module')))
|
(u'module_a.submodule', (u'module', u'module')))
|
||||||
|
|
||||||
|
|
||||||
def test_get_full_qualified_name():
|
def test_get_full_qualified_name():
|
||||||
|
@ -106,16 +106,16 @@ def test_get_items_summary(app, status, warning):
|
|||||||
'dummy_module.func')
|
'dummy_module.func')
|
||||||
assert autosummary_items['func'] == func_attrs
|
assert autosummary_items['func'] == func_attrs
|
||||||
|
|
||||||
|
|
||||||
def str_content(elem):
|
def str_content(elem):
|
||||||
if elem.text is not None:
|
if elem.text is not None:
|
||||||
return elem.text
|
return elem.text
|
||||||
else:
|
else:
|
||||||
return ''.join(str_content(e) for e in elem)
|
return ''.join(str_content(e) for e in elem)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('xml', **default_kw)
|
@pytest.mark.sphinx('xml', **default_kw)
|
||||||
def test_escaping(app, status, warning):
|
def test_escaping(app, status, warning):
|
||||||
from xml.etree import ElementTree
|
|
||||||
|
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
|
|
||||||
outdir = app.builder.outdir
|
outdir = app.builder.outdir
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
import sys
|
||||||
from six import PY3
|
from six import PY3
|
||||||
import functools
|
import functools
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
@ -17,6 +18,7 @@ import pytest
|
|||||||
|
|
||||||
from sphinx.util import inspect
|
from sphinx.util import inspect
|
||||||
|
|
||||||
|
|
||||||
class TestGetArgSpec(TestCase):
|
class TestGetArgSpec(TestCase):
|
||||||
def test_getargspec_builtin_type(self):
|
def test_getargspec_builtin_type(self):
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError):
|
||||||
@ -64,7 +66,7 @@ class TestGetArgSpec(TestCase):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
assert expected_unbound == inspect.getargspec(Foo.method)
|
assert expected_unbound == inspect.getargspec(Foo.method)
|
||||||
if PY3:
|
if PY3 and sys.version_info >= (3, 4, 4):
|
||||||
# On py2, the inspect functions don't properly handle bound
|
# On py2, the inspect functions don't properly handle bound
|
||||||
# methods (they include a spurious 'self' argument)
|
# methods (they include a spurious 'self' argument)
|
||||||
assert expected_bound == inspect.getargspec(bound_method)
|
assert expected_bound == inspect.getargspec(bound_method)
|
||||||
|
Loading…
Reference in New Issue
Block a user