Merge branch '1.7-release' into 4275_update_strftime

This commit is contained in:
Takeshi KOMIYA
2018-01-28 20:13:35 +09:00
committed by GitHub
5 changed files with 11 additions and 3 deletions

View File

@@ -26,6 +26,8 @@ Bugs fixed
* #4472: DOCUMENTATION_OPTIONS is not defined * #4472: DOCUMENTATION_OPTIONS is not defined
* #4491: autodoc: prefer _MockImporter over other importers in sys.meta_path * #4491: autodoc: prefer _MockImporter over other importers in sys.meta_path
* #4490: autodoc: type annotation is broken with python 3.7.0a4+ * #4490: autodoc: type annotation is broken with python 3.7.0a4+
* utils package is installed
* #3952: apidoc: module header is too escaped
* #4275: Formats accepted by sphinx.util.i18n.format_date are limited * #4275: Formats accepted by sphinx.util.i18n.format_date are limited
Testing Testing

View File

@@ -37,6 +37,8 @@ exclude = .git,.tox,.venv,tests/*,build/*,doc/_build/*,sphinx/search/*,sphinx/py
[flake8:local-plugins] [flake8:local-plugins]
extension = extension =
X101 = utils.checks:sphinx_has_header X101 = utils.checks:sphinx_has_header
paths =
.
[mypy] [mypy]
python_version = 2.7 python_version = 2.7

View File

@@ -214,7 +214,7 @@ setup(
'Topic :: Utilities', 'Topic :: Utilities',
], ],
platforms='any', platforms='any',
packages=find_packages(exclude=['tests']), packages=find_packages(exclude=['tests', 'utils']),
include_package_data=True, include_package_data=True,
entry_points={ entry_points={
'console_scripts': [ 'console_scripts': [

View File

@@ -23,13 +23,15 @@ if False:
# For type annotation # For type annotation
from typing import Generator # NOQA from typing import Generator # NOQA
symbols_re = re.compile(r'([!-/:-@\[-`{-~])') symbols_re = re.compile(r'([!--/:-@\[-`{-~])') # symbols without dot(0x2e)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
def escape(text): def escape(text):
# type: (unicode) -> unicode # type: (unicode) -> unicode
return symbols_re.sub(r'\\\1', text) # type: ignore text = symbols_re.sub(r'\\\1', text) # type: ignore
text = re.sub(r'^\.', r'\.', text) # escape a dot at top
return text
@contextmanager @contextmanager

View File

@@ -14,3 +14,5 @@ from sphinx.util.rst import escape
def test_escape(): def test_escape():
assert escape(':ref:`id`') == r'\:ref\:\`id\`' assert escape(':ref:`id`') == r'\:ref\:\`id\`'
assert escape('footnote [#]_') == r'footnote \[\#\]\_' assert escape('footnote [#]_') == r'footnote \[\#\]\_'
assert escape('sphinx.application') == r'sphinx.application'
assert escape('.. toctree::') == r'\.. toctree\:\:'