# Linking to pages
if child.attrib['kind'] == 'page':
link = path + child.find('filename').text + '.html'
- symbol_mapping[child.find('name').text] = link
+ symbol_mapping[child.find('name').text] = (child.find('title').text, link)
# Page sections
for section in child.findall('docanchor'):
- symbol_mapping[section.text] = link + '#' + section.text
+ symbol_mapping[section.text] = (section.attrib.get('title', ''), link + '#' + section.text)
# Linking to files
if child.attrib['kind'] == 'file':
link = path + child.find('filename').text + ".html"
- symbol_mapping[child.find('path').text + child.find('name').text] = link
+ symbol_mapping[child.find('path').text + child.find('name').text] = (None, link)
for member in child.findall('member'):
if not 'kind' in member.attrib: continue
# Preprocessor defines and macros
if member.attrib['kind'] == 'define':
- symbol_mapping[member.find('name').text + ('()' if member.find('arglist').text else '')] = link + '#' + member.find('anchor').text
+ symbol_mapping[member.find('name').text + ('()' if member.find('arglist').text else '')] = (None, link + '#' + member.find('anchor').text)
# Linking to namespaces, structs and classes
if child.attrib['kind'] in ['class', 'struct', 'namespace']:
name = child.find('name').text
link = path + child.find('filename').text
- symbol_mapping[name] = link
+ symbol_mapping[name] = (None, link)
for member in child.findall('member'):
if not 'kind' in member.attrib: continue
# Typedefs, constants
if member.attrib['kind'] == 'typedef' or member.attrib['kind'] == 'enumvalue':
- symbol_mapping[name + '::' + member.find('name').text] = link + '#' + member.find('anchor').text
+ symbol_mapping[name + '::' + member.find('name').text] = (None, link + '#' + member.find('anchor').text)
# Functions
if member.attrib['kind'] == 'function':
- symbol_mapping[name + '::' + member.find('name').text + "()"] = link + '#' + member.find('anchor').text
+ symbol_mapping[name + '::' + member.find('name').text + "()"] = (None, link + '#' + member.find('anchor').text)
# Enums with values
if member.attrib['kind'] == 'enumeration':
enumeration = name + '::' + member.find('name').text
- symbol_mapping[enumeration] = link + '#' + member.find('anchor').text
+ symbol_mapping[enumeration] = (None, link + '#' + member.find('anchor').text)
for value in member.findall('enumvalue'):
- symbol_mapping[enumeration + '::' + value.text] = link + '#' + value.attrib['anchor']
+ symbol_mapping[enumeration + '::' + value.text] = (None, link + '#' + value.attrib['anchor'])
def dox(name, rawtext, text, lineno, inliner: Inliner, options={}, content=[]):
title, target = parse_link(text)
- if not title: title = target
for prefix in symbol_prefixes:
if prefix + target in symbol_mapping:
- url = symbol_mapping[prefix + target]
- node = nodes.reference(rawtext, title, refuri=url, **options)
+ link_title, url = symbol_mapping[prefix + target]
+ if title:
+ use_title = title
+ elif link_title:
+ use_title = link_title
+ else:
+ if link_title is not None:
+ logger.warning("Doxygen anchor `{}` has no title, using its ID as link title".format(target))
+
+ use_title = target
+ node = nodes.reference(rawtext, use_title, refuri=url, **options)
return [node], []
# TODO: print file and line
#'Doxygen symbol %s not found' % target, line=lineno)
#prb = inliner.problematic(rawtext, rawtext, msg)
logger.warning('Doxygen symbol `%s` not found, rendering as monospace' % target)
- node = nodes.literal(rawtext, title, **options)
+ node = nodes.literal(rawtext, title if title else target, **options)
return [node], []
def register():