C++, handle (escaped) line breaks in epxr role

Fixes sphinx-doc/sphinx#4825
This commit is contained in:
Jakob Lykke Andersen 2018-05-16 22:02:29 +02:00
parent b7b1db0f18
commit d8ac86a2bb
2 changed files with 5 additions and 3 deletions

View File

@ -22,7 +22,9 @@ Bugs fixed
* #4863, #4938, #4939: i18n doesn't handle node.title correctly tat used for * #4863, #4938, #4939: i18n doesn't handle node.title correctly tat used for
contents, topic, admonition, table and section. contents, topic, admonition, table and section.
* #4913: i18n: literal blocks in bullet list are not translated * #4913: i18n: literal blocks in bullet list are not translated
* #4962: cpp domain: raises TypeError on duplicate declaration * #4962: C++, raised TypeError on duplicate declaration.
* #4825: C++, properly parse expr roles and give better error messages when
(escaped) line breaks are present.
Testing Testing
-------- --------

View File

@ -12,7 +12,7 @@
import re import re
from copy import deepcopy from copy import deepcopy
from docutils import nodes from docutils import nodes, utils
from docutils.parsers.rst import Directive, directives from docutils.parsers.rst import Directive, directives
from six import iteritems, text_type from six import iteritems, text_type
@ -5962,7 +5962,7 @@ class CPPExprRole(object):
class Warner(object): class Warner(object):
def warn(self, msg): def warn(self, msg):
inliner.reporter.warning(msg, line=lineno) inliner.reporter.warning(msg, line=lineno)
text = utils.unescape(text).replace('\n', ' ')
env = inliner.document.settings.env env = inliner.document.settings.env
parser = DefinitionParser(text, Warner(), env.config) parser = DefinitionParser(text, Warner(), env.config)
try: try: