mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '2.0.1' into 2.0
This commit is contained in:
commit
b9153ef027
7
CHANGES
7
CHANGES
@ -86,11 +86,18 @@ Bugs fixed
|
|||||||
----------
|
----------
|
||||||
|
|
||||||
* LaTeX: some system labels are not translated
|
* LaTeX: some system labels are not translated
|
||||||
|
* RemovedInSphinx30Warning is marked as pending
|
||||||
* deprecation warnings are not emitted
|
* deprecation warnings are not emitted
|
||||||
|
|
||||||
- sphinx.application.CONFIG_FILENAME
|
- sphinx.application.CONFIG_FILENAME
|
||||||
|
- sphinx.builders.htmlhelp
|
||||||
- :confval:`viewcode_import`
|
- :confval:`viewcode_import`
|
||||||
|
|
||||||
|
* #6208: C++, properly parse full xrefs that happen to have a short xref as prefix.
|
||||||
|
* #6220, #6225: napoleon: AttributeError is raised for raised section having
|
||||||
|
references
|
||||||
|
* #6245: circular import error on importing SerializingHTMLBuilder
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
from sphinx.builders.html import StandaloneHTMLBuilder
|
from sphinx.builders.html import StandaloneHTMLBuilder
|
||||||
|
from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
from sphinx.util.osutil import SEP, os_path
|
from sphinx.util.osutil import SEP, os_path
|
||||||
|
|
||||||
@ -55,6 +56,14 @@ class DirectoryHTMLBuilder(StandaloneHTMLBuilder):
|
|||||||
self.globalcontext['no_search_suffix'] = True
|
self.globalcontext['no_search_suffix'] = True
|
||||||
|
|
||||||
|
|
||||||
|
# for compatibility
|
||||||
|
deprecated_alias('sphinx.builders.html',
|
||||||
|
{
|
||||||
|
'DirectoryHTMLBuilder': DirectoryHTMLBuilder,
|
||||||
|
},
|
||||||
|
RemovedInSphinx40Warning)
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
# type: (Sphinx) -> Dict[str, Any]
|
# type: (Sphinx) -> Dict[str, Any]
|
||||||
app.setup_extension('sphinx.builders.html')
|
app.setup_extension('sphinx.builders.html')
|
||||||
|
@ -24,9 +24,7 @@ from docutils.utils import relative_path
|
|||||||
|
|
||||||
from sphinx import package_dir, __display_version__
|
from sphinx import package_dir, __display_version__
|
||||||
from sphinx.builders import Builder
|
from sphinx.builders import Builder
|
||||||
from sphinx.deprecation import (
|
from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warning
|
||||||
RemovedInSphinx30Warning, RemovedInSphinx40Warning, deprecated_alias
|
|
||||||
)
|
|
||||||
from sphinx.environment.adapters.asset import ImageAdapter
|
from sphinx.environment.adapters.asset import ImageAdapter
|
||||||
from sphinx.environment.adapters.indexentries import IndexEntries
|
from sphinx.environment.adapters.indexentries import IndexEntries
|
||||||
from sphinx.environment.adapters.toctree import TocTree
|
from sphinx.environment.adapters.toctree import TocTree
|
||||||
@ -1232,23 +1230,9 @@ def validate_math_renderer(app):
|
|||||||
|
|
||||||
|
|
||||||
# for compatibility
|
# for compatibility
|
||||||
from sphinx.builders.dirhtml import DirectoryHTMLBuilder # NOQA
|
import sphinx.builders.dirhtml # NOQA
|
||||||
from sphinx.builders.singlehtml import SingleFileHTMLBuilder # NOQA
|
import sphinx.builders.singlehtml # NOQA
|
||||||
from sphinxcontrib.serializinghtml import ( # NOQA
|
import sphinxcontrib.serializinghtml # NOQA
|
||||||
LAST_BUILD_FILENAME, JSONHTMLBuilder, PickleHTMLBuilder, SerializingHTMLBuilder
|
|
||||||
)
|
|
||||||
|
|
||||||
deprecated_alias('sphinx.builders.html',
|
|
||||||
{
|
|
||||||
'LAST_BUILD_FILENAME': LAST_BUILD_FILENAME,
|
|
||||||
'DirectoryHTMLBuilder': DirectoryHTMLBuilder,
|
|
||||||
'JSONHTMLBuilder': JSONHTMLBuilder,
|
|
||||||
'PickleHTMLBuilder': PickleHTMLBuilder,
|
|
||||||
'SerializingHTMLBuilder': SerializingHTMLBuilder,
|
|
||||||
'SingleFileHTMLBuilder': SingleFileHTMLBuilder,
|
|
||||||
'WebHTMLBuilder': PickleHTMLBuilder,
|
|
||||||
},
|
|
||||||
RemovedInSphinx40Warning)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
|
@ -24,7 +24,7 @@ if False:
|
|||||||
from sphinx.application import Sphinx # NOQA
|
from sphinx.application import Sphinx # NOQA
|
||||||
|
|
||||||
|
|
||||||
deprecated_alias('sphinx.builders.devhelp',
|
deprecated_alias('sphinx.builders.htmlhelp',
|
||||||
{
|
{
|
||||||
'chm_locales': chm_locales,
|
'chm_locales': chm_locales,
|
||||||
'chm_htmlescape': chm_htmlescape,
|
'chm_htmlescape': chm_htmlescape,
|
||||||
|
@ -13,6 +13,7 @@ from os import path
|
|||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
|
||||||
from sphinx.builders.html import StandaloneHTMLBuilder
|
from sphinx.builders.html import StandaloneHTMLBuilder
|
||||||
|
from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias
|
||||||
from sphinx.environment.adapters.toctree import TocTree
|
from sphinx.environment.adapters.toctree import TocTree
|
||||||
from sphinx.locale import __
|
from sphinx.locale import __
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
@ -201,6 +202,14 @@ class SingleFileHTMLBuilder(StandaloneHTMLBuilder):
|
|||||||
self.handle_page('opensearch', {}, 'opensearch.xml', outfilename=fn)
|
self.handle_page('opensearch', {}, 'opensearch.xml', outfilename=fn)
|
||||||
|
|
||||||
|
|
||||||
|
# for compatibility
|
||||||
|
deprecated_alias('sphinx.builders.html',
|
||||||
|
{
|
||||||
|
'SingleFileHTMLBuilder': SingleFileHTMLBuilder,
|
||||||
|
},
|
||||||
|
RemovedInSphinx40Warning)
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
# type: (Sphinx) -> Dict[str, Any]
|
# type: (Sphinx) -> Dict[str, Any]
|
||||||
app.setup_extension('sphinx.builders.html')
|
app.setup_extension('sphinx.builders.html')
|
||||||
|
@ -17,7 +17,7 @@ if False:
|
|||||||
from typing import Any, Dict, Type # NOQA
|
from typing import Any, Dict, Type # NOQA
|
||||||
|
|
||||||
|
|
||||||
class RemovedInSphinx30Warning(PendingDeprecationWarning):
|
class RemovedInSphinx30Warning(DeprecationWarning):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -6391,6 +6391,7 @@ class DefinitionParser:
|
|||||||
# if there are '()' left, just skip them
|
# if there are '()' left, just skip them
|
||||||
self.skip_ws()
|
self.skip_ws()
|
||||||
self.skip_string('()')
|
self.skip_string('()')
|
||||||
|
self.assert_end()
|
||||||
templatePrefix = self._check_template_consistency(name, templatePrefix,
|
templatePrefix = self._check_template_consistency(name, templatePrefix,
|
||||||
fullSpecShorthand=True)
|
fullSpecShorthand=True)
|
||||||
res1 = ASTNamespace(name, templatePrefix)
|
res1 = ASTNamespace(name, templatePrefix)
|
||||||
@ -6403,6 +6404,7 @@ class DefinitionParser:
|
|||||||
# if there are '()' left, just skip them
|
# if there are '()' left, just skip them
|
||||||
self.skip_ws()
|
self.skip_ws()
|
||||||
self.skip_string('()')
|
self.skip_string('()')
|
||||||
|
self.assert_end()
|
||||||
return res2, False
|
return res2, False
|
||||||
except DefinitionError as e2:
|
except DefinitionError as e2:
|
||||||
errs = []
|
errs = []
|
||||||
@ -7145,7 +7147,6 @@ class CPPDomain(Domain):
|
|||||||
parser = DefinitionParser(target, warner, env.config)
|
parser = DefinitionParser(target, warner, env.config)
|
||||||
try:
|
try:
|
||||||
ast, isShorthand = parser.parse_xref_object()
|
ast, isShorthand = parser.parse_xref_object()
|
||||||
parser.assert_end()
|
|
||||||
except DefinitionError as e:
|
except DefinitionError as e:
|
||||||
def findWarning(e): # as arg to stop flake8 from complaining
|
def findWarning(e): # as arg to stop flake8 from complaining
|
||||||
if typ != 'any' and typ != 'func':
|
if typ != 'any' and typ != 'func':
|
||||||
@ -7154,7 +7155,6 @@ class CPPDomain(Domain):
|
|||||||
parser2 = DefinitionParser(target[:-2], warner, env.config)
|
parser2 = DefinitionParser(target[:-2], warner, env.config)
|
||||||
try:
|
try:
|
||||||
parser2.parse_xref_object()
|
parser2.parse_xref_object()
|
||||||
parser2.assert_end()
|
|
||||||
except DefinitionError as e2:
|
except DefinitionError as e2:
|
||||||
return target[:-2], e2
|
return target[:-2], e2
|
||||||
# strange, that we don't get the error now, use the original
|
# strange, that we don't get the error now, use the original
|
||||||
|
@ -100,7 +100,7 @@ class GoogleDocstring:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_name_rgx = re.compile(r"^\s*(:(?P<role>\w+):`(?P<name>[a-zA-Z0-9_.-]+)`|"
|
_name_rgx = re.compile(r"^\s*((?::(?P<role>\S+):)?`(?P<name>[a-zA-Z0-9_.-]+)`|"
|
||||||
r" (?P<name2>[a-zA-Z0-9_.-]+))\s*", re.X)
|
r" (?P<name2>[a-zA-Z0-9_.-]+))\s*", re.X)
|
||||||
|
|
||||||
def __init__(self, docstring, config=None, app=None, what='', name='',
|
def __init__(self, docstring, config=None, app=None, what='', name='',
|
||||||
@ -700,9 +700,9 @@ class GoogleDocstring:
|
|||||||
fields = self._consume_fields(parse_type=False, prefer_type=True)
|
fields = self._consume_fields(parse_type=False, prefer_type=True)
|
||||||
lines = [] # type: List[str]
|
lines = [] # type: List[str]
|
||||||
for _name, _type, _desc in fields:
|
for _name, _type, _desc in fields:
|
||||||
m = self._name_rgx.match(_type).groupdict()
|
m = self._name_rgx.match(_type)
|
||||||
if m['role']:
|
if m and m.group('name'):
|
||||||
_type = m['name']
|
_type = m.group('name')
|
||||||
_type = ' ' + _type if _type else ''
|
_type = ' ' + _type if _type else ''
|
||||||
_desc = self._strip_empty(_desc)
|
_desc = self._strip_empty(_desc)
|
||||||
_descs = ' ' + '\n '.join(_desc) if any(_desc) else ''
|
_descs = ' ' + '\n '.join(_desc) if any(_desc) else ''
|
||||||
|
@ -755,6 +755,20 @@ def test_attributes():
|
|||||||
check('member', 'int *[[attr]] *i', {1: 'i__iPP', 2: '1i'})
|
check('member', 'int *[[attr]] *i', {1: 'i__iPP', 2: '1i'})
|
||||||
|
|
||||||
|
|
||||||
|
def test_xref_parsing():
|
||||||
|
def check(target):
|
||||||
|
class Config:
|
||||||
|
cpp_id_attributes = ["id_attr"]
|
||||||
|
cpp_paren_attributes = ["paren_attr"]
|
||||||
|
parser = DefinitionParser(target, None, Config())
|
||||||
|
ast, isShorthand = parser.parse_xref_object()
|
||||||
|
parser.assert_end()
|
||||||
|
check('f')
|
||||||
|
check('f()')
|
||||||
|
check('void f()')
|
||||||
|
check('T f()')
|
||||||
|
|
||||||
|
|
||||||
# def test_print():
|
# def test_print():
|
||||||
# # used for getting all the ids out for checking
|
# # used for getting all the ids out for checking
|
||||||
# for a in ids:
|
# for a in ids:
|
||||||
|
@ -473,12 +473,21 @@ Raises:
|
|||||||
A setting wasn't specified, or was invalid.
|
A setting wasn't specified, or was invalid.
|
||||||
ValueError:
|
ValueError:
|
||||||
Something something value error.
|
Something something value error.
|
||||||
|
:py:class:`AttributeError`
|
||||||
|
errors for missing attributes.
|
||||||
|
~InvalidDimensionsError
|
||||||
|
If the dimensions couldn't be parsed.
|
||||||
|
`InvalidArgumentsError`
|
||||||
|
If the arguments are invalid.
|
||||||
|
|
||||||
""", """
|
""", """
|
||||||
Example Function
|
Example Function
|
||||||
|
|
||||||
:raises RuntimeError: A setting wasn't specified, or was invalid.
|
:raises RuntimeError: A setting wasn't specified, or was invalid.
|
||||||
:raises ValueError: Something something value error.
|
:raises ValueError: Something something value error.
|
||||||
|
:raises AttributeError: errors for missing attributes.
|
||||||
|
:raises ~InvalidDimensionsError: If the dimensions couldn't be parsed.
|
||||||
|
:raises InvalidArgumentsError: If the arguments are invalid.
|
||||||
"""),
|
"""),
|
||||||
################################
|
################################
|
||||||
("""
|
("""
|
||||||
|
Loading…
Reference in New Issue
Block a user