chiark / gitweb /
documentation/doxygen: support colspan/rowspan in tables.
authorVladimír Vondruš <mosra@centrum.cz>
Thu, 7 May 2020 15:32:21 +0000 (17:32 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Thu, 7 May 2020 18:24:39 +0000 (20:24 +0200)
New in 1.8.18.

documentation/doxygen.py
documentation/test_doxygen/contents_blocks/doxygen1818.html [new file with mode: 0644]
documentation/test_doxygen/contents_blocks/input.dox
documentation/test_doxygen/test_contents.py

index d355b51a0e5ead06ba4aca36db097c255f8790ed..1b32c6d2b4da9161e56a29dde8d053379bf19d7d 100755 (executable)
@@ -719,7 +719,12 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET.
                         assert entry.tag == 'entry'
                         is_header = entry.attrib['thead'] == 'yes'
                         is_header_row = is_header_row and is_header
-                        row_data += '<{0}>{1}</{0}>'.format('th' if is_header else 'td', parse_desc(state, entry))
+                        rowspan = ' rowspan="{}"'.format(entry.attrib['rowspan']) if 'rowspan' in entry.attrib else ''
+                        colspan = ' colspan="{}"'.format(entry.attrib['colspan']) if 'colspan' in entry.attrib else ''
+                        row_data += '<{0}{2}{3}>{1}</{0}>'.format(
+                            'th' if is_header else 'td',
+                            parse_desc(state, entry),
+                            rowspan, colspan)
 
                     # Table head is opened upon encountering first header row
                     # and closed upon encountering first body row (in case it was
diff --git a/documentation/test_doxygen/contents_blocks/doxygen1818.html b/documentation/test_doxygen/contents_blocks/doxygen1818.html
new file mode 100644 (file)
index 0000000..10ee48d
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>Doxygen 1.8.18 features | 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>
+          Doxygen 1.8.18 features
+        </h1>
+<p>Tested separately because the CI has only 1.8.17 right now.</p><table class="m-table"><tbody><tr><td colspan="2">Table</td><td rowspan="3">with</td></tr><tr><td>colspan</td><td>and</td></tr><tr><td colspan="2">rowspan</td></tr></tbody></table>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 0f9c9356b4b24842f10f653a1d2ce95ea33de6bd..7b2aaf208ebcaa369ca6b379218d6b98d65e2409 100644 (file)
@@ -135,3 +135,23 @@ This gets hidden because internal docs are not enabled by default.
 @todo Diffferent TODO
 
 */
+
+/** @page doxygen1818 Doxygen 1.8.18 features
+
+Tested separately because the CI has only 1.8.17 right now.
+
+<table>
+  <tr>
+    <td colspan="2">Table</th>
+    <td rowspan="3">with</th>
+  </tr>
+  <tr>
+    <td>colspan</td>
+    <td>and</td>
+  </tr>
+  <tr>
+    <td colspan="2">rowspan</td>
+  </tr>
+</table>
+
+*/
index 8be7dd0e7e7f47c2c930c5b92ec58931f9fd0758..d88ed67324b2c14697361b2b0ae7fe178e2719f9 100644 (file)
@@ -56,6 +56,11 @@ class Blocks(IntegrationTestCase):
         # Multiple xrefitems should be merged into one
         self.assertEqual(*self.actual_expected_contents('File_8h.html'))
 
+    @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.18"), "new features in 1.8.18")
+    def test_1818(self):
+        self.run_doxygen(wildcard='*.xml')
+        self.assertEqual(*self.actual_expected_contents('doxygen1818.html'))
+
     @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.14"),
                          "https://github.com/doxygen/doxygen/pull/6587 fucking broke this")
     def test_xrefitem1814(self):