chiark / gitweb /
doxygen: more workarounds for insane multiline brief bugs.
authorVladimír Vondruš <mosra@centrum.cz>
Fri, 22 Feb 2019 22:22:46 +0000 (23:22 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Sat, 23 Feb 2019 00:09:59 +0000 (01:09 +0100)
doxygen/dox2html5.py
doxygen/test/contents_brief_multiline_ingroup/Doxyfile [new file with mode: 0644]
doxygen/test/contents_brief_multiline_ingroup/File.h [new file with mode: 0644]
doxygen/test/contents_brief_multiline_ingroup/group__thatgroup.html [new file with mode: 0644]
doxygen/test/test_contents.py

index c5268963b57490e49eaa171744fce6bf15289f5a..b59d8e1fb435475b3cdb1f2957264632108b12bf 100755 (executable)
@@ -1590,13 +1590,19 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET.
                 assert out.parsed.startswith('<p>') and out.parsed.endswith('</p>')
                 out.parsed = out.parsed[3:-4]
 
-        # Sane behavior otherwise
+        # Sane behavior otherwise. Well, no. I give up.
         else:
-            assert not has_block_elements and paragraph_count <= 1
-
-            if paragraph_count == 1:
-                assert out.parsed.startswith('<p>') and out.parsed.endswith('</p>')
-                out.parsed = out.parsed[3:-4]
+            # In 1.8.15 if @brief is followed by an @ingroup, then the
+            # immediately following paragraph gets merged with it for some
+            # freaking reason.
+            if paragraph_count > 1:
+                logging.warning("{}: brief description containing multiple paragraphs, possibly due to @ingroup following a @brief. That's not supported, ignoring the whole contents of {}".format(state.current, out.parsed))
+                out.parsed = ''
+            else:
+                assert not has_block_elements and paragraph_count <= 1
+                if paragraph_count == 1:
+                    assert out.parsed.startswith('<p>') and out.parsed.endswith('</p>')
+                    out.parsed = out.parsed[3:-4]
 
     # Strip superfluous <p> for simple elments (list items, parameter and
     # return value description, table cells), but only if there is just a
diff --git a/doxygen/test/contents_brief_multiline_ingroup/Doxyfile b/doxygen/test/contents_brief_multiline_ingroup/Doxyfile
new file mode 100644 (file)
index 0000000..1edb642
--- /dev/null
@@ -0,0 +1,14 @@
+INPUT                   = File.h
+QUIET                   = YES
+GENERATE_HTML           = NO
+GENERATE_LATEX          = NO
+GENERATE_XML            = YES
+XML_PROGRAMLISTING      = NO
+
+##! M_PAGE_FINE_PRINT   =
+##! M_THEME_COLOR       =
+##! M_FAVICON           =
+##! M_LINKS_NAVBAR1     =
+##! M_LINKS_NAVBAR2     =
+##! M_SEARCH_DISABLED   = YES
+
diff --git a/doxygen/test/contents_brief_multiline_ingroup/File.h b/doxygen/test/contents_brief_multiline_ingroup/File.h
new file mode 100644 (file)
index 0000000..deb92f4
--- /dev/null
@@ -0,0 +1,10 @@
+/** @defgroup thatgroup This is a group */
+
+/**
+@brief Function that's in a group
+@ingroup thatgroup
+
+Lines of detailed description that get merged to the brief for no freaking
+reason.
+*/
+void foo();
diff --git a/doxygen/test/contents_brief_multiline_ingroup/group__thatgroup.html b/doxygen/test/contents_brief_multiline_ingroup/group__thatgroup.html
new file mode 100644 (file)
index 0000000..b55f275
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>This is a group module | My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+doxygen.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          This is a group <span class="m-thin">module</span></h1>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 09af0ac7e2bb6ccafb1a6765d21cc8d5398abef7..f7905722c27d330a852c881dd7699ff9260aa0dd 100644 (file)
@@ -414,3 +414,11 @@ class Htmlinclude(IntegrationTestCase):
     def test_warnings(self):
         self.run_dox2html5(wildcard='warnings.xml')
         self.assertEqual(*self.actual_expected_contents('warnings.html'))
+
+class BriefMultilineIngroup(IntegrationTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, 'brief_multiline_ingroup', *args, **kwargs)
+
+    def test(self):
+        self.run_dox2html5(wildcard='group__thatgroup.xml')
+        self.assertEqual(*self.actual_expected_contents('group__thatgroup.html'))