From ec19602210cb16c9658a05bd96dabca92158e0ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 15 Dec 2017 18:58:17 +0100 Subject: [PATCH] doxygen: consistent and tested quote unescaping. --- doxygen/dox2html5.py | 6 +++--- doxygen/test/doxyfile/Doxyfile | 4 ++++ doxygen/test/test_doxyfile.py | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index 5832f4ab..510d0093 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -1749,8 +1749,8 @@ def parse_doxyfile(state: State, doxyfile, config = None): logging.info("Parsing configuration from {}".format(doxyfile)) comment_re = re.compile(r"""^\s*(#.*)?$""") - variable_re = re.compile(r"""^\s*(?P[A-Z0-9_@]+)\s*=\s*(?P"?)(?P.*)(?P=quote)\s*(?P\\?)$""") - variable_continuation_re = re.compile(r"""^\s*(?P[A-Z_]+)\s*\+=\s*(?P"?)(?P.*)(?P=quote)\s*(?P\\?)$""") + variable_re = re.compile(r"""^\s*(?P[A-Z0-9_@]+)\s*=\s*(?P['"]?)(?P.*)(?P=quote)\s*(?P\\?)$""") + variable_continuation_re = re.compile(r"""^\s*(?P[A-Z_]+)\s*\+=\s*(?P['"]?)(?P.*)(?P=quote)\s*(?P\\?)$""") continuation_re = re.compile(r"""^\s*(?P['"]?)(?P.*)(?P=quote)\s*(?P\\?)$""") # Defaults so we don't fail with minimal Doxyfiles and also that the @@ -1788,7 +1788,7 @@ def parse_doxyfile(state: State, doxyfile, config = None): else: backslash = False - return [i.replace('\\"', '"') for i in out], backslash + return [i.replace('\\"', '"').replace('\\\'', '\'') for i in out], backslash with open(doxyfile) as f: continued_line = None diff --git a/doxygen/test/doxyfile/Doxyfile b/doxygen/test/doxyfile/Doxyfile index 3f059d88..eb8f8d1e 100644 --- a/doxygen/test/doxyfile/Doxyfile +++ b/doxygen/test/doxyfile/Doxyfile @@ -14,3 +14,7 @@ HTML_EXTRA_FILES = \ # Adding HTML_EXTRA_STYLESHEET = a.css HTML_EXTRA_STYLESHEET += b.css + +# Escaping +M_PAGE_HEADER = 'this is "quotes" \'apostrophes\'' +M_PAGE_FINE_PRINT = "this is \"quotes\"" diff --git a/doxygen/test/test_doxyfile.py b/doxygen/test/test_doxyfile.py index 3b3e5141..dd2a0791 100644 --- a/doxygen/test/test_doxyfile.py +++ b/doxygen/test/test_doxyfile.py @@ -37,6 +37,8 @@ class Doxyfile(unittest.TestCase): 'M_CLASS_TREE_EXPAND_LEVELS': 1, 'M_EXPAND_INNER_TYPES': False, 'M_FILE_TREE_EXPAND_LEVELS': 1, + 'M_PAGE_FINE_PRINT': 'this is "quotes"', + 'M_PAGE_HEADER': 'this is "quotes" \'apostrophes\'', 'M_SHOW_DOXYGEN_VERSION': True, 'M_THEME_COLOR': '#22272e', 'OUTPUT_DIRECTORY': '', -- 2.30.2