chiark / gitweb /
documentation/doxygen: properly handle <sect5> and <sect6> everywhere.
authorVladimír Vondruš <mosra@centrum.cz>
Mon, 16 Sep 2024 17:47:23 +0000 (19:47 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 16 Sep 2024 17:50:51 +0000 (19:50 +0200)
Insufficient testing in 2b57d535dfddbee13cb30ad352c42e68e7915553 and
before led to this (hitting the unreachable assert below), fortunately
looking at code coverage revealed the "more than three levels of
Markdown headings" message was never tested properly.

documentation/doxygen.py
documentation/test_doxygen/contents_sections_headings/Warnings.h
documentation/test_doxygen/contents_sections_headings/Warnings_8h-110.html
documentation/test_doxygen/contents_sections_headings/Warnings_8h.html
documentation/test_doxygen/contents_sections_headings/warnings-110.html
documentation/test_doxygen/contents_sections_headings/warnings.html
documentation/test_doxygen/test_contents.py

index 88a2d80df84a585f19af6d8ca32a9894f2f00193..5b0d8e88463e16f79887b8be84dc118f694b6c9c 100755 (executable)
@@ -699,7 +699,7 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET.
                     tag = 'h5'
                 elif element.tag == 'sect3':
                     tag = 'h6'
-                elif element.tag == 'sect4':
+                elif element.tag in ['sect4', 'sect5', 'sect6']:
                     tag = 'h6'
                     logging.warning("{}: more than three levels of sections in member descriptions are not supported, stopping at <h6>".format(state.current))
                 elif not element.tag == 'simplesect': # pragma: no cover
index ce4a8a81563c58ff25858cf1e623c4ee9f08cd48..257fc2c5faacd6f6286399f168782718f0123e20 100644 (file)
@@ -5,8 +5,18 @@
 /**
 @brief This produces warnings
 
+# Markdown heading 1
+
+## Markdown heading 2
+
+### Markdown heading 3
+
 #### Markdown heading 4 that's rendered the same as 3
 
+##### Markdown heading 5 that's rendered the same as 3
+
+###### Markdown heading 6 that's rendered the same as 3
+
 Markdown heading, underlined, is misparsed
 ##########################################
 
index 51c0aef4a5d263d7fa07f79138ac1aafe88ea6b9..67834d3d9165526855764aa6ae2b867d48280978 100644 (file)
@@ -50,7 +50,7 @@
               <span class="m-doc-wrap-bumper">void </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ac03b94e5ed1aeeba4c9d31498e9a767a" class="m-doc-self">bar</a>(</span><span class="m-doc-wrap">int foo)</span></span>
             </h3>
             <p>This produces warnings.</p>
-<h6 id="autotoc_md3">Markdown heading 4 that&#x27;s rendered the same as 3</h6><p>Markdown heading, underlined, is misparsed</p>
+<h4 id="autotoc_md3">Markdown heading 1</h4><h5 id="autotoc_md4">Markdown heading 2</h5><h6 id="autotoc_md5">Markdown heading 3</h6><h6 id="autotoc_md6">Markdown heading 4 that&#x27;s rendered the same as 3</h6><p><a name="autotoc_md7"></a></p><h6>Markdown heading 5 that&#x27;s rendered the same as 3</h6><h6>Markdown heading 6 that&#x27;s rendered the same as 3</h6><p>Markdown heading, underlined, is misparsed</p>
           </div></section>
         </section>
       </div>
index 4ec185dae3f2232b534906c44f4d81b68d30c43a..6210eb011881eeb9a4aa0858b44392cc25ee3600 100644 (file)
@@ -50,7 +50,7 @@
               <span class="m-doc-wrap-bumper">void </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ac03b94e5ed1aeeba4c9d31498e9a767a" class="m-doc-self">bar</a>(</span><span class="m-doc-wrap">int foo)</span></span>
             </h3>
             <p>This produces warnings.</p>
-<h6 id="autotoc_md3">Markdown heading 4 that&#x27;s rendered the same as 3</h6><p>Markdown heading, underlined, is misparsed ##########################################</p>
+<h4 id="autotoc_md3">Markdown heading 1</h4><h5 id="autotoc_md4">Markdown heading 2</h5><h6 id="autotoc_md5">Markdown heading 3</h6><h6 id="autotoc_md6">Markdown heading 4 that&#x27;s rendered the same as 3</h6><h6 id="autotoc_md7">Markdown heading 5 that&#x27;s rendered the same as 3</h6><h6 id="autotoc_md8">Markdown heading 6 that&#x27;s rendered the same as 3</h6><p>Markdown heading, underlined, is misparsed ##########################################</p>
           </div></section>
         </section>
       </div>
index 6410f51b534cd50a0cc68aa26cf81e4220070b16..b36b46080d0bfad10d6ea5b126db9dcc440dc2e2 100644 (file)
@@ -22,7 +22,7 @@
         <h1>
           Content that produces warnings
         </h1>
-<section id="autotoc_md4"><h2><a href="#autotoc_md4">Markdown heading 1</a></h2><section id="autotoc_md5"><h3><a href="#autotoc_md5">Markdown heading 2</a></h3><section id="autotoc_md6"><h4><a href="#autotoc_md6">Markdown heading 3</a></h4><section id="autotoc_md7"><h5><a href="#autotoc_md7">Markdown heading 4</a></h5><p><a name="autotoc_md8"></a></p><h6>Markdown heading 5</h6><h6>Markdown heading 6 that&#x27;s rendered the same as 5</h6><p>Markdown heading, underlined, is misparsed</p></section></section></section></section>
+<section id="autotoc_md8"><h2><a href="#autotoc_md8">Markdown heading 1</a></h2><section id="autotoc_md9"><h3><a href="#autotoc_md9">Markdown heading 2</a></h3><section id="autotoc_md10"><h4><a href="#autotoc_md10">Markdown heading 3</a></h4><section id="autotoc_md11"><h5><a href="#autotoc_md11">Markdown heading 4</a></h5><p><a name="autotoc_md12"></a></p><h6>Markdown heading 5</h6><h6>Markdown heading 6 that&#x27;s rendered the same as 5</h6><p>Markdown heading, underlined, is misparsed</p></section></section></section></section>
       </div>
     </div>
   </div>
index e03d348fc5e5b62da2b62fdc37ea562818fb1314..0d1c16a0c95e3702a7560aa0746edb9b822bf05e 100644 (file)
@@ -22,7 +22,7 @@
         <h1>
           Content that produces warnings
         </h1>
-<section id="autotoc_md4"><h2><a href="#autotoc_md4">Markdown heading 1</a></h2><section id="autotoc_md5"><h3><a href="#autotoc_md5">Markdown heading 2</a></h3><section id="autotoc_md6"><h4><a href="#autotoc_md6">Markdown heading 3</a></h4><section id="autotoc_md7"><h5><a href="#autotoc_md7">Markdown heading 4</a></h5><section id="autotoc_md8"><h6><a href="#autotoc_md8">Markdown heading 5</a></h6><section id="autotoc_md9"><h6><a href="#autotoc_md9">Markdown heading 6 that&#x27;s rendered the same as 5</a></h6><p>Markdown heading, underlined, is misparsed ##########################################</p></section></section></section></section></section></section>
+<section id="autotoc_md9"><h2><a href="#autotoc_md9">Markdown heading 1</a></h2><section id="autotoc_md10"><h3><a href="#autotoc_md10">Markdown heading 2</a></h3><section id="autotoc_md11"><h4><a href="#autotoc_md11">Markdown heading 3</a></h4><section id="autotoc_md12"><h5><a href="#autotoc_md12">Markdown heading 4</a></h5><section id="autotoc_md13"><h6><a href="#autotoc_md13">Markdown heading 5</a></h6><section id="autotoc_md14"><h6><a href="#autotoc_md14">Markdown heading 6 that&#x27;s rendered the same as 5</a></h6><p>Markdown heading, underlined, is misparsed ##########################################</p></section></section></section></section></section></section>
       </div>
     </div>
   </div>
index 996b5aba5d2d0a901e50aa24733eb718233bc38c..06dc2f1f370027ffc0146f0c7f4f35c639c6f5f1 100644 (file)
@@ -481,6 +481,9 @@ class SectionsHeadings(IntegrationTestCase):
             page = 'warnings.html'
             file = 'Warnings_8h.html'
             output = [
+                # Once for every extra level
+                "WARNING:root:Warnings_8h.xml: more than three levels of sections in member descriptions are not supported, stopping at <h6>",
+                "WARNING:root:Warnings_8h.xml: more than three levels of sections in member descriptions are not supported, stopping at <h6>",
                 "WARNING:root:Warnings_8h.xml: more than three levels of sections in member descriptions are not supported, stopping at <h6>",
                 "WARNING:root:warnings.xml: more than five levels of sections are not supported, stopping at <h6>",
             ]
@@ -488,7 +491,10 @@ class SectionsHeadings(IntegrationTestCase):
             page = 'warnings-110.html'
             file = 'Warnings_8h-110.html'
             output = [
+                # Once for the first extra level, then two more for another
                 "WARNING:root:Warnings_8h.xml: more than three levels of sections in member descriptions are not supported, stopping at <h6>",
+                'WARNING:root:Warnings_8h.xml: more than three levels of Markdown headings in member descriptions are not supported, stopping at <h6>',
+                'WARNING:root:Warnings_8h.xml: more than three levels of Markdown headings in member descriptions are not supported, stopping at <h6>',
                 "WARNING:root:Warnings_8h.xml: a Markdown heading underline was apparently misparsed by Doxygen, prefix the headings with # instead",
                 "WARNING:root:warnings.xml: more than five levels of Markdown headings for top-level docs are not supported, stopping at <h6>",
                 "WARNING:root:warnings.xml: a Markdown heading underline was apparently misparsed by Doxygen, prefix the headings with # instead",