mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '1.7'
This commit is contained in:
commit
72e60ce165
7
CHANGES
7
CHANGES
@ -170,6 +170,13 @@ Features added
|
|||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
* #5037: LaTeX ``\sphinxupquote{}`` breaks in Russian
|
||||||
|
* sphinx.testing uses deprecated pytest API; ``Node.get_marker(name)``
|
||||||
|
* #5016: crashed when recommonmark.AutoStrictify is enabled
|
||||||
|
* #5022: latex: crashed with docutils package provided by Debian/Ubuntu
|
||||||
|
* #5009: latex: a label for table is vanished if table does not have a caption
|
||||||
|
* #5048: crashed with numbered toctree
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ class LiteralIncludeReader(object):
|
|||||||
new_lines = self.read_file(self.filename)
|
new_lines = self.read_file(self.filename)
|
||||||
old_filename = self.options.get('diff')
|
old_filename = self.options.get('diff')
|
||||||
old_lines = self.read_file(old_filename)
|
old_lines = self.read_file(old_filename)
|
||||||
diff = unified_diff(old_lines, new_lines, old_filename, self.filename) # type: ignore
|
diff = unified_diff(old_lines, new_lines, old_filename, self.filename)
|
||||||
return list(diff)
|
return list(diff)
|
||||||
|
|
||||||
def pyobject_filter(self, lines, location=None):
|
def pyobject_filter(self, lines, location=None):
|
||||||
|
@ -169,13 +169,14 @@ class TocTreeCollector(EnvironmentCollector):
|
|||||||
elif isinstance(subnode, addnodes.compact_paragraph):
|
elif isinstance(subnode, addnodes.compact_paragraph):
|
||||||
numstack[-1] += 1
|
numstack[-1] += 1
|
||||||
if depth > 0:
|
if depth > 0:
|
||||||
number = tuple(numstack)
|
number = list(numstack)
|
||||||
|
secnums[subnode[0]['anchorname']] = tuple(numstack)
|
||||||
else:
|
else:
|
||||||
number = None
|
number = None
|
||||||
secnums[subnode[0]['anchorname']] = number
|
secnums[subnode[0]['anchorname']] = None
|
||||||
subnode[0]['secnumber'] = list(number)
|
subnode[0]['secnumber'] = number
|
||||||
if titlenode:
|
if titlenode:
|
||||||
titlenode['secnumber'] = list(number)
|
titlenode['secnumber'] = number
|
||||||
titlenode = None
|
titlenode = None
|
||||||
elif isinstance(subnode, addnodes.toctree):
|
elif isinstance(subnode, addnodes.toctree):
|
||||||
_walk_toctree(subnode, depth)
|
_walk_toctree(subnode, depth)
|
||||||
|
@ -13,6 +13,7 @@ import re
|
|||||||
|
|
||||||
from docutils.core import Publisher
|
from docutils.core import Publisher
|
||||||
from docutils.io import FileInput, NullOutput
|
from docutils.io import FileInput, NullOutput
|
||||||
|
from docutils.parsers.rst import Parser as RSTParser
|
||||||
from docutils.readers import standalone
|
from docutils.readers import standalone
|
||||||
from docutils.statemachine import StringList, string2lines
|
from docutils.statemachine import StringList, string2lines
|
||||||
from docutils.writers import UnfilteredWriter
|
from docutils.writers import UnfilteredWriter
|
||||||
@ -304,6 +305,13 @@ def read_doc(app, env, filename):
|
|||||||
source = input_class(app, env, source=None, source_path=filename,
|
source = input_class(app, env, source=None, source_path=filename,
|
||||||
encoding=env.config.source_encoding)
|
encoding=env.config.source_encoding)
|
||||||
parser = app.registry.create_source_parser(app, filetype)
|
parser = app.registry.create_source_parser(app, filetype)
|
||||||
|
if parser.__class__.__name__ == 'CommonMarkParser' and parser.settings_spec == ():
|
||||||
|
# a workaround for recommonmark
|
||||||
|
# If recommonmark.AutoStrictify is enabled, the parser invokes reST parser
|
||||||
|
# internally. But recommonmark-0.4.0 does not provide settings_spec for reST
|
||||||
|
# parser. As a workaround, this copies settings_spec for RSTParser to the
|
||||||
|
# CommonMarkParser.
|
||||||
|
parser.settings_spec = RSTParser.settings_spec
|
||||||
|
|
||||||
pub = Publisher(reader=reader,
|
pub = Publisher(reader=reader,
|
||||||
parser=parser,
|
parser=parser,
|
||||||
|
@ -9,8 +9,12 @@
|
|||||||
<%= table.get_colspec() %>
|
<%= table.get_colspec() %>
|
||||||
<%- if table.caption -%>
|
<%- if table.caption -%>
|
||||||
\caption{<%= ''.join(table.caption) %>\strut}<%= labels %>\\*[\sphinxlongtablecapskipadjust]
|
\caption{<%= ''.join(table.caption) %>\strut}<%= labels %>\\*[\sphinxlongtablecapskipadjust]
|
||||||
<% endif -%>
|
|
||||||
\hline
|
\hline
|
||||||
|
<% elif labels -%>
|
||||||
|
\hline\noalign{\phantomsection<%= labels %>}%
|
||||||
|
<% else -%>
|
||||||
|
\hline
|
||||||
|
<% endif -%>
|
||||||
<%= ''.join(table.header) %>
|
<%= ''.join(table.header) %>
|
||||||
\endfirsthead
|
\endfirsthead
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
\sphinxcapstartof{table}
|
\sphinxcapstartof{table}
|
||||||
\sphinxcaption{<%= ''.join(table.caption) %>}<%= labels %>
|
\sphinxcaption{<%= ''.join(table.caption) %>}<%= labels %>
|
||||||
\sphinxaftercaption
|
\sphinxaftercaption
|
||||||
|
<% elif labels -%>
|
||||||
|
\phantomsection<%= labels %>\nobreak
|
||||||
<% endif -%>
|
<% endif -%>
|
||||||
\begin{tabular}[t]<%= table.get_colspec() -%>
|
\begin{tabular}[t]<%= table.get_colspec() -%>
|
||||||
\hline
|
\hline
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
\sphinxcapstartof{table}
|
\sphinxcapstartof{table}
|
||||||
\sphinxcaption{<%= ''.join(table.caption) %>}<%= labels %>
|
\sphinxcaption{<%= ''.join(table.caption) %>}<%= labels %>
|
||||||
\sphinxaftercaption
|
\sphinxaftercaption
|
||||||
|
<% elif labels -%>
|
||||||
|
\phantomsection<%= labels %>\nobreak
|
||||||
<% endif -%>
|
<% endif -%>
|
||||||
\begin{tabulary}{\linewidth}[t]<%= table.get_colspec() -%>
|
\begin{tabulary}{\linewidth}[t]<%= table.get_colspec() -%>
|
||||||
\hline
|
\hline
|
||||||
|
@ -42,7 +42,10 @@ def app_params(request, test_params, shared_result, sphinx_test_tempdir, rootdir
|
|||||||
|
|
||||||
# ##### process pytest.mark.sphinx
|
# ##### process pytest.mark.sphinx
|
||||||
|
|
||||||
markers = request.node.get_marker("sphinx")
|
if hasattr(request.node, 'iter_markers'): # pytest-3.6.0 or newer
|
||||||
|
markers = request.node.iter_markers("sphinx")
|
||||||
|
else:
|
||||||
|
markers = request.node.get_marker("sphinx")
|
||||||
pargs = {}
|
pargs = {}
|
||||||
kwargs = {} # type: Dict[str, str]
|
kwargs = {} # type: Dict[str, str]
|
||||||
|
|
||||||
@ -89,7 +92,10 @@ def test_params(request):
|
|||||||
have same 'shared_result' value.
|
have same 'shared_result' value.
|
||||||
**NOTE**: You can not specify shared_result and srcdir in same time.
|
**NOTE**: You can not specify shared_result and srcdir in same time.
|
||||||
"""
|
"""
|
||||||
env = request.node.get_marker('test_params')
|
if hasattr(request.node, 'get_closest_marker'): # pytest-3.6.0 or newer
|
||||||
|
env = request.node.get_closest_marker('test_params')
|
||||||
|
else:
|
||||||
|
env = request.node.get_marker('test_params')
|
||||||
kwargs = env.kwargs if env else {}
|
kwargs = env.kwargs if env else {}
|
||||||
result = {
|
result = {
|
||||||
'shared_result': None,
|
'shared_result': None,
|
||||||
|
@ -19,7 +19,6 @@ from collections import defaultdict
|
|||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
from docutils import nodes, writers
|
from docutils import nodes, writers
|
||||||
from docutils.utils.roman import toRoman
|
|
||||||
from docutils.writers.latex2e import Babel
|
from docutils.writers.latex2e import Babel
|
||||||
from six import itervalues, text_type
|
from six import itervalues, text_type
|
||||||
|
|
||||||
@ -35,6 +34,12 @@ from sphinx.util.nodes import clean_astext
|
|||||||
from sphinx.util.template import LaTeXRenderer
|
from sphinx.util.template import LaTeXRenderer
|
||||||
from sphinx.util.texescape import tex_escape_map, tex_replace_map
|
from sphinx.util.texescape import tex_escape_map, tex_replace_map
|
||||||
|
|
||||||
|
try:
|
||||||
|
from docutils.utils.roman import toRoman
|
||||||
|
except ImportError:
|
||||||
|
# In Debain/Ubuntu, roman package is provided as roman, not as docutils.utils.roman
|
||||||
|
from roman import toRoman
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
# For type annotation
|
# For type annotation
|
||||||
from typing import Any, Callable, Dict, Iterator, List, Pattern, Tuple, Set, Union # NOQA
|
from typing import Any, Callable, Dict, Iterator, List, Pattern, Tuple, Set, Union # NOQA
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
\label{\detokenize{longtable:longtable-having-widths-option}}
|
\label{\detokenize{longtable:longtable-having-widths-option}}
|
||||||
|
|
||||||
\begin{savenotes}\sphinxatlongtablestart\begin{longtable}{|\X{30}{100}|\X{70}{100}|}
|
\begin{savenotes}\sphinxatlongtablestart\begin{longtable}{|\X{30}{100}|\X{70}{100}|}
|
||||||
\hline
|
\hline\noalign{\phantomsection\label{\detokenize{longtable:namedlongtable}}\label{\detokenize{longtable:mylongtable}}}%
|
||||||
\sphinxstyletheadfamily
|
\sphinxstyletheadfamily
|
||||||
header1
|
header1
|
||||||
&\sphinxstyletheadfamily
|
&\sphinxstyletheadfamily
|
||||||
@ -43,3 +43,5 @@ cell3-2
|
|||||||
\\
|
\\
|
||||||
\hline
|
\hline
|
||||||
\end{longtable}\sphinxatlongtableend\end{savenotes}
|
\end{longtable}\sphinxatlongtableend\end{savenotes}
|
||||||
|
|
||||||
|
See {\hyperref[\detokenize{longtable:mylongtable}]{\sphinxcrossref{mylongtable}}}, same as {\hyperref[\detokenize{longtable:namedlongtable}]{\sphinxcrossref{\DUrole{std,std-ref}{this one}}}}.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
\begin{savenotes}\sphinxattablestart
|
\begin{savenotes}\sphinxattablestart
|
||||||
\centering
|
\centering
|
||||||
|
\phantomsection\label{\detokenize{tabular:namedtabular}}\label{\detokenize{tabular:mytabular}}\nobreak
|
||||||
\begin{tabular}[t]{|\X{30}{100}|\X{70}{100}|}
|
\begin{tabular}[t]{|\X{30}{100}|\X{70}{100}|}
|
||||||
\hline
|
\hline
|
||||||
\sphinxstyletheadfamily
|
\sphinxstyletheadfamily
|
||||||
@ -28,3 +29,5 @@ cell3-2
|
|||||||
\end{tabular}
|
\end{tabular}
|
||||||
\par
|
\par
|
||||||
\sphinxattableend\end{savenotes}
|
\sphinxattableend\end{savenotes}
|
||||||
|
|
||||||
|
See {\hyperref[\detokenize{tabular:mytabular}]{\sphinxcrossref{\DUrole{std,std-ref}{this}}}}, same as {\hyperref[\detokenize{tabular:namedtabular}]{\sphinxcrossref{namedtabular}}}.
|
||||||
|
@ -18,9 +18,12 @@ longtable
|
|||||||
longtable having :widths: option
|
longtable having :widths: option
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
|
.. _mylongtable:
|
||||||
|
|
||||||
.. table::
|
.. table::
|
||||||
:class: longtable
|
:class: longtable
|
||||||
:widths: 30,70
|
:widths: 30,70
|
||||||
|
:name: namedlongtable
|
||||||
|
|
||||||
======= =======
|
======= =======
|
||||||
header1 header2
|
header1 header2
|
||||||
@ -30,6 +33,8 @@ longtable having :widths: option
|
|||||||
cell3-1 cell3-2
|
cell3-1 cell3-2
|
||||||
======= =======
|
======= =======
|
||||||
|
|
||||||
|
See mylongtable_, same as :ref:`this one <namedlongtable>`.
|
||||||
|
|
||||||
longtable having :align: option
|
longtable having :align: option
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
taburar and taburary
|
tabular and tabulary
|
||||||
====================
|
====================
|
||||||
|
|
||||||
simple table
|
simple table
|
||||||
@ -15,8 +15,11 @@ cell3-1 cell3-2
|
|||||||
table having :widths: option
|
table having :widths: option
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
.. _mytabular:
|
||||||
|
|
||||||
.. table::
|
.. table::
|
||||||
:widths: 30,70
|
:widths: 30,70
|
||||||
|
:name: namedtabular
|
||||||
|
|
||||||
======= =======
|
======= =======
|
||||||
header1 header2
|
header1 header2
|
||||||
@ -26,6 +29,8 @@ table having :widths: option
|
|||||||
cell3-1 cell3-2
|
cell3-1 cell3-2
|
||||||
======= =======
|
======= =======
|
||||||
|
|
||||||
|
See :ref:`this <mytabular>`, same as namedtabular_.
|
||||||
|
|
||||||
table having :align: option (tabulary)
|
table having :align: option (tabulary)
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
|
|
||||||
|
@ -32,7 +32,10 @@ def apidoc(rootdir, tempdir, apidoc_params):
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def apidoc_params(request):
|
def apidoc_params(request):
|
||||||
markers = request.node.get_marker("apidoc")
|
if hasattr(request.node, 'iter_markers'): # pytest-3.6.0 or newer
|
||||||
|
markers = request.node.iter_markers("apidoc")
|
||||||
|
else:
|
||||||
|
markers = request.node.get_marker("apidoc")
|
||||||
pargs = {}
|
pargs = {}
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
|
|
||||||
|
@ -27,7 +27,10 @@ def setup_command(request, tempdir, rootdir):
|
|||||||
Run `setup.py build_sphinx` with args and kwargs,
|
Run `setup.py build_sphinx` with args and kwargs,
|
||||||
pass it to the test and clean up properly.
|
pass it to the test and clean up properly.
|
||||||
"""
|
"""
|
||||||
marker = request.node.get_marker('setup_command')
|
if hasattr(request.node, 'get_closest_marker'): # pytest-3.6.0 or newer
|
||||||
|
marker = request.node.get_closest_marker('setup_command')
|
||||||
|
else:
|
||||||
|
marker = request.node.get_marker('setup_command')
|
||||||
args = marker.args if marker else []
|
args = marker.args if marker else []
|
||||||
|
|
||||||
pkgrootdir = tempdir / 'test-setup'
|
pkgrootdir = tempdir / 'test-setup'
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
|
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
|
||||||
:license: BSD, see LICENSE for details.
|
:license: BSD, see LICENSE for details.
|
||||||
"""
|
"""
|
||||||
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@ -35,3 +37,12 @@ def test_singlehtml_toctree(app, status, warning):
|
|||||||
app.builder._get_local_toctree('index')
|
app.builder._get_local_toctree('index')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pytest.fail('Unexpected AttributeError in app.builder.fix_refuris')
|
pytest.fail('Unexpected AttributeError in app.builder.fix_refuris')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx(testroot='toctree', srcdir="numbered-toctree")
|
||||||
|
def test_numbered_toctree(app, status, warning):
|
||||||
|
# give argument to :numbered: option
|
||||||
|
index = (app.srcdir / 'index.rst').text()
|
||||||
|
index = re.sub(':numbered:.*', ':numbered: 1', index)
|
||||||
|
(app.srcdir / 'index.rst').write_text(index, encoding='utf-8')
|
||||||
|
app.builder.build_all()
|
||||||
|
Loading…
Reference in New Issue
Block a user