Adding a title attribute of reference in custom role

Wojciech Muła via Docutils-users <[email protected]> Mon, 23 Dec 2024 16:56:33 +0100
Newsgroups gmane.text.docutils.user
Message-ID <[email protected]>
Hi all!

I'm extending docutils to have shorter link. For example: :enwiki:`Docutils`
expands into '<a href="https://en.wikipedia.org/Docutils>Docutils</a>'.
I do that by using method `reference()`, like this:

def enwiki_link_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
    set_classes(options)
    ref, text = wikilink(text, 'en') # implementation detail
    return [nodes.reference(rawtext, nodes.unescape(text), refuri=ref, **options)], []

I want to add a title attribute, like '<a href=".." title="English Wikipedia on Docutils">...</a>'.
Can't figure out how to do this, is it even possible?

Thanks!
I'm not a subscriber, please CC me.

regards
Wojciech