# 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 = compound.id + '.html'
+ # Compound URL is ID, except for index page
+ compound.url = (compounddef.find('compoundname').text if compound.kind == 'page' else compound.id) + '.html'
compound.brief = parse_desc(state, compounddef.find('briefdescription'))
# Groups are explicitly created so they *have details*, other things need
# to have at least some documentation
top_level_files += [entry]
else:
assert compound.kind == 'page'
- # Ignore index page in page listing
- if entry.id == 'indexpage': continue
- top_level_pages += [entry]
+ # Ignore index page in page listing, add it later only if it
+ # has children
+ if entry.id != 'indexpage': top_level_pages += [entry]
# Otherwise put it into orphan map
else:
for parent, children in orphans.items():
if parent in entries: entries[parent].children += children
+ # Add the index page if it has children
+ if 'indexpage' in entries and entries['indexpage'].children:
+ parsed.index.pages = [entries['indexpage']] + parsed.index.pages
+
return parsed
def parse_doxyfile(state: State, doxyfile, config = None):
--- /dev/null
+INPUT = input.dox
+QUIET = YES
+GENERATE_HTML = NO
+GENERATE_LATEX = NO
+GENERATE_XML = YES
+
+M_PAGE_FINE_PRINT =
+M_THEME_COLOR =
+M_LINKS_NAVBAR1 =
+M_LINKS_NAVBAR2 =
+M_SEARCH_DISABLED = YES
--- /dev/null
+/** @mainpage
+
+- @subpage page
+*/
+
+/** @page page A page
+
+A page
+*/
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>My Project » A 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-9 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> »</span>
+ A page
+ </h1>
+<p>A page</p>
+ </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+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-9 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="page.html" class="m-dox">A 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>
def test(self):
self.run_dox2html5(wildcard='untitled.xml')
self.assertEqual(*self.actual_expected_contents('untitled.html'))
+
+class SubpageOfIndex(IntegrationTestCase):
+ def __init__(self, *args, **kwargs):
+ super().__init__(__file__, 'subpage_of_index', *args, **kwargs)
+
+ def test(self):
+ self.run_dox2html5(wildcard='*.xml')
+ self.assertEqual(*self.actual_expected_contents('page.html'))
+ self.assertEqual(*self.actual_expected_contents('pages.html'))