chiark / gitweb /
doxygen: properly support CASE_SENSE_NAMES set to NO.
authorVladimír Vondruš <mosra@centrum.cz>
Mon, 30 Apr 2018 14:21:54 +0000 (16:21 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 30 Apr 2018 14:21:54 +0000 (16:21 +0200)
I was working around the indexpage/index name mismatch by using
<compoundname> for pages, but that doesn't work well when
CASE_SENSE_NAMES is disabled. This fixes it.

doxygen/dox2html5.py
doxygen/test/compound_filename_case/Doxyfile [new file with mode: 0644]
doxygen/test/compound_filename_case/_u_p_p_e_r_c_a_s_e.html [new file with mode: 0644]
doxygen/test/compound_filename_case/class_u_p_p_e_r_c_l_a_s_s.html [new file with mode: 0644]
doxygen/test/compound_filename_case/index.html [new file with mode: 0644]
doxygen/test/compound_filename_case/input.h [new file with mode: 0644]
doxygen/test/test_compound.py

index 9d1d0bdfb8e7327128e8173e81b315eb5644650f..6f3a53bd638af79bd838864f846269a72730fddc 100755 (executable)
@@ -1960,8 +1960,10 @@ def parse_xml(state: State, xml: str):
     # Compound name is page filename, so we have to use title there. The same
     # is for groups.
     compound.name = 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_base = (compounddef.find('compoundname').text if compound.kind == 'page' else compound.id)
+    # 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.
+    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
     state.current_compound = compound
diff --git a/doxygen/test/compound_filename_case/Doxyfile b/doxygen/test/compound_filename_case/Doxyfile
new file mode 100644 (file)
index 0000000..d14de34
--- /dev/null
@@ -0,0 +1,15 @@
+INPUT                   = input.h
+AUTOLINK_SUPPORT        = NO
+QUIET                   = YES
+GENERATE_HTML           = NO
+GENERATE_LATEX          = NO
+GENERATE_XML            = YES
+XML_PROGRAMLISTING      = NO
+
+M_PAGE_FINE_PRINT       =
+M_THEME_COLOR           =
+M_LINKS_NAVBAR1         =
+M_LINKS_NAVBAR2         =
+M_SEARCH_DISABLED       = YES
+
+CASE_SENSE_NAMES        = NO
diff --git a/doxygen/test/compound_filename_case/_u_p_p_e_r_c_a_s_e.html b/doxygen/test/compound_filename_case/_u_p_p_e_r_c_a_s_e.html
new file mode 100644 (file)
index 0000000..7212659
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>My Project &raquo; Uppercase page | 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>
+          <span class="m-breadcrumb"><a href="index.html">My Project</a> &raquo;</span>
+          Uppercase page
+        </h1>
+<p>This should get saved to a correct place and also get correctly linked to.</p>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
diff --git a/doxygen/test/compound_filename_case/class_u_p_p_e_r_c_l_a_s_s.html b/doxygen/test/compound_filename_case/class_u_p_p_e_r_c_l_a_s_s.html
new file mode 100644 (file)
index 0000000..914ba5e
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>UPPERCLASS class | 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>
+          UPPERCLASS <span class="m-thin">class</span>
+        </h1>
+        <p>An uppercase class.</p>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
diff --git a/doxygen/test/compound_filename_case/index.html b/doxygen/test/compound_filename_case/index.html
new file mode 100644 (file)
index 0000000..bace463
--- /dev/null
@@ -0,0 +1,31 @@
+<!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>
+          My Project
+        </h1>
+<ul><li><a href="_u_p_p_e_r_c_a_s_e.html" class="m-dox">Uppercase page</a></li><li><a href="class_u_p_p_e_r_c_l_a_s_s.html" class="m-dox">UPPERCLASS</a></li></ul>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
diff --git a/doxygen/test/compound_filename_case/input.h b/doxygen/test/compound_filename_case/input.h
new file mode 100644 (file)
index 0000000..72a338b
--- /dev/null
@@ -0,0 +1,13 @@
+/** @mainpage
+
+-   @subpage UPPERCASE
+-   @ref UPPERCLASS
+*/
+
+/** @page UPPERCASE Uppercase page
+
+This should get saved to a correct place and also get correctly linked to.
+*/
+
+/** @brief An uppercase class */
+class UPPERCLASS {};
index 42a43a3248c1aca287c186f222e15124b9a63d1e..8b2d2be0ffd4d069b4f7143f098e3c755e003e9c 100644 (file)
@@ -206,3 +206,16 @@ class NamespaceMembersInFileScope(IntegrationTestCase):
 
         # The file should have just links to detailed docs
         self.assertEqual(*self.actual_expected_contents('File_8h.html'))
+
+class FilenameCase(IntegrationTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, 'filename_case', *args, **kwargs)
+
+    def test(self):
+        self.run_dox2html5(wildcard='*.xml')
+
+        # Verify that all filenames are "converted" to lowercase and the links
+        # work properly as well
+        self.assertEqual(*self.actual_expected_contents('index.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'))