mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '1.8'
This commit is contained in:
commit
8a391d1781
3
CHANGES
3
CHANGES
@ -255,7 +255,10 @@ Bugs fixed
|
|||||||
----------
|
----------
|
||||||
|
|
||||||
* LaTeX: Remove extraneous space after author names on PDF title page (refs: #6004)
|
* LaTeX: Remove extraneous space after author names on PDF title page (refs: #6004)
|
||||||
|
* #6026: LaTeX: A cross reference to definition list does not work
|
||||||
* #6046: LaTeX: ``TypeError`` is raised when invalid latex_elements given
|
* #6046: LaTeX: ``TypeError`` is raised when invalid latex_elements given
|
||||||
|
* #6019: imgconverter: Including multipage PDF fails
|
||||||
|
* #6047: autodoc: ``autofunction`` emits a warning for method objects
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -1002,6 +1002,7 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ
|
|||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
if (not isfunction(self.object) and
|
if (not isfunction(self.object) and
|
||||||
|
not inspect.ismethod(self.object) and
|
||||||
not isbuiltin(self.object) and
|
not isbuiltin(self.object) and
|
||||||
not inspect.isclass(self.object) and
|
not inspect.isclass(self.object) and
|
||||||
hasattr(self.object, '__call__')):
|
hasattr(self.object, '__call__')):
|
||||||
|
@ -54,9 +54,9 @@ class ImagemagickConverter(ImageConverter):
|
|||||||
# type: (str, str) -> bool
|
# type: (str, str) -> bool
|
||||||
"""Converts the image to expected one."""
|
"""Converts the image to expected one."""
|
||||||
try:
|
try:
|
||||||
if _from.lower().endswith('.gif'):
|
# append an index 0 to source filename to pick up the first frame
|
||||||
# when target is GIF format, pick the first frame
|
# (or first page) of image (ex. Animation GIF, PDF)
|
||||||
_from += '[0]'
|
_from += '[0]'
|
||||||
|
|
||||||
args = ([self.config.image_converter] +
|
args = ([self.config.image_converter] +
|
||||||
self.config.image_converter_args +
|
self.config.image_converter_args +
|
||||||
|
@ -301,6 +301,15 @@ def traverse_parent(node, cls=None):
|
|||||||
node = node.parent
|
node = node.parent
|
||||||
|
|
||||||
|
|
||||||
|
def get_prev_node(node):
|
||||||
|
# type: (nodes.Node) -> nodes.Node
|
||||||
|
pos = node.parent.index(node)
|
||||||
|
if pos > 0:
|
||||||
|
return node.parent[pos - 1]
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def traverse_translatable_index(doctree):
|
def traverse_translatable_index(doctree):
|
||||||
# type: (nodes.Element) -> Iterable[Tuple[nodes.Element, List[str]]]
|
# type: (nodes.Element) -> Iterable[Tuple[nodes.Element, List[str]]]
|
||||||
"""Traverse translatable index node from a document tree."""
|
"""Traverse translatable index node from a document tree."""
|
||||||
|
@ -28,9 +28,9 @@ from sphinx.deprecation import (
|
|||||||
from sphinx.domains.std import StandardDomain
|
from sphinx.domains.std import StandardDomain
|
||||||
from sphinx.errors import SphinxError
|
from sphinx.errors import SphinxError
|
||||||
from sphinx.locale import admonitionlabels, _, __
|
from sphinx.locale import admonitionlabels, _, __
|
||||||
from sphinx.util import split_into, logging
|
from sphinx.util import split_into, logging
|
||||||
from sphinx.util.docutils import SphinxTranslator
|
from sphinx.util.docutils import SphinxTranslator
|
||||||
from sphinx.util.nodes import clean_astext
|
from sphinx.util.nodes import clean_astext, get_prev_node
|
||||||
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
|
||||||
|
|
||||||
@ -1752,9 +1752,15 @@ class LaTeXTranslator(SphinxTranslator):
|
|||||||
elif domain.get_enumerable_node_type(next_node) and domain.get_numfig_title(next_node):
|
elif domain.get_enumerable_node_type(next_node) and domain.get_numfig_title(next_node):
|
||||||
return
|
return
|
||||||
|
|
||||||
if 'refuri' in node or 'refid' in node or 'refname' in node:
|
if 'refuri' in node:
|
||||||
# skip indirect targets (external hyperlink and internal links)
|
|
||||||
return
|
return
|
||||||
|
if node.get('refid'):
|
||||||
|
prev_node = get_prev_node(node)
|
||||||
|
if isinstance(prev_node, nodes.reference) and node['refid'] == prev_node['refid']:
|
||||||
|
# a target for a hyperlink reference having alias
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
add_target(node['refid'])
|
||||||
for id in node['ids']:
|
for id in node['ids']:
|
||||||
add_target(id)
|
add_target(id)
|
||||||
|
|
||||||
|
@ -4,5 +4,10 @@ class Callable():
|
|||||||
def __call__(self, arg1, arg2, **kwargs):
|
def __call__(self, arg1, arg2, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def method(self, arg1, arg2):
|
||||||
|
"""docstring of Callable.method()."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
function = Callable()
|
function = Callable()
|
||||||
|
method = function.method
|
||||||
|
@ -1365,6 +1365,19 @@ def test_autofunction_for_callable(app):
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('html', testroot='ext-autodoc')
|
||||||
|
def test_autofunction_for_method(app):
|
||||||
|
actual = do_autodoc(app, 'function', 'target.callable.method')
|
||||||
|
assert list(actual) == [
|
||||||
|
'',
|
||||||
|
'.. py:function:: method(arg1, arg2)',
|
||||||
|
' :module: target.callable',
|
||||||
|
'',
|
||||||
|
' docstring of Callable.method().',
|
||||||
|
' '
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('html', testroot='ext-autodoc')
|
@pytest.mark.sphinx('html', testroot='ext-autodoc')
|
||||||
def test_mocked_module_imports(app, warning):
|
def test_mocked_module_imports(app, warning):
|
||||||
# no autodoc_mock_imports
|
# no autodoc_mock_imports
|
||||||
|
Loading…
Reference in New Issue
Block a user