mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch 'stable' into 1.7-release
This commit is contained in:
commit
02ee4ec86b
1
CHANGES
1
CHANGES
@ -195,6 +195,7 @@ Bugs fixed
|
||||
* #1922: html search: Upper characters problem in French
|
||||
* #4412: Updated jQuery version from 3.1.0 to 3.2.1
|
||||
* #4438: math: math with labels with whitespace cause html error
|
||||
* #2437: make full reference for classes, aliased with "alias of"
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -1158,8 +1158,14 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
|
||||
def add_content(self, more_content, no_docstring=False):
|
||||
# type: (Any, bool) -> None
|
||||
if self.doc_as_attr:
|
||||
classname = safe_getattr(self.object, '__name__', None)
|
||||
classname = safe_getattr(self.object, '__qualname__', None)
|
||||
if not classname:
|
||||
classname = safe_getattr(self.object, '__name__', None)
|
||||
if classname:
|
||||
module = safe_getattr(self.object, '__module__', None)
|
||||
parentmodule = safe_getattr(self.parent, '__module__', None)
|
||||
if module and module != parentmodule:
|
||||
classname = str(module) + u'.' + str(classname)
|
||||
content = ViewList(
|
||||
[_('alias of :class:`%s`') % classname], source='')
|
||||
ModuleLevelDocumenter.add_content(self, content,
|
||||
|
@ -56,8 +56,7 @@ class MathDomain(Domain):
|
||||
label = 'mathematics'
|
||||
|
||||
initial_data = {
|
||||
'nameids': {}, # label -> equation ID
|
||||
'objects': {}, # equation ID -> (docname, eqno)
|
||||
'objects': {}, # labelid -> (docname, eqno)
|
||||
} # type: Dict[unicode, Dict[unicode, Tuple[unicode, int]]]
|
||||
dangling_warnings = {
|
||||
'eq': 'equation not found: %(target)s',
|
||||
|
@ -1512,8 +1512,6 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
context = ('\\par\n\\vskip-\\baselineskip'
|
||||
'\\vbox{\\hbox{\\strut}}\\end{varwidth}%\n') + context
|
||||
self.needs_linetrimming = 1
|
||||
if len(node) > 2 and len(node.astext().split('\n')) > 2:
|
||||
self.needs_linetrimming = 1
|
||||
if len(node.traverse(nodes.paragraph)) >= 2:
|
||||
self.table.has_oldproblematic = True
|
||||
if isinstance(node.parent.parent, nodes.thead) or (cell.col in self.table.stubs):
|
||||
|
5
tests/roots/test-ext-autodoc/autodoc_dummy_bar.py
Normal file
5
tests/roots/test-ext-autodoc/autodoc_dummy_bar.py
Normal file
@ -0,0 +1,5 @@
|
||||
from bug2437.autodoc_dummy_foo import Foo
|
||||
|
||||
class Bar(object):
|
||||
"""Dummy class Bar with alias."""
|
||||
my_name = Foo
|
0
tests/roots/test-ext-autodoc/bug2437/__init__.py
Normal file
0
tests/roots/test-ext-autodoc/bug2437/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
class Foo(object):
|
||||
"""Dummy class Foo."""
|
||||
pass
|
@ -10,3 +10,5 @@ source_suffix = '.rst'
|
||||
autodoc_mock_imports = [
|
||||
'dummy'
|
||||
]
|
||||
|
||||
nitpicky = True
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
.. automodule:: autodoc_dummy_module
|
||||
:members:
|
||||
|
||||
.. automodule:: bug2437.autodoc_dummy_foo
|
||||
:members:
|
||||
|
||||
.. automodule:: autodoc_dummy_bar
|
||||
:members:
|
||||
|
@ -0,0 +1,20 @@
|
||||
\label{\detokenize{tabular:table-with-cell-in-first-column-having-three-paragraphs}}
|
||||
|
||||
\begin{savenotes}\sphinxattablestart
|
||||
\centering
|
||||
\begin{tabulary}{\linewidth}[t]{|T|}
|
||||
\hline
|
||||
\sphinxstylethead{\sphinxstyletheadfamily
|
||||
header1
|
||||
\unskip}\relax \\
|
||||
\hline
|
||||
cell1-1-par1
|
||||
|
||||
cell1-1-par2
|
||||
|
||||
cell1-1-par3
|
||||
\\
|
||||
\hline
|
||||
\end{tabulary}
|
||||
\par
|
||||
\sphinxattableend\end{savenotes}
|
@ -68,6 +68,20 @@ cell2-1 cell2-2
|
||||
cell3-1 cell3-2
|
||||
======= =======
|
||||
|
||||
table with cell in first column having three paragraphs
|
||||
-------------------------------------------------------
|
||||
|
||||
+--------------+
|
||||
| header1 |
|
||||
+==============+
|
||||
| cell1-1-par1 |
|
||||
| |
|
||||
| cell1-1-par2 |
|
||||
| |
|
||||
| cell1-1-par3 |
|
||||
+--------------+
|
||||
|
||||
|
||||
table having caption
|
||||
--------------------
|
||||
|
||||
|
@ -943,7 +943,7 @@ def test_maxlistdepth_at_ten(app, status, warning):
|
||||
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
|
||||
reason='docutils-0.13 or above is required')
|
||||
@pytest.mark.sphinx('latex', testroot='latex-table')
|
||||
@pytest.mark.test_params(shared_result='test_latex_table')
|
||||
@pytest.mark.test_params(shared_result='latex-table')
|
||||
def test_latex_table_tabulars(app, status, warning):
|
||||
app.builder.build_all()
|
||||
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
||||
@ -980,6 +980,11 @@ def test_latex_table_tabulars(app, status, warning):
|
||||
expected = get_expected('tabularcolumn')
|
||||
assert actual == expected
|
||||
|
||||
# table with cell in first column having three paragraphs
|
||||
actual = tables['table with cell in first column having three paragraphs']
|
||||
expected = get_expected('table_having_threeparagraphs_cell_in_first_col')
|
||||
assert actual == expected
|
||||
|
||||
# table having caption
|
||||
actual = tables['table having caption']
|
||||
expected = get_expected('table_having_caption')
|
||||
@ -1009,7 +1014,7 @@ def test_latex_table_tabulars(app, status, warning):
|
||||
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
|
||||
reason='docutils-0.13 or above is required')
|
||||
@pytest.mark.sphinx('latex', testroot='latex-table')
|
||||
@pytest.mark.test_params(shared_result='test_latex_table')
|
||||
@pytest.mark.test_params(shared_result='latex-table')
|
||||
def test_latex_table_longtable(app, status, warning):
|
||||
app.builder.build_all()
|
||||
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
||||
@ -1070,7 +1075,7 @@ def test_latex_table_longtable(app, status, warning):
|
||||
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
|
||||
reason='docutils-0.13 or above is required')
|
||||
@pytest.mark.sphinx('latex', testroot='latex-table')
|
||||
@pytest.mark.test_params(shared_result='test_latex_table')
|
||||
@pytest.mark.test_params(shared_result='latex-table')
|
||||
def test_latex_table_complex_tables(app, status, warning):
|
||||
app.builder.build_all()
|
||||
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
||||
|
@ -22,3 +22,13 @@ def test_autodoc(app, status, warning):
|
||||
assert isinstance(content[3], addnodes.desc)
|
||||
assert content[3][0].astext() == 'autodoc_dummy_module.test'
|
||||
assert content[3][1].astext() == 'Dummy function using dummy.*'
|
||||
|
||||
# issue sphinx-doc/sphinx#2437
|
||||
assert content[11][-1].astext() == """Dummy class Bar with alias.
|
||||
|
||||
|
||||
|
||||
my_name
|
||||
|
||||
alias of bug2437.autodoc_dummy_foo.Foo"""
|
||||
assert warning.getvalue() == ''
|
||||
|
Loading…
Reference in New Issue
Block a user