chiark / gitweb /
doxygen: fix a CASE_SENSE_NAMES omission.
authorVladimír Vondruš <mosra@centrum.cz>
Thu, 13 Sep 2018 11:27:14 +0000 (13:27 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Thu, 13 Sep 2018 13:58:13 +0000 (15:58 +0200)
In 1d7c689fd36b6952c0f6877ad9af562e3e10433a I fixed one broken part but
forgot about this one. This one affects the Pages tree and the test of
course didn't check it. Now it does.

doxygen/dox2html5.py
doxygen/test/compound_filename_case/pages.html [new file with mode: 0644]
doxygen/test/test_compound.py

index 4a6456a6b289358b681685f7d0e251cd5d16392d..d79b8e369db35581f855105f5229abceb1d6f854 100755 (executable)
@@ -1788,8 +1788,11 @@ def extract_metadata(state: State, xml):
     # Compound name is page filename, so we have to use title there. The same
     # is for groups.
     compound.name = html.escape(compounddef.find('title').text if compound.kind in ['page', 'group'] and compounddef.findtext('title') else compounddef.find('compoundname').text)
-    # Compound URL is ID, except for index page
-    compound.url = (compounddef.find('compoundname').text if compound.kind == 'page' else compound.id) + '.html'
+    # Compound URL is ID, except for index page, where it is named "indexpage"
+    # and so I have to override it back to "index". Can't use <compoundname>
+    # for pages because that doesn't reflect CASE_SENSE_NAMES. THANKS DOXYGEN.
+    # This is similar to compound.url_base handling in parse_xml() below.
+    compound.url = 'index.html' if compound.kind == 'page' and compound.id == 'indexpage' else compound.id + '.html'
     compound.brief = parse_desc(state, compounddef.find('briefdescription'))
     # Groups and pages are explicitly created so they *have details*, other
     # things need to have at least some documentation
@@ -2045,6 +2048,7 @@ def parse_xml(state: State, xml: str):
     # Compound URL is ID, except for index page, where it is named "indexpage"
     # and so I have to override it back to "index". Can't use <compoundname>
     # for pages because that doesn't reflect CASE_SENSE_NAMES. THANKS DOXYGEN.
+    # This is similar to compound.url handling in extract_metadata() above.
     compound.url_base = ('index' if compound.id == 'indexpage' else compound.id)
     compound.url = compound.url_base + '.html'
     # Save current compound URL for search data building and ID extraction,
diff --git a/doxygen/test/compound_filename_case/pages.html b/doxygen/test/compound_filename_case/pages.html
new file mode 100644 (file)
index 0000000..97ce123
--- /dev/null
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>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>Pages</h2>
+        <ul class="m-dox">
+          <li class="m-dox-collapsible">
+            <a href="#" onclick="return toggle(this)"></a><a href="index.html" class="m-dox">My Project</a> <span class="m-dox"></span>
+            <ul class="m-dox">
+              <li><a href="_u_p_p_e_r_c_a_s_e.html" class="m-dox">Uppercase page</a> <span class="m-dox"></span></li>
+            </ul>
+          </li>
+        </ul>
+        <script>
+        function toggle(e) {
+            e.parentElement.className = e.parentElement.className == 'm-dox-collapsible' ?
+                'm-dox-expansible' : 'm-dox-collapsible';
+            return false;
+        }
+        /* Collapse all nodes marked as such. Doing it via JS instead of directly in
+           markup so disabling it doesn't harm usability. The list is somehow
+           regenerated on every iteration and shrinks as I change the classes. It's not
+           documented anywhere and I'm not sure if this is the same across browsers, so
+           I am going backwards in that list to be sure.  */
+        var collapsed = document.getElementsByClassName("collapsed");
+        for(var i = collapsed.length - 1; i >= 0; --i)
+            collapsed[i].className = 'm-dox-expansible';
+        </script>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 826c6de770849d04f0b6635a6a9db258fca6f836..69221b8c4d5f8975c8a56ccfcbed675a7012308b 100644 (file)
@@ -230,7 +230,8 @@ class FilenameCase(IntegrationTestCase):
         self.run_dox2html5(wildcard='*.xml')
 
         # Verify that all filenames are "converted" to lowercase and the links
-        # work properly as well
+        # and page tree work properly as well
         self.assertEqual(*self.actual_expected_contents('index.html'))
+        self.assertEqual(*self.actual_expected_contents('pages.html'))
         self.assertEqual(*self.actual_expected_contents('_u_p_p_e_r_c_a_s_e.html'))
         self.assertEqual(*self.actual_expected_contents('class_u_p_p_e_r_c_l_a_s_s.html'))