strip_candidates = list(filter(bool, map(lambda x: remove_path_prefix(path, x), prefixes)))
return min(strip_candidates, key=len) if strip_candidates else path
-def make_include(state: State, file, include_str=None) -> Tuple[str, str]:
- if include_str is None:
- include_str = make_include_strip_from_path(file, state.doxyfile['STRIP_FROM_INC_PATH']) if state.doxyfile['STRIP_FROM_INC_PATH'] is not None else file
-
+def make_include(state: State, file) -> Tuple[str, str]:
if file in state.includes and state.compounds[state.includes[file]].has_details:
- return (html.escape('<{}>'.format(include_str)), state.compounds[state.includes[file]].url)
+ return (html.escape('<{}>'.format(make_include_strip_from_path(file, state.doxyfile['STRIP_FROM_INC_PATH']) if state.doxyfile['STRIP_FROM_INC_PATH'] is not None else file)), state.compounds[state.includes[file]].url)
+ return None
+
+# Used only from a single place but put here to ensure it's kept consistent
+# with make_include() above, in particular the checks
+def make_class_include(state: State, file_id, name) -> Tuple[str, str]:
+ # state.includes is a map from a filename to file ID, and since we already
+ # have a file ID we don't need to use it. But if it's empty, it means
+ # includes are disabled globally, in which case we shouldn't return
+ # anything.
+ if state.includes and state.compounds[file_id].has_details:
+ return (html.escape('<{}>'.format(name)), state.compounds[file_id].url)
return None
def parse_id_and_include(state: State, element: ET.Element) -> Tuple[str, str, str, Tuple[str, str], bool]:
compound.is_final = compounddef.attrib.get('final') == 'yes'
# Decide about the include file for this compound. Classes get it always,
- # namespaces without any members too.
+ # namespaces without any class / group members too.
state.current_kind = compound.kind
if compound.kind in ['struct', 'class', 'union'] or (compound.kind == 'namespace' and compounddef.find('innerclass') is None and compounddef.find('innernamespace') is None and compounddef.find('sectiondef') is None):
location_attribs = compounddef.find('location').attrib
file = location_attribs['declfile'] if 'declfile' in location_attribs else location_attribs['file']
- include_str = compounddef.find('includes').text if compounddef.find('includes') is not None else file
- compound.include = make_include(state, file, include_str)
+
+ # Classes, structs and unions allow supplying custom header file and a
+ # custom include name, which *seems* to be present in the first
+ # <includes> element of given compound. If that's the case, we use the
+ # provided ID as the include link target and the name as the include
+ # name. Otherwise the information is extracted from the <location> tag.
+ # See test_compound.IncludesStripFromPath for a test case.
+ compound_includes = compounddef.find('includes')
+ if compound.kind in ['struct', 'class', 'union'] and compound_includes is not None:
+ compound.include = make_class_include(state, compound_includes.attrib['refid'], compound_includes.text)
+ else:
+ compound.include = make_include(state, file)
# Save include for current compound. Every enum/var/function/... parser
# checks against it and resets to None in case the include differs for
# given entry, meaning all entries need to have their own include
# definition instead. That's then finally reflected in has_details of
# each entry.
+ #
+ # If the class overrode the include location to something else above,
+ # we *still* use the actual file from <location>, as otherwise an
+ # include would get listed redundantly for all class members.
state.current_include = file
# Namespaces with members get a placeholder that gets filled from the
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>include/Library/Data.h file | 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 class="m-col-t-4 m-hide-m m-text-right m-nopadr">
+ <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
+ <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
+ </div>
+ <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
+ <div class="m-row">
+ <ol class="m-col-t-6 m-col-m-none">
+ </ol>
+ <ol class="m-col-t-6 m-col-m-none" start="1">
+ <li><a href="files.html">Files</a></li>
+ </ol>
+ </div>
+ </div>
+ </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="dir_d44c64559bbebec7f509842c48db8b23.html">include</a>/</span><span class="m-breadcrumb"><a href="dir_f3b5534f769798fe34f6616e7fe90e4d.html">Library</a>/</span>Data.h <span class="m-thin">file</span>
+ </h1>
+ <p>A library data header.</p>
+ <nav class="m-block m-default">
+ <h3>Contents</h3>
+ <ul>
+ <li>
+ Reference
+ <ul>
+ <li><a href="#namespaces">Namespaces</a></li>
+ <li><a href="#nested-classes">Classes</a></li>
+ </ul>
+ </li>
+ </ul>
+ </nav>
+<p>Should be shown as <code>include/Library/Data.h</code> in the page and also in the file tree, neither of them prefixed with <code>project/</code>. Its contents should then show <code>#include <Library/Data.h></code>, without the <code>project/include/</code> prefix.</p>
+ <section id="namespaces">
+ <h2><a href="#namespaces">Namespaces</a></h2>
+ <dl class="m-doc">
+ <dt>namespace <a href="namespaceLibrary.html" class="m-doc">Library</a></dt>
+ <dd>A library namespace.</dd>
+ <dt>namespace <a href="namespaceLibrary_1_1Helper.html" class="m-doc">Library::Helper</a></dt>
+ <dd>A helper subnamespace.</dd>
+ </dl>
+ </section>
+ <section id="nested-classes">
+ <h2><a href="#nested-classes">Classes</a></h2>
+ <dl class="m-doc">
+ <dt>
+ struct <a href="structLibrary_1_1Struct.html" class="m-doc">Library::Struct</a>
+ </dt>
+ <dd>A library structure.</dd>
+ <dt>
+ class <a href="classLibrary_1_1Class.html" class="m-doc">Library::Class</a>
+ </dt>
+ <dd>A class with overriden header file and name.</dd>
+ </dl>
+ </section>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
--- /dev/null
+INPUT = input.dox project/examples/example.cpp project/include/Library/Library.h project/include/Library/Data.h
+AUTOLINK_SUPPORT = NO
+QUIET = YES
+GENERATE_HTML = NO
+GENERATE_LATEX = NO
+GENERATE_XML = YES
+XML_PROGRAMLISTING = NO
+CASE_SENSE_NAMES = YES
+
+# These are what makes the test actually work. The first entries don't exist
+# and should be ignored.
+STRIP_FROM_PATH = nonexistent/path/ project/ project/examples/
+STRIP_FROM_INC_PATH = examples/nonexistentpath/ project/include
+
+##! M_PAGE_FINE_PRINT =
+##! M_THEME_COLOR =
+##! M_FAVICON =
+##! M_LINKS_NAVBAR1 =
+##! M_LINKS_NAVBAR2 = files
+##! M_SEARCH_DISABLED = YES
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>include/Library/Library.h file | 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 class="m-col-t-4 m-hide-m m-text-right m-nopadr">
+ <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
+ <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
+ </div>
+ <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
+ <div class="m-row">
+ <ol class="m-col-t-6 m-col-m-none">
+ </ol>
+ <ol class="m-col-t-6 m-col-m-none" start="1">
+ <li><a href="files.html">Files</a></li>
+ </ol>
+ </div>
+ </div>
+ </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="dir_d44c64559bbebec7f509842c48db8b23.html">include</a>/</span><span class="m-breadcrumb"><a href="dir_f3b5534f769798fe34f6616e7fe90e4d.html">Library</a>/</span>Library.h <span class="m-thin">file</span>
+ </h1>
+ <p>A library header.</p>
+ <nav class="m-block m-default">
+ <h3>Contents</h3>
+ <ul>
+ <li>
+ Reference
+ <ul>
+ <li><a href="#namespaces">Namespaces</a></li>
+ </ul>
+ </li>
+ </ul>
+ </nav>
+<p>Should be shown as <code>include/Library/Library.h</code> in the page and also in the file tree, neither of them prefixed with <code>project/</code>. Its contents should then show <code>#include <Library/Library.h></code>, without the <code>project/include/</code> prefix.</p>
+ <section id="namespaces">
+ <h2><a href="#namespaces">Namespaces</a></h2>
+ <dl class="m-doc">
+ <dt>namespace <a href="namespaceLibrary.html" class="m-doc">Library</a></dt>
+ <dd>A library namespace.</dd>
+ </dl>
+ </section>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>Library::Class 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+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 class="m-col-t-4 m-hide-m m-text-right m-nopadr">
+ <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
+ <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
+ </div>
+ <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
+ <div class="m-row">
+ <ol class="m-col-t-6 m-col-m-none">
+ </ol>
+ <ol class="m-col-t-6 m-col-m-none" start="1">
+ <li><a href="files.html">Files</a></li>
+ </ol>
+ </div>
+ </div>
+ </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="namespaceLibrary.html">Library</a>::<wbr/></span>Class <span class="m-thin">class</span>
+ <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="Library_8h.html"><FakeHeader.h></a></div>
+ </h1>
+ <p>A class with overriden header file and name.</p>
+ <nav class="m-block m-default">
+ <h3>Contents</h3>
+ <ul>
+ <li>
+ Reference
+ <ul>
+ <li><a href="#pub-methods">Public functions</a></li>
+ <li><a href="#related">Related</a></li>
+ </ul>
+ </li>
+ </ul>
+ </nav>
+<p>The overriden header <em>file</em> is used as the target location (where it links to the <code>Library.h</code> file, <em>not</em> to <code>Data.h</code> in which it's defined), the header <em>name</em> is what gets displayed.</p>
+ <section id="pub-methods">
+ <h2><a href="#pub-methods">Public functions</a></h2>
+ <dl class="m-doc">
+ <dt>
+ <span class="m-doc-wrap-bumper">void <a href="#af6424222f8f9bed68426d47cd0745f66" class="m-doc">foo</a>(</span><span class="m-doc-wrap">)</span>
+ </dt>
+ <dd>Class function.</dd>
+ </dl>
+ </section>
+ <section id="related">
+ <h2><a href="#related">Related</a></h2>
+ <dl class="m-doc">
+ <dt>
+ <span class="m-doc-wrap-bumper">void <a href="#a9a4020432dcbac8c7e116306a28cc3d4" class="m-doc">related</a>(</span><span class="m-doc-wrap">)</span>
+ </dt>
+ <dd>A related function.</dd>
+ </dl>
+ </section>
+ <section>
+ <h2>Function documentation</h2>
+ <section class="m-doc-details" id="af6424222f8f9bed68426d47cd0745f66"><div>
+ <h3>
+ <span class="m-doc-wrap-bumper">void Library::<wbr />Class::<wbr /></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#af6424222f8f9bed68426d47cd0745f66" class="m-doc-self">foo</a>(</span><span class="m-doc-wrap">)</span></span>
+ </h3>
+ <p>Class function.</p>
+<p>The class has the location overriden to <code>Library.h</code> and thus location for the function (which is in <code>Data.h</code> and can't be overriden) doesn't match the class. Showing a different include for it won't make sense tho as it's a member, so the code pretends the current include matches the actual location and not what was overriden.</p>
+ </div></section>
+ <section class="m-doc-details" id="a9a4020432dcbac8c7e116306a28cc3d4"><div>
+ <h3>
+ <span class="m-doc-wrap-bumper">void </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#a9a4020432dcbac8c7e116306a28cc3d4" class="m-doc-self">related</a>(</span><span class="m-doc-wrap">)</span></span>
+ <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="Library_8h.html"><Library/Library.h></a></div>
+ </h3>
+ <p>A related function.</p>
+<p>This function is related to the class, but is in a different header, so it should have <code>#include <Library/Library.h></code> even though the class has overriden the header file (but not name) to point to <code>Library.h</code>. The code still treats <code>Data.h</code> as the actual class definiton because otherwise all class members would list redundant <code>#include</code> in its detailed docs.</p>
+ </div></section>
+ </section>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>include/ directory | 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 class="m-col-t-4 m-hide-m m-text-right m-nopadr">
+ <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
+ <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
+ </div>
+ <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
+ <div class="m-row">
+ <ol class="m-col-t-6 m-col-m-none">
+ </ol>
+ <ol class="m-col-t-6 m-col-m-none" start="1">
+ <li><a href="files.html">Files</a></li>
+ </ol>
+ </div>
+ </div>
+ </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>
+ include<span class="m-breadcrumb">/</span> <span class="m-thin">directory</span>
+ </h1>
+ <p>A top-level include directory.</p>
+ <nav class="m-block m-default">
+ <h3>Contents</h3>
+ <ul>
+ <li>
+ Reference
+ <ul>
+ <li><a href="#subdirs">Directories</a></li>
+ </ul>
+ </li>
+ </ul>
+ </nav>
+<p>Should be shown only as <code>include/</code>. The file tree also shouldn't list the top-level <code>project/</code> directory.</p>
+ <section id="subdirs">
+ <h2><a href="#subdirs">Directories</a></h2>
+ <dl class="m-doc">
+ <dt>directory <a href="dir_f3b5534f769798fe34f6616e7fe90e4d.html" class="m-doc">Library</a>/</dt>
+ <dd>A library include directory.</dd>
+ </dl>
+ </section>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>include/Library/ directory | 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 class="m-col-t-4 m-hide-m m-text-right m-nopadr">
+ <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
+ <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
+ </div>
+ <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
+ <div class="m-row">
+ <ol class="m-col-t-6 m-col-m-none">
+ </ol>
+ <ol class="m-col-t-6 m-col-m-none" start="1">
+ <li><a href="files.html">Files</a></li>
+ </ol>
+ </div>
+ </div>
+ </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="dir_d44c64559bbebec7f509842c48db8b23.html">include</a>/</span>Library<span class="m-breadcrumb">/</span> <span class="m-thin">directory</span>
+ </h1>
+ <p>A library include directory.</p>
+ <nav class="m-block m-default">
+ <h3>Contents</h3>
+ <ul>
+ <li>
+ Reference
+ <ul>
+ <li><a href="#files">Files</a></li>
+ </ul>
+ </li>
+ </ul>
+ </nav>
+<p>Should be shown only only as <code>include/Library/</code>. The file tree also shouldn't list the top-level <code>project/</code> directory.</p>
+ <section id="files">
+ <h2><a href="#files">Files</a></h2>
+ <dl class="m-doc">
+ <dt>file <a href="Data_8h.html" class="m-doc">Data.h</a></dt>
+ <dd>A library data header.</dd>
+ <dt>file <a href="Library_8h.html" class="m-doc">Library.h</a></dt>
+ <dd>A library header.</dd>
+ </dl>
+ </section>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>example.cpp file | 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 class="m-col-t-4 m-hide-m m-text-right m-nopadr">
+ <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
+ <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
+ </div>
+ <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
+ <div class="m-row">
+ <ol class="m-col-t-6 m-col-m-none">
+ </ol>
+ <ol class="m-col-t-6 m-col-m-none" start="1">
+ <li><a href="files.html">Files</a></li>
+ </ol>
+ </div>
+ </div>
+ </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>
+ example.cpp <span class="m-thin">file</span>
+ </h1>
+ <p>An example file.</p>
+ <nav class="m-block m-default">
+ <h3>Contents</h3>
+ <ul>
+ <li>
+ Reference
+ <ul>
+ <li><a href="#func-members">Functions</a></li>
+ </ul>
+ </li>
+ </ul>
+ </nav>
+<p>The file tree should list this file in the root, w/o <code>project/examples/</code>.</p>
+ <section id="func-members">
+ <h2><a href="#func-members">Functions</a></h2>
+ <dl class="m-doc">
+ <dt id="ae66f6b31b5ad750f1fe042a706a4e3d4">
+ <span class="m-doc-wrap-bumper">auto <a href="#ae66f6b31b5ad750f1fe042a706a4e3d4" class="m-doc-self">main</a>(</span><span class="m-doc-wrap">) -> int</span>
+ </dt>
+ <dd>An example function.</dd>
+ </dl>
+ </section>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
--- /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 class="m-col-t-4 m-hide-m m-text-right m-nopadr">
+ <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
+ <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
+ </div>
+ <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
+ <div class="m-row">
+ <ol class="m-col-t-6 m-col-m-none">
+ </ol>
+ <ol class="m-col-t-6 m-col-m-none" start="1">
+ <li><a href="files.html" id="m-navbar-current">Files</a></li>
+ </ol>
+ </div>
+ </div>
+ </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_d44c64559bbebec7f509842c48db8b23.html" class="m-doc">include</a> <span class="m-doc">A top-level include directory.</span>
+ <ul class="m-doc">
+ <li class="m-doc-collapsible collapsed">
+ <a href="#" onclick="return toggle(this)">dir</a> <a href="dir_f3b5534f769798fe34f6616e7fe90e4d.html" class="m-doc">Library</a> <span class="m-doc">A library include directory.</span>
+ <ul class="m-doc">
+ <li>file <a href="Data_8h.html" class="m-doc">Data.h</a> <span class="m-doc">A library data header.</span></li>
+ <li>file <a href="Library_8h.html" class="m-doc">Library.h</a> <span class="m-doc">A library header.</span></li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ <li>file <a href="example_8cpp.html" class="m-doc">example.cpp</a> <span class="m-doc">An example file.</span></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
+/* The top-level project/ directory shouldn't be shown anywhere. Also, the
+ `input.dox` which this is generated from shouldn't be shown anywhere, nor it
+ should expand the file tree one level up. */
+
+/** @dir project/include
+ * @brief A top-level include directory
+ *
+ * Should be shown only as `include/`. The file tree also shouldn't list
+ * the top-level `project/` directory.
+ */
+
+/** @dir project/include/Library
+ * @brief A library include directory
+ *
+ * Should be shown only only as `include/Library/`. The file tree also
+ * shouldn't list the top-level `project/` directory.
+ */
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>Library namespace | 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 class="m-col-t-4 m-hide-m m-text-right m-nopadr">
+ <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
+ <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
+ </div>
+ <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
+ <div class="m-row">
+ <ol class="m-col-t-6 m-col-m-none">
+ </ol>
+ <ol class="m-col-t-6 m-col-m-none" start="1">
+ <li><a href="files.html">Files</a></li>
+ </ol>
+ </div>
+ </div>
+ </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>
+ Library <span class="m-thin">namespace</span>
+ </h1>
+ <p>A library namespace.</p>
+ <nav class="m-block m-default">
+ <h3>Contents</h3>
+ <ul>
+ <li>
+ Reference
+ <ul>
+ <li><a href="#namespaces">Namespaces</a></li>
+ <li><a href="#nested-classes">Classes</a></li>
+ <li><a href="#enum-members">Enums</a></li>
+ <li><a href="#typedef-members">Typedefs</a></li>
+ <li><a href="#func-members">Functions</a></li>
+ </ul>
+ </li>
+ </ul>
+ </nav>
+<p>Should have no include listed, as it's spread over multiple files.</p>
+ <section id="namespaces">
+ <h2><a href="#namespaces">Namespaces</a></h2>
+ <dl class="m-doc">
+ <dt>namespace <a href="namespaceLibrary_1_1Helper.html" class="m-doc">Helper</a></dt>
+ <dd>A helper subnamespace.</dd>
+ </dl>
+ </section>
+ <section id="nested-classes">
+ <h2><a href="#nested-classes">Classes</a></h2>
+ <dl class="m-doc">
+ <dt>
+ class <a href="classLibrary_1_1Class.html" class="m-doc">Class</a>
+ </dt>
+ <dd>A class with overriden header file and name.</dd>
+ <dt>
+ struct <a href="structLibrary_1_1Struct.html" class="m-doc">Struct</a>
+ </dt>
+ <dd>A library structure.</dd>
+ </dl>
+ </section>
+ <section id="enum-members">
+ <h2><a href="#enum-members">Enums</a></h2>
+ <dl class="m-doc">
+ <dt>
+ <span class="m-doc-wrap-bumper">enum <a href="#a3911d21c32e60fc1e518deacdb313d76" class="m-doc">Enum</a> { </span><span class="m-doc-wrap"> }</span>
+ </dt>
+ <dd>A library enum.</dd>
+ </dl>
+ </section>
+ <section id="typedef-members">
+ <h2><a href="#typedef-members">Typedefs</a></h2>
+ <dl class="m-doc">
+ <dt>
+ using <a href="#a8b7a7982869861ecdd41eb865f3ed073" class="m-doc">Typedef</a> = <a href="structLibrary_1_1Struct.html" class="m-doc">Struct</a>
+ </dt>
+ <dd>A library typedef.</dd>
+ </dl>
+ </section>
+ <section id="func-members">
+ <h2><a href="#func-members">Functions</a></h2>
+ <dl class="m-doc">
+ <dt>
+ <span class="m-doc-wrap-bumper">void <a href="#ac189f99de34a254da43b7a839c2f1347" class="m-doc">function</a>(</span><span class="m-doc-wrap">)</span>
+ </dt>
+ <dd>A library entrypoint.</dd>
+ </dl>
+ </section>
+ <section>
+ <h2>Enum documentation</h2>
+ <section class="m-doc-details" id="a3911d21c32e60fc1e518deacdb313d76"><div>
+ <h3>
+ enum Library::<wbr /><a href="#a3911d21c32e60fc1e518deacdb313d76" class="m-doc-self">Enum</a>
+ <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="Library_8h.html"><Library/Library.h></a></div>
+ </h3>
+ <p>A library enum.</p>
+<p>Should have <code>#include <Library/Library.h></code> listed, without <code>project/include/</code>.</p>
+ </div></section>
+ </section>
+ <section>
+ <h2>Typedef documentation</h2>
+ <section class="m-doc-details" id="a8b7a7982869861ecdd41eb865f3ed073"><div>
+ <h3>
+ typedef <a href="structLibrary_1_1Struct.html" class="m-doc">Struct</a> Library::<wbr /><a href="#a8b7a7982869861ecdd41eb865f3ed073" class="m-doc-self">Typedef</a>
+ <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="Data_8h.html"><Library/Data.h></a></div>
+ </h3>
+ <p>A library typedef.</p>
+<p>Should have <code>#include <Library/Data.h></code> listed, without <code>project/include/</code>.</p>
+ </div></section>
+ </section>
+ <section>
+ <h2>Function documentation</h2>
+ <section class="m-doc-details" id="ac189f99de34a254da43b7a839c2f1347"><div>
+ <h3>
+ <span class="m-doc-wrap-bumper">void Library::<wbr /></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ac189f99de34a254da43b7a839c2f1347" class="m-doc-self">function</a>(</span><span class="m-doc-wrap">)</span></span>
+ <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="Library_8h.html"><Library/Library.h></a></div>
+ </h3>
+ <p>A library entrypoint.</p>
+<p>Should have <code>#include <Library/Library.h></code> listed, without <code>project/include/</code>.</p>
+ </div></section>
+ </section>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>Library::Helper namespace | 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 class="m-col-t-4 m-hide-m m-text-right m-nopadr">
+ <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
+ <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
+ </div>
+ <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
+ <div class="m-row">
+ <ol class="m-col-t-6 m-col-m-none">
+ </ol>
+ <ol class="m-col-t-6 m-col-m-none" start="1">
+ <li><a href="files.html">Files</a></li>
+ </ol>
+ </div>
+ </div>
+ </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="namespaceLibrary.html">Library</a>::<wbr/></span>Helper <span class="m-thin">namespace</span>
+ <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="Data_8h.html"><Library/Data.h></a></div>
+ </h1>
+ <p>A helper subnamespace.</p>
+ <nav class="m-block m-default">
+ <h3>Contents</h3>
+ <ul>
+ <li>
+ Reference
+ <ul>
+ <li><a href="#func-members">Functions</a></li>
+ </ul>
+ </li>
+ </ul>
+ </nav>
+<p>Should have <code>#include <Library/Data.h></code> listed, without <code>project/include/</code>.</p>
+ <section id="func-members">
+ <h2><a href="#func-members">Functions</a></h2>
+ <dl class="m-doc">
+ <dt>
+ <span class="m-doc-wrap-bumper">auto <a href="#aada6980c006565779ce48bbebed0d4b7" class="m-doc">version</a>(</span><span class="m-doc-wrap">) -> unsigned</span>
+ </dt>
+ <dd>Library version.</dd>
+ </dl>
+ </section>
+ <section>
+ <h2>Function documentation</h2>
+ <section class="m-doc-details" id="aada6980c006565779ce48bbebed0d4b7"><div>
+ <h3>
+ <span class="m-doc-wrap-bumper">unsigned Library::<wbr />Helper::<wbr /></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#aada6980c006565779ce48bbebed0d4b7" class="m-doc-self">version</a>(</span><span class="m-doc-wrap">)</span></span>
+ </h3>
+ <p>Library version.</p>
+<p>Should have no incldue listed, as the namespace is contained in a single file.</p>
+ </div></section>
+ </section>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
--- /dev/null
+/** @file
+ * @brief An example file
+ *
+ * The file tree should list this file in the root, w/o `project/examples/`.
+ */
+
+#include <Library/Data.h>
+#include <Library/Library.h>
+
+/** @brief An example function */
+int main() {}
--- /dev/null
+/** @file
+ * @brief A library data header
+ *
+ * Should be shown as `include/Library/Data.h` in the page and also in the
+ * file tree, neither of them prefixed with `project/`. Its contents should
+ * then show `#include <Library/Data.h>`, without the `project/include/`
+ * prefix.
+ */
+
+namespace Library {
+
+/**
+ * @brief A library structure
+ *
+ * Should have `#include <Library/Data.h>` listed, without `project/include/`.
+ */
+struct Struct {};
+
+class Class {
+ public:
+ /**
+ * @brief Class function
+ *
+ * The class has the location overriden to `Library.h` and thus
+ * location for the function (which is in `Data.h` and can't be
+ * overriden) doesn't match the class. Showing a different include for
+ * it won't make sense tho as it's a member, so the code pretends the
+ * current include matches the actual location and not what was
+ * overriden.
+ */
+ void foo();
+};
+
+/** @class Class project/include/Library/Library.h FakeHeader.h
+ * @brief A class with overriden header file and name
+ *
+ * The overriden header *file* is used as the target location (where it links
+ * to the `Library.h` file, *not* to `Data.h` in which it's defined), the
+ * header *name* is what gets displayed.
+ */
+
+/**
+ * @brief A helper subnamespace
+ *
+ * Should have `#include <Library/Data.h>` listed, without `project/include/`.
+ */
+namespace Helper {
+ /**
+ * @brief Library version
+ *
+ * Should have no incldue listed, as the namespace is contained in a single
+ * file.
+ */
+ unsigned version();
+}
+
+/**
+ * @brief A library typedef
+ *
+ * Should have `#include <Library/Data.h>` listed, without `project/include/`.
+ */
+typedef Struct Typedef;
+
+}
--- /dev/null
+/** @file
+ * @brief A library header
+ *
+ * Should be shown as `include/Library/Library.h` in the page and also in the
+ * file tree, neither of them prefixed with `project/`. Its contents should
+ * then show `#include <Library/Library.h>`, without the `project/include/`
+ * prefix.
+ */
+
+/**
+ * @brief A library namespace
+ *
+ * Should have no include listed, as it's spread over multiple files.
+ */
+namespace Library {
+
+/**
+ * @brief A library entrypoint
+ *
+ * Should have `#include <Library/Library.h>` listed, without
+ * `project/include/`.
+ */
+void function();
+
+/**
+ * @brief A library enum
+ *
+ * Should have `#include <Library/Library.h>` listed, without
+ * `project/include/`.
+ */
+enum Enum {};
+
+/** @related Class
+ * @brief A related function
+ *
+ * This function is related to the class, but is in a different header, so it
+ * should have `#include <Library/Library.h>` even though the class has
+ * overriden the header file (but not name) to point to `Library.h`. The code
+ * still treats `Data.h` as the actual class definiton because otherwise all
+ * class members would list redundant `#include` in its detailed docs.
+ */
+void related();
+
+}
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>Library::Struct struct | 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 class="m-col-t-4 m-hide-m m-text-right m-nopadr">
+ <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
+ <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
+ </div>
+ <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
+ <div class="m-row">
+ <ol class="m-col-t-6 m-col-m-none">
+ </ol>
+ <ol class="m-col-t-6 m-col-m-none" start="1">
+ <li><a href="files.html">Files</a></li>
+ </ol>
+ </div>
+ </div>
+ </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="namespaceLibrary.html">Library</a>::<wbr/></span>Struct <span class="m-thin">struct</span>
+ <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="Data_8h.html"><Library/Data.h></a></div>
+ </h1>
+ <p>A library structure.</p>
+<p>Should have <code>#include <Library/Data.h></code> listed, without <code>project/include/</code>.</p>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
self.assertEqual(*self.actual_expected_contents('group__group.html'))
self.assertEqual(*self.actual_expected_contents('structSpreadClass.html'))
+class IncludesStripFromPath(IntegrationTestCase):
+ def test(self):
+ self.run_doxygen(wildcard='*.xml')
+
+ # Directories and files should not be prefixed with project/
+ self.assertEqual(*self.actual_expected_contents('dir_d44c64559bbebec7f509842c48db8b23.html'))
+ self.assertEqual(*self.actual_expected_contents('dir_f3b5534f769798fe34f6616e7fe90e4d.html'))
+ self.assertEqual(*self.actual_expected_contents('Data_8h.html'))
+ self.assertEqual(*self.actual_expected_contents('Library_8h.html'))
+ self.assertEqual(*self.actual_expected_contents('example_8cpp.html'))
+
+ # Namespaces and classes should show the correct #include not prefixed
+ # with project/includes/
+ self.assertEqual(*self.actual_expected_contents('namespaceLibrary.html'))
+ self.assertEqual(*self.actual_expected_contents('namespaceLibrary_1_1Helper.html'))
+ self.assertEqual(*self.actual_expected_contents('classLibrary_1_1Class.html'))
+ self.assertEqual(*self.actual_expected_contents('structLibrary_1_1Struct.html'))
+
+ # The file tree should show the two dirs and three files with correct
+ # nesting and again without the project/ prefix
+ self.assertEqual(*self.actual_expected_contents('files.html'))
+
class IncludesUndocumentedFiles(IntegrationTestCase):
def test(self):
self.run_doxygen(wildcard='*.xml')