There seems to be a few ways to do this, but I couldn't find a simple one. Advise and tips are appreciated.
The reference nodes are created in this fashion:
node = nodes.reference(rawtext, utils.unescape(text),
internal=False,
refuri=ref,
classes=['foocss'],
rel='bar',
**options)However, the rel='bar' attribute gets stripped out from the final HTML markup (note: it make is fine into the starttag). Hunting through the source got me to sphinx/writers/html.py and the HTMLTranslator class. Here is part of the visit_reference method:
# overwritten
def visit_reference(self, node):
atts = {'class': 'reference'}
<snip>
if 'reftitle' in node:
atts['title'] = node['reftitle']
self.body.append(self.starttag(node, 'a', '', **atts))Additional attributes are not handled. Maybe they could be replaced in others parts. I couldn't find anything useful in that respect.
So, I could:
I'm sure I'm missing the obvious and elegant solution.