docs: implement new vk-feat role

This makes it easy to link to a specific Vulkan feature from the docs.
Useful for the Zink docs.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21813>
This commit is contained in:
Erik Faye-Lund 2023-03-09 14:22:11 +01:00 committed by Marge Bot
parent 9d42e31b54
commit 923a41ac99
1 changed files with 10 additions and 0 deletions

View File

@ -33,7 +33,17 @@ def ext_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
pnode = nodes.reference(title, title, internal=False, refuri=full_url)
return [pnode], []
def vkfeat_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
text = utils.unescape(text)
has_explicit_title, title, ext = split_explicit_title(text)
full_url = f'https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#features-{ext}'
pnode = nodes.reference(title, title, internal=False, refuri=full_url)
return [pnode], []
def setup(app):
app.add_object_type("opcode", "opcode", "%s (TGSI opcode)",
parse_opcode)
app.add_role('ext', ext_role)
app.add_role('vk-feat', vkfeat_role)