chiark / gitweb /
Revert "documentation/doxygen: drop handling for a Doxygen 1.8.15 bug."
authorVladimír Vondruš <mosra@centrum.cz>
Mon, 10 Jan 2022 11:39:14 +0000 (12:39 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 10 Jan 2022 12:05:51 +0000 (13:05 +0100)
Turns out it's not really A Thing Of The Past yet -- the assertion is
firing for different cases and the message of it is utterly confusing.
Repro case for the others in the following commit.

This reverts commit 6bea7027cb2674e4c5f78a527ddab506d9785675.

documentation/doxygen.py
documentation/test_doxygen/contents_brief_multiline_ingroup/Doxyfile [new file with mode: 0644]
documentation/test_doxygen/contents_brief_multiline_ingroup/File.h [new file with mode: 0644]
documentation/test_doxygen/contents_brief_multiline_ingroup/group__thatgroup.html [new file with mode: 0644]
documentation/test_doxygen/contents_brief_multiline_ingroup/group__thatgroup_1815.html [new file with mode: 0644]
documentation/test_doxygen/test_contents.py

index 824e6413141ea114d44323747d4e7b2fcaf8ad2e..dee5b522ad80c1091a5395454202790b3f545e0a 100755 (executable)
@@ -1688,13 +1688,20 @@ 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, \
-                "{}: brief description containing multiple paragraphs, possibly due to @ingroup following a @brief in {}. This was a bug in Doxygen 1.8.15/16 and fixed since, please upgrade.".format(state.current, out.parsed)
-            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. See the contents_brief_multiline_ingroup test
+            # for details. Fixed since 1.8.16.
+            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/documentation/test_doxygen/contents_brief_multiline_ingroup/Doxyfile b/documentation/test_doxygen/contents_brief_multiline_ingroup/Doxyfile
new file mode 100644 (file)
index 0000000..7e9ad92
--- /dev/null
@@ -0,0 +1,14 @@
+INPUT                   = File.h
+QUIET                   = YES
+GENERATE_HTML           = NO
+GENERATE_LATEX          = NO
+GENERATE_XML            = YES
+XML_PROGRAMLISTING      = NO
+CASE_SENSE_NAMES        = YES
+
+##! M_PAGE_FINE_PRINT   =
+##! M_THEME_COLOR       =
+##! M_FAVICON           =
+##! M_LINKS_NAVBAR1     =
+##! M_LINKS_NAVBAR2     =
+##! M_SEARCH_DISABLED   = YES
diff --git a/documentation/test_doxygen/contents_brief_multiline_ingroup/File.h b/documentation/test_doxygen/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/documentation/test_doxygen/contents_brief_multiline_ingroup/group__thatgroup.html b/documentation/test_doxygen/contents_brief_multiline_ingroup/group__thatgroup.html
new file mode 100644 (file)
index 0000000..cf0a91e
--- /dev/null
@@ -0,0 +1,59 @@
+<!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+documentation.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>
+        <nav class="m-block m-default">
+          <h3>Contents</h3>
+          <ul>
+            <li>
+              Reference
+              <ul>
+                <li><a href="#func-members">Functions</a></li>
+              </ul>
+            </li>
+          </ul>
+        </nav>
+        <section id="func-members">
+          <h2><a href="#func-members">Functions</a></h2>
+          <dl class="m-doc">
+            <dt>
+              <span class="m-doc-wrap-bumper">void <a href="#gac07863d69ae41a4e395b31f73b35fbcd" class="m-doc">foo</a>(</span><span class="m-doc-wrap">)</span>
+            </dt>
+            <dd>Function that&#x27;s in a group.</dd>
+          </dl>
+        </section>
+        <section>
+          <h2>Function documentation</h2>
+          <section class="m-doc-details" id="gac07863d69ae41a4e395b31f73b35fbcd"><div>
+            <h3>
+              <span class="m-doc-wrap-bumper">void </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#gac07863d69ae41a4e395b31f73b35fbcd" class="m-doc-self">foo</a>(</span><span class="m-doc-wrap">)</span></span>
+            </h3>
+            <p>Function that&#x27;s in a group.</p>
+<p>Lines of detailed description that get merged to the brief for no freaking reason.</p>
+          </div></section>
+        </section>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
diff --git a/documentation/test_doxygen/contents_brief_multiline_ingroup/group__thatgroup_1815.html b/documentation/test_doxygen/contents_brief_multiline_ingroup/group__thatgroup_1815.html
new file mode 100644 (file)
index 0000000..13e9cf2
--- /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+documentation.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 58467601fe1bb31ac533c354610156c572b939a1..0f8516367c1ac0089eac752f9b025b02d13c62ce 100644 (file)
@@ -357,6 +357,26 @@ class AutobriefHeading(IntegrationTestCase):
         self.run_doxygen(wildcard='namespaceNamespace.xml')
         self.assertEqual(*self.actual_expected_contents('namespaceNamespace.html'))
 
+class BriefMultilineIngroup(IntegrationTestCase):
+    @unittest.skipUnless(LooseVersion(doxygen_version()) < LooseVersion("1.8.16"),
+        "1.8.16 doesn't merge adjacent paragraphs into brief in presence of an @ingroup anymore")
+    def test_1815(self):
+        with self.assertLogs() as cm:
+            self.run_doxygen(wildcard='group__thatgroup.xml')
+
+        self.assertEqual(*self.actual_expected_contents('group__thatgroup.html', 'group__thatgroup_1815.html'))
+        self.assertEqual(cm.output, [
+            "WARNING:root:group__thatgroup.xml: brief description containing multiple paragraphs, possibly due to @ingroup following a @brief. That's not supported, ignoring the whole contents of <p>Function that's in a group</p><p>Lines of detailed description that get merged to the brief for no freaking reason.</p>"
+        ])
+
+    @unittest.skipUnless(LooseVersion(doxygen_version()) >= LooseVersion("1.8.16"),
+        "1.8.16 doesn't merge adjacent paragraphs into brief in presence of an @ingroup anymore")
+    def test(self):
+        # No warnings should be produced here
+        # TODO use self.assertNoLongs() on 3.10+
+        self.run_doxygen(wildcard='group__thatgroup.xml')
+        self.assertEqual(*self.actual_expected_contents('group__thatgroup.html'))
+
 class SectionUnderscoreOne(IntegrationTestCase):
     def test(self):
         self.run_doxygen(wildcard='indexpage.xml')