I *knew* something would blow up here.
assert element.tag == 'memberdef' and element.attrib['kind'] == 'define'
define = Empty()
- define.id = extract_id_hash(state, element)
+ # defines are always only defined in files, never duplicated to namespaces,
+ # so we don't need to have define.base_url. Can't use extract_id_hash()
+ # here because current_definition_url_base might be stale. See a test in
+ # compound_namespace_members_in_file_scope_define_base_url.
+ state.current_definition_url_base, _, define.id = parse_id(element)
define.name = element.find('name').text
define.brief = parse_desc(state, element.find('briefdescription'))
define.description, params, define.return_value, search_keywords, define.is_deprecated = parse_define_desc(state, element)
--- /dev/null
+INPUT = File.h
+QUIET = YES
+GENERATE_HTML = NO
+GENERATE_LATEX = NO
+GENERATE_XML = YES
+XML_PROGRAMLISTING = NO
+XML_NAMESPACE_MEMBERS_IN_FILE_SCOPE = YES
+
+##! M_PAGE_FINE_PRINT =
+##! M_THEME_COLOR =
+##! M_FAVICON =
+##! M_LINKS_NAVBAR1 =
+##! M_LINKS_NAVBAR2 =
+##! M_SEARCH_DISABLED = YES
--- /dev/null
+/** @file
+ * @brief A file
+ */
+
+/* Preprocessor defines are usually first in the XML file, but if there is a
+ user-defined group, that is first. That triggers a corder case in define ID
+ extraction -- parsing the var will set current base url to namespaceNS,
+ but that shouldn't trigger any error when parsing the define after. */
+
+/** @brief A namespace */
+namespace NS {
+
+/** @{ @name Variables */
+
+int var; /**< @brief A variable */
+
+/*@}*/
+
+}
+
+/** @brief A define */
+#define A_DEFINE
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>File.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+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>
+ File.h <span class="m-thin">file</span>
+ </h1>
+ <p>A file.</p>
+ <div class="m-block m-default">
+ <h3>Contents</h3>
+ <ul>
+ <li>
+ Reference
+ <ul>
+ <li><a href="#namespaces">Namespaces</a></li>
+ <li><a href="#defines">Defines</a></li>
+ <li><a href="#variables">Variables</a></li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ <section id="namespaces">
+ <h2><a href="#namespaces">Namespaces</a></h2>
+ <dl class="m-dox">
+ <dt>namespace <a href="namespaceNS.html" class="m-dox">NS</a></dt>
+ <dd>A namespace.</dd>
+ </dl>
+ </section>
+ <section id="define-members">
+ <h2><a href="#define-members">Defines</a></h2>
+ <dl class="m-dox">
+ <dt>
+ <span class="m-dox-wrap-bumper">#define <a href="#a144a2a84c08d05de76f6a4a245584810" class="m-dox-self" name="a144a2a84c08d05de76f6a4a245584810">A_DEFINE</a></span>
+ </dt>
+ <dd>A define.</dd>
+ </dl>
+ </section>
+ <section id="variables">
+ <h2><a href="#variables">Variables</a></h2>
+ <dl class="m-dox">
+ <dt>int <a href="namespaceNS.html#a0bd189dc3154c8566a9e70f94b274c33" class="m-dox">var</a></dt>
+ <dd>A variable.</dd>
+ </dl>
+ </section>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
# The file should have just links to detailed docs
self.assertEqual(*self.actual_expected_contents('File_8h.html'))
+class NamespaceMembersInFileScopeDefineBaseUrl(IntegrationTestCase):
+ def __init__(self, *args, **kwargs):
+ super().__init__(__file__, 'namespace_members_in_file_scope_define_base_url', *args, **kwargs)
+
+ @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.14"),
+ "https://github.com/doxygen/doxygen/pull/653")
+ def test(self):
+ self.run_dox2html5(wildcard='File_8h.xml')
+
+ # 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)