Fix #4132: Failed to convert reST parser error to warning

This commit is contained in:
Takeshi KOMIYA
2017-10-22 20:33:18 +09:00
parent 6b4a0123fa
commit cfadf17379
2 changed files with 4 additions and 3 deletions

View File

@@ -39,6 +39,7 @@ Bugs fixed
* #4149: Documentation: Help choosing :confval:`latex_engine`
* #4090: [doc] :confval:`latex_additional_files` with extra LaTeX macros should
not use ``.tex`` extension
* Failed to convert reST parser error to warning (refs: #4132)
Testing
--------

View File

@@ -26,8 +26,7 @@ from sphinx.locale import __
from sphinx.util import logging
logger = logging.getLogger(__name__)
report_re = re.compile('^(.+?:(?:\\d+)?): \\((DEBUG|INFO|WARNING|ERROR|SEVERE)/(\\d+)?\\) '
'(.+?)\n?$')
report_re = re.compile('^(.+?:(?:\\d+)?): \\((DEBUG|INFO|WARNING|ERROR|SEVERE)/(\\d+)?\\) ')
if False:
# For type annotation
@@ -162,7 +161,8 @@ class WarningStream(object):
if not matched:
logger.warning(text.rstrip("\r\n"))
else:
location, type, level, message = matched.groups()
location, type, level = matched.groups()
message = report_re.sub('', text).rstrip()
logger.log(type, message, location=location)