From d8ac86a2bb8d64c3c317363107701e33aff1a3ea Mon Sep 17 00:00:00 2001 From: Jakob Lykke Andersen Date: Wed, 16 May 2018 22:02:29 +0200 Subject: [PATCH] C++, handle (escaped) line breaks in epxr role Fixes sphinx-doc/sphinx#4825 --- CHANGES | 4 +++- sphinx/domains/cpp.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index fdaae64bb..c5f1f9fdc 100644 --- a/CHANGES +++ b/CHANGES @@ -22,7 +22,9 @@ Bugs fixed * #4863, #4938, #4939: i18n doesn't handle node.title correctly tat used for contents, topic, admonition, table and section. * #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 -------- diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index fe339b153..23e8c642c 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -12,7 +12,7 @@ import re from copy import deepcopy -from docutils import nodes +from docutils import nodes, utils from docutils.parsers.rst import Directive, directives from six import iteritems, text_type @@ -5962,7 +5962,7 @@ class CPPExprRole(object): class Warner(object): def warn(self, msg): inliner.reporter.warning(msg, line=lineno) - + text = utils.unescape(text).replace('\n', ' ') env = inliner.document.settings.env parser = DefinitionParser(text, Warner(), env.config) try: