chiark / gitweb /
doxygen: consistent and tested quote unescaping.
authorVladimír Vondruš <mosra@centrum.cz>
Fri, 15 Dec 2017 17:58:17 +0000 (18:58 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Fri, 15 Dec 2017 18:40:44 +0000 (19:40 +0100)
doxygen/dox2html5.py
doxygen/test/doxyfile/Doxyfile
doxygen/test/test_doxyfile.py

index 5832f4ab9abb6352299f54f29c0f181835b659c9..510d0093c193e3b137ca0fda987def3db474deb8 100755 (executable)
@@ -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<key>[A-Z0-9_@]+)\s*=\s*(?P<quote>"?)(?P<value>.*)(?P=quote)\s*(?P<backslash>\\?)$""")
-    variable_continuation_re = re.compile(r"""^\s*(?P<key>[A-Z_]+)\s*\+=\s*(?P<quote>"?)(?P<value>.*)(?P=quote)\s*(?P<backslash>\\?)$""")
+    variable_re = re.compile(r"""^\s*(?P<key>[A-Z0-9_@]+)\s*=\s*(?P<quote>['"]?)(?P<value>.*)(?P=quote)\s*(?P<backslash>\\?)$""")
+    variable_continuation_re = re.compile(r"""^\s*(?P<key>[A-Z_]+)\s*\+=\s*(?P<quote>['"]?)(?P<value>.*)(?P=quote)\s*(?P<backslash>\\?)$""")
     continuation_re = re.compile(r"""^\s*(?P<quote>['"]?)(?P<value>.*)(?P=quote)\s*(?P<backslash>\\?)$""")
 
     # 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
index 3f059d881b9e9fe81db38fd87e53638d445d2c66..eb8f8d1e88a42a00adcf9d4667dfb772e361456a 100644 (file)
@@ -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\""
index 3b3e51415f36de669b42b2a4eca83fca5a93e80a..dd2a079194590659676a3f9a25f3f9900705ca3a 100644 (file)
@@ -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': '',