diff --git a/CHANGES b/CHANGES index b7f125b47..841273d5f 100644 --- a/CHANGES +++ b/CHANGES @@ -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 -------- diff --git a/sphinx/util/docutils.py b/sphinx/util/docutils.py index c984bcfaf..a8df9c59d 100644 --- a/sphinx/util/docutils.py +++ b/sphinx/util/docutils.py @@ -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)