return (html.escape('<{}>'.format(file)), state.compounds[state.includes[file]].url)
return None
-def parse_id_and_include(state: State, element: ET.Element) -> Tuple[str, str, str, Tuple[str, str]]:
+def parse_id_and_include(state: State, element: ET.Element) -> Tuple[str, str, str, Tuple[str, str], bool]:
# Returns URL base (usually saved to state.current_definition_url_base and
# used by extract_id_hash() later), base URL (with file extension), and the
# actual ID
# Extract the corresponding include, if the current compound is a namespace
# or a module
include = None
+ has_details = False
if state.current_kind in ['namespace', 'group']:
location_attribs = element.find('location').attrib
file = location_attribs['declfile'] if 'declfile' in location_attribs else location_attribs['file']
elif state.current_include and state.current_include != file:
state.current_include = None
- return id[:i], id[:i] + '.html', id[i+2:], include
+ # Extract corresponding include also for class/struct/union "relateds", if
+ # it's different from what the class has. This also forcibly enables
+ # has_details (unlike the case above, where has_details will be enabled
+ # only if all members don't have the same include)
+ if state.current_kind in ['class', 'struct', 'union']:
+ location_attribs = element.find('location').attrib
+ file = location_attribs['declfile'] if 'declfile' in location_attribs else location_attribs['file']
+ if state.current_include != file:
+ include = make_include(state, file)
+ has_details = True
+
+ return id[:i], id[:i] + '.html', id[i+2:], include, has_details
def extract_id_hash(state: State, element: ET.Element) -> str:
# Can't use parse_id() here as sections with _1 in it have it verbatim
assert element.tag == 'memberdef' and element.attrib['kind'] == 'enum'
enum = Empty()
- state.current_definition_url_base, enum.base_url, enum.id, enum.include = parse_id_and_include(state, element)
+ state.current_definition_url_base, enum.base_url, enum.id, enum.include, enum.has_details = parse_id_and_include(state, element)
enum.type = parse_type(state, element.find('type'))
enum.name = element.find('name').text
if enum.name.startswith('@'): enum.name = '(anonymous)'
state.search += [result]
enum.values += [value]
- enum.has_details = enum.base_url == state.current_compound_url and (enum.description or enum.has_value_details)
+ if enum.base_url == state.current_compound_url and (enum.description or enum.has_value_details):
+ enum.has_details = True # has_details might already be True from above
if enum.brief or enum.has_details or enum.has_value_details:
if enum.base_url == state.current_compound_url and not state.doxyfile['M_SEARCH_DISABLED']:
result = Empty()
assert element.tag == 'memberdef' and element.attrib['kind'] == 'typedef'
typedef = Empty()
- state.current_definition_url_base, typedef.base_url, typedef.id, typedef.include = parse_id_and_include(state, element)
+ state.current_definition_url_base, typedef.base_url, typedef.id, typedef.include, typedef.has_details = parse_id_and_include(state, element)
typedef.is_using = element.findtext('definition', '').startswith('using')
typedef.type = parse_type(state, element.find('type'))
typedef.args = parse_type(state, element.find('argsstring'))
typedef.is_protected = element.attrib['prot'] == 'protected'
typedef.has_template_details, typedef.templates = parse_template_params(state, element.find('templateparamlist'), templates)
- typedef.has_details = typedef.base_url == state.current_compound_url and (typedef.description or typedef.has_template_details)
+ if typedef.base_url == state.current_compound_url and (typedef.description or typedef.has_template_details):
+ typedef.has_details = True # has_details might already be True from above
if typedef.brief or typedef.has_details:
# Avoid duplicates in search
if typedef.base_url == state.current_compound_url and not state.doxyfile['M_SEARCH_DISABLED']:
assert element.tag == 'memberdef' and element.attrib['kind'] in ['function', 'friend', 'signal', 'slot']
func = Empty()
- state.current_definition_url_base, func.base_url, func.id, func.include = parse_id_and_include(state, element)
+ state.current_definition_url_base, func.base_url, func.id, func.include, func.has_details = parse_id_and_include(state, element)
func.type = parse_type(state, element.find('type'))
func.name = fix_type_spacing(html.escape(element.find('name').text))
func.brief = parse_desc(state, element.find('briefdescription'))
# Some param description got unused
if params: logging.warning("{}: function parameter description doesn't match parameter names: {}".format(state.current, repr(params)))
- func.has_details = func.base_url == state.current_compound_url and (func.description or func.has_template_details or func.has_param_details or func.return_value or func.return_values or func.exceptions)
+ if func.base_url == state.current_compound_url and (func.description or func.has_template_details or func.has_param_details or func.return_value or func.return_values or func.exceptions):
+ func.has_details = True # has_details might already be True from above
if func.brief or func.has_details:
# Avoid duplicates in search
if func.base_url == state.current_compound_url and not state.doxyfile['M_SEARCH_DISABLED']:
assert element.tag == 'memberdef' and element.attrib['kind'] == 'variable'
var = Empty()
- state.current_definition_url_base, var.base_url, var.id, var.include = parse_id_and_include(state, element)
+ state.current_definition_url_base, var.base_url, var.id, var.include, var.has_details = parse_id_and_include(state, element)
var.type = parse_type(state, element.find('type'))
if var.type.startswith('constexpr'):
var.type = var.type[10:]
var.description, templates, search_keywords, var.is_deprecated = parse_var_desc(state, element)
var.has_template_details, var.templates = parse_template_params(state, element.find('templateparamlist'), templates)
- var.has_details = var.base_url == state.current_compound_url and (var.description or var.has_template_details)
+ if var.base_url == state.current_compound_url and (var.description or var.has_template_details):
+ var.has_details = True # has_details might already be True from above
if var.brief or var.has_details:
# Avoid duplicates in search
if var.base_url == state.current_compound_url and not state.doxyfile['M_SEARCH_DISABLED']:
# 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, define.include = parse_id_and_include(state, element)
+ state.current_definition_url_base, _, define.id, define.include, define.has_details = parse_id_and_include(state, 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)
# Some param description got unused
if params: logging.warning("{}: define parameter description doesn't match parameter names: {}".format(state.current, repr(params)))
- define.has_details = define.description or define.return_value
+ if define.description or define.return_value:
+ define.has_details = True # has_details might already be True from above
if define.brief or define.has_details:
if not state.doxyfile['M_SEARCH_DISABLED']:
result = Empty()
Reference
<ul>
<li><a href="#pub-methods">Public functions</a></li>
+ <li><a href="#related">Related</a></li>
</ul>
</li>
</ul>
<dd>No include information for this one (and thus no details)</dd>
</dl>
</section>
+ <section id="related">
+ <h2><a href="#related">Related</a></h2>
+ <dl class="m-dox">
+ <dt>
+ <span class="m-dox-wrap-bumper">enum <a href="#ab66c81fc768958c4185a517d488a89c7" class="m-dox">RelatedEnum</a> { </span><span class="m-dox-wrap"> }</span>
+ </dt>
+ <dd>A related enum in a different file. Shouldn't be shown in namespace docs but it is :(.</dd>
+ <dt>
+ using <a href="#aca8f196c01494bf1dab261745f3693c8" class="m-dox">RelatedInt</a> = int
+ </dt>
+ <dd>A related typedef in a different file.</dd>
+ <dt>
+ const int <a href="#a15e320413819ae46dffcbccbbb542b8c" class="m-dox">RelatedVar</a> <span class="m-label m-flat m-primary">constexpr</span>
+ </dt>
+ <dd>A related variable in a different file.</dd>
+ <dt>
+ <span class="m-dox-wrap-bumper">void <a href="#a8b69414d6ef13f920d3a855bd22362fb" class="m-dox">relatedFunc</a>(</span><span class="m-dox-wrap">)</span>
+ </dt>
+ <dd>A related function in a different file.</dd>
+ <dt>
+ <span class="m-dox-wrap-bumper">#define <a href="#a8887c0b6a87e2438ea90ffe476680da1" class="m-dox">RELATED_DEFINE</a></span>
+ </dt>
+ <dd>A related define in a different file.</dd>
+ </dl>
+ </section>
+ <section>
+ <h2>Enum documentation</h2>
+ <section class="m-dox-details" id="ab66c81fc768958c4185a517d488a89c7"><div>
+ <h3>
+ enum <a href="#ab66c81fc768958c4185a517d488a89c7" class="m-dox-self">RelatedEnum</a>
+ <div class="m-dox-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="Second_8h.html"><Second.h></a></div>
+ </h3>
+ <p>A related enum in a different file. Shouldn't be shown in namespace docs but it is :(.</p>
+ </div></section>
+ </section>
+ <section>
+ <h2>Typedef documentation</h2>
+ <section class="m-dox-details" id="aca8f196c01494bf1dab261745f3693c8"><div>
+ <h3>
+ typedef int <a href="#aca8f196c01494bf1dab261745f3693c8" class="m-dox-self">RelatedInt</a>
+ <div class="m-dox-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="Second_8h.html"><Second.h></a></div>
+ </h3>
+ <p>A related typedef in a different file.</p>
+ </div></section>
+ </section>
+ <section>
+ <h2>Function documentation</h2>
+ <section class="m-dox-details" id="a8b69414d6ef13f920d3a855bd22362fb"><div>
+ <h3>
+ <span class="m-dox-wrap-bumper">void </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a8b69414d6ef13f920d3a855bd22362fb" class="m-dox-self">relatedFunc</a>(</span><span class="m-dox-wrap">)</span></span>
+ <div class="m-dox-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="Second_8h.html"><Second.h></a></div>
+ </h3>
+ <p>A related function in a different file.</p>
+ </div></section>
+ </section>
+ <section>
+ <h2>Variable documentation</h2>
+ <section class="m-dox-details" id="a15e320413819ae46dffcbccbbb542b8c"><div>
+ <h3>
+ const int <a href="#a15e320413819ae46dffcbccbbb542b8c" class="m-dox-self">RelatedVar</a> <span class="m-label m-primary">constexpr</span>
+ <div class="m-dox-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="Second_8h.html"><Second.h></a></div>
+ </h3>
+ <p>A related variable in a different file.</p>
+ </div></section>
+ </section>
+ <section>
+ <h2>Define documentation</h2>
+ <section class="m-dox-details" id="a8887c0b6a87e2438ea90ffe476680da1"><div>
+ <h3>
+ <span class="m-dox-wrap-bumper">#define <a href="#a8887c0b6a87e2438ea90ffe476680da1" class="m-dox-self">RELATED_DEFINE</a></span>
+ <div class="m-dox-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="Second_8h.html"><Second.h></a></div>
+ </h3>
+ <p>A related define in a different file.</p>
+ </div></section>
+ </section>
</div>
</div>
</div>
Reference
<ul>
<li><a href="#pub-methods">Public functions</a></li>
+ <li><a href="#related">Related</a></li>
</ul>
</li>
</ul>
<dd>No include information for this one (and thus no details)</dd>
</dl>
</section>
+ <section id="related">
+ <h2><a href="#related">Related</a></h2>
+ <dl class="m-dox">
+ <dt>
+ <span class="m-dox-wrap-bumper">enum <a href="#ab66c81fc768958c4185a517d488a89c7" class="m-dox">RelatedEnum</a> { </span><span class="m-dox-wrap"> }</span>
+ </dt>
+ <dd>A related enum in a different file. Shouldn't be shown in namespace docs but it is :(.</dd>
+ <dt>
+ using <a href="#aca8f196c01494bf1dab261745f3693c8" class="m-dox">RelatedInt</a> = int
+ </dt>
+ <dd>A related typedef in a different file.</dd>
+ <dt>
+ const int <a href="#a15e320413819ae46dffcbccbbb542b8c" class="m-dox">RelatedVar</a> <span class="m-label m-flat m-primary">constexpr</span>
+ </dt>
+ <dd>A related variable in a different file.</dd>
+ <dt>
+ <span class="m-dox-wrap-bumper">void <a href="#a8b69414d6ef13f920d3a855bd22362fb" class="m-dox">relatedFunc</a>(</span><span class="m-dox-wrap">)</span>
+ </dt>
+ <dd>A related function in a different file.</dd>
+ <dt>
+ <span class="m-dox-wrap-bumper">#define <a href="#a8887c0b6a87e2438ea90ffe476680da1" class="m-dox">RELATED_DEFINE</a></span>
+ </dt>
+ <dd>A related define in a different file.</dd>
+ </dl>
+ </section>
+ <section>
+ <h2>Enum documentation</h2>
+ <section class="m-dox-details" id="ab66c81fc768958c4185a517d488a89c7"><div>
+ <h3>
+ enum <a href="#ab66c81fc768958c4185a517d488a89c7" class="m-dox-self">RelatedEnum</a>
+ </h3>
+ <p>A related enum in a different file. Shouldn't be shown in namespace docs but it is :(.</p>
+ </div></section>
+ </section>
+ <section>
+ <h2>Typedef documentation</h2>
+ <section class="m-dox-details" id="aca8f196c01494bf1dab261745f3693c8"><div>
+ <h3>
+ typedef int <a href="#aca8f196c01494bf1dab261745f3693c8" class="m-dox-self">RelatedInt</a>
+ </h3>
+ <p>A related typedef in a different file.</p>
+ </div></section>
+ </section>
+ <section>
+ <h2>Function documentation</h2>
+ <section class="m-dox-details" id="a8b69414d6ef13f920d3a855bd22362fb"><div>
+ <h3>
+ <span class="m-dox-wrap-bumper">void </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a8b69414d6ef13f920d3a855bd22362fb" class="m-dox-self">relatedFunc</a>(</span><span class="m-dox-wrap">)</span></span>
+ </h3>
+ <p>A related function in a different file.</p>
+ </div></section>
+ </section>
+ <section>
+ <h2>Variable documentation</h2>
+ <section class="m-dox-details" id="a15e320413819ae46dffcbccbbb542b8c"><div>
+ <h3>
+ const int <a href="#a15e320413819ae46dffcbccbbb542b8c" class="m-dox-self">RelatedVar</a> <span class="m-label m-primary">constexpr</span>
+ </h3>
+ <p>A related variable in a different file.</p>
+ </div></section>
+ </section>
+ <section>
+ <h2>Define documentation</h2>
+ <section class="m-dox-details" id="a8887c0b6a87e2438ea90ffe476680da1"><div>
+ <h3>
+ <span class="m-dox-wrap-bumper">#define <a href="#a8887c0b6a87e2438ea90ffe476680da1" class="m-dox-self">RELATED_DEFINE</a></span>
+ </h3>
+ <p>A related define in a different file.</p>
+ </div></section>
+ </section>
</div>
</div>
</div>