Consistency FTW. Yay.
out.parsed = out.parsed.rstrip() + '<br />'
elif i.tag == 'anchor':
- out.parsed += '<a name="{}"></a>'.format(extract_id_hash(state, i))
+ # Doxygen doesn't prefix HTML <a name=""> anchors the same way as
+ # for @anchor (WHO WOULD HAVE THOUGHT, RIGHT), it just fully omits
+ # the prefix. So allow that -- thus we can't just extract_id_hash()
+ id = i.attrib['id']
+ if id[:2] == '_1':
+ id = id[2:]
+ else:
+ assert id.startswith(state.current_definition_url_base)
+ id = id[len(state.current_definition_url_base)+2:]
+ out.parsed += '<a name="{}"></a>'.format(id)
elif i.tag == 'computeroutput':
content = parse_inline_desc(state, i).strip()
--- /dev/null
+INPUT = input.dox
+QUIET = YES
+GENERATE_HTML = NO
+GENERATE_LATEX = NO
+GENERATE_XML = YES
+XML_PROGRAMLISTING = NO
+
+##! M_PAGE_FINE_PRINT =
+##! M_THEME_COLOR =
+##! M_FAVICON =
+##! M_LINKS_NAVBAR1 =
+##! M_LINKS_NAVBAR2 =
+##! M_SEARCH_DISABLED = YES
+
--- /dev/null
+/** @page some-long-page-name A page
+
+<a name="anchor"></a>
+
+Here's a HTML anchor for which Doxygen doesn't produce a prefix like for the
+normal `@anchor` because it's buggy. But we have to parse it nevertheless!
+*/
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>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-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>
+ A page
+ </h1>
+<p><a name="anchor"></a></p><p>Here's a HTML anchor for which Doxygen doesn't produce a prefix like for the normal <code>@anchor</code> because it's buggy. But we have to parse it nevertheless!</p>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
self.assertEqual(*self.actual_expected_contents('namespaceFoo.html'))
self.assertEqual(*self.actual_expected_contents('group__fizzbuzz.html'))
+class AnchorHtmlNoPrefixBug(IntegrationTestCase):
+ def __init__(self, *args, **kwargs):
+ super().__init__(__file__, 'anchor_html_no_prefix_bug', *args, **kwargs)
+
+ def test(self):
+ self.run_dox2html5(wildcard='some-long-page-name.xml')
+ self.assertEqual(*self.actual_expected_contents('some-long-page-name.html'))
+
class UnexpectedSections(IntegrationTestCase):
def __init__(self, *args, **kwargs):
super().__init__(__file__, 'unexpected_sections', *args, **kwargs)