prefix = state.compounds[compound.parent].name + '/'
if compound.name.startswith(prefix):
compound.leaf_name = compound.name[len(prefix):]
- else: # pragma: no cover
- logging.warning("{}: potential issue: directory {} parent is not a prefix: {}".format(state.current, compound.name, prefix))
+ else:
+ logging.warning("potential issue: the parent of {}/ is {} which is not a prefix, you may want to enable FULL_PATH_NAMES together with STRIP_FROM_PATH and STRIP_FROM_INC_PATH to preserve filesystem hierarchy".format(compound.name, prefix))
compound.leaf_name = compound.name
# Other compounds are not in any index pages or breadcrumb, so leaf
class IntegrationTestCase(BaseTestCase):
def setUp(self):
if os.path.exists(os.path.join(self.path, 'xml')): shutil.rmtree(os.path.join(self.path, 'xml'))
- subprocess.run(['doxygen', self.doxyfile], cwd=self.path, check=True)
+ # Run Doxygen at the path where Doxyfile is, in order to interpret the
+ # paths in it relative to that file
+ subpath, doxyfile = os.path.split(self.doxyfile)
+ subprocess.run(['doxygen', doxyfile], cwd=os.path.join(self.path, subpath), check=True)
if os.path.exists(os.path.join(self.path, 'html')): shutil.rmtree(os.path.join(self.path, 'html'))
--- /dev/null
+INPUT = ../project/root.h ../project/directory/sub.h
+OUTPUT_DIRECTORY = ..
+QUIET = YES
+GENERATE_HTML = NO
+GENERATE_LATEX = NO
+GENERATE_XML = YES
+XML_PROGRAMLISTING = NO
+CASE_SENSE_NAMES = YES
+
+# If the three below would be set instead, it wouldn't warn
+FULL_PATH_NAMES = NO
+# FULL_PATH_NAMES = YES
+# STRIP_FROM_PATH = ..
+# STRIP_FROM_INC_PATH = ..
+
+##! M_PAGE_FINE_PRINT =
+##! M_THEME_COLOR =
+##! M_FAVICON =
+##! M_LINKS_NAVBAR1 =
+##! M_LINKS_NAVBAR2 =
+##! M_SEARCH_DISABLED = YES
--- /dev/null
+<!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+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>Files</h1>
+ <ul class="m-doc">
+ <li class="m-doc-collapsible">
+ <a href="#" onclick="return toggle(this)">dir</a> <a href="dir_167790342fb55959539d550b874be046.html" class="m-doc">project</a> <span class="m-doc">Root directory.</span>
+ <ul class="m-doc">
+ <li class="m-doc-collapsible collapsed">
+ <a href="#" onclick="return toggle(this)">dir</a> <a href="dir_aa1d5ee656b7a8fc93f47c41696a1c9b.html" class="m-doc">directory</a> <span class="m-doc">Subdirectory.</span>
+ <ul class="m-doc">
+ <li>file <a href="sub_8h.html" class="m-doc">sub.h</a> <span class="m-doc">Subdirectory file.</span></li>
+ </ul>
+ </li>
+ <li>file <a href="root_8h.html" class="m-doc">root.h</a> <span class="m-doc">Root file.</span></li>
+ </ul>
+ </li>
+ </ul>
+ <script>
+ function toggle(e) {
+ e.parentElement.className = e.parentElement.className == 'm-doc-collapsible' ?
+ 'm-doc-expansible' : 'm-doc-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-doc-expansible';
+ </script>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
--- /dev/null
+/** @file
+ * @brief Subdirectory file
+ */
--- /dev/null
+/* Sources for the test in ../compound_no_full_path_names, needs to be in a
+ directory outside of the Doxyfile to trigger the behavior */
+
+/** @dir project
+ * @brief Root directory
+ */
+
+/** @dir project/directory
+ * @brief Subdirectory
+ */
+
+/** @file
+ * @brief Root file
+ */
self.assertEqual(*self.actual_expected_contents('File_8h.html'))
self.assertEqual(*self.actual_expected_contents('annotated.html'))
self.assertEqual(*self.actual_expected_contents('namespaces.html'))
+
+class NoFullPathNames(IntegrationTestCase):
+ def __init__(self, *args, **kwargs):
+ Listing.__init__(self, *args, doxyfile='doc/Doxyfile', **kwargs)
+
+ def test(self):
+ with self.assertLogs() as cm:
+ self.run_doxygen(wildcard='*.xml')
+
+ self.assertEqual(*self.actual_expected_contents('files.html'))
+ self.assertEqual(cm.output, [
+ "WARNING:root:potential issue: the parent of directory/ is project/ which is not a prefix, you may want to enable FULL_PATH_NAMES together with STRIP_FROM_PATH and STRIP_FROM_INC_PATH to preserve filesystem hierarchy"
+ ])