PLUGINS += ['m.gl']
Use the :rst:`:glfn:` interpreted text role for linking to functions,
-:rst:`:glext:` for linking to extensions and :rst:`:glfnext:` for linking to
-extension functions. In the link target the leading ``gl`` prefix of functions
-and the leading ``GL_`` prefix of extensions is prepended automatically.
+:rst:`:glext:` for linking to OpenGL / OpenGL ES extensions, :rst:`:webglext:`
+for linking to WebGL extensions and :rst:`:glfnext:` for linking to extension
+functions. In the link target the leading ``gl`` prefix of functions and the
+leading ``GL_`` prefix of extensions is prepended automatically.
Link text is equal to full function name including the ``gl`` prefix and
``()`` for functions, equal to extension name or equal to extension function
-link, including the vendor suffix. For :rst:`:glfn:` and :rst:`:glext:` it's
-possible to specify alternate link text using the well-known syntax.
+link, including the vendor suffix. For :rst:`:glfn:`, :rst:`:glext:` and
+:rst:`:webglext:` it's possible to specify alternate link text using the
+well-known syntax.
.. code-figure::
- Function link: :glfn:`DispatchCompute`
- Extension link: :glext:`ARB_direct_state_access`
+ - WebGL extension link: :webglext:`OES_texture_float`
- Extension function link: :glfnext:`SpecializeShader <ARB_gl_spirv>`
- :glfn:`Custom link title <DrawElementsIndirect>`
- Function link: :glfn:`DispatchCompute`
- Extension link: :glext:`ARB_direct_state_access`
+ - WebGL extension link: :webglext:`OES_texture_float`
- Extension function link: :glfnext:`SpecializeShader <ARB_gl_spirv>`
- :glfn:`Custom link title <DrawElementsIndirect>`
node = nodes.reference(rawtext, title, refuri=url, **options)
return [node], []
+def webglext(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ title, extension = parse_link(text)
+ if not title: title = extension
+ url = "https://www.khronos.org/registry/webgl/extensions/{}/".format(extension)
+ node = nodes.reference(rawtext, title, refuri=url, **options)
+ return [node], []
+
def glfn(name, rawtext, text, lineno, inliner, options={}, content=[]):
title, fn = parse_link(text)
if not title: title = "gl{}()".format(fn)
def register():
rst.roles.register_local_role('glext', glext)
+ rst.roles.register_local_role('webglext', webglext)
rst.roles.register_local_role('glfn', glfn)
rst.roles.register_local_role('glfnext', glfnext)
<ul>
<li>Function link: <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glDispatchCompute.xhtml">glDispatchCompute()</a></li>
<li>Extension link: <a href="https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_direct_state_access.txt">ARB_direct_state_access</a></li>
+<li>WebGL extension link: <a href="https://www.khronos.org/registry/webgl/extensions/OES_texture_float/">OES_texture_float</a></li>
<li>Extension function link: <a href="https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_gl_spirv.txt">glSpecializeShaderARB()</a></li>
<li><a href="https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glDrawElementsIndirect.xhtml">Custom link title</a></li>
</ul>
- Function link: :glfn:`DispatchCompute`
- Extension link: :glext:`ARB_direct_state_access`
+- WebGL extension link: :webglext:`OES_texture_float`
- Extension function link: :glfnext:`SpecializeShader <ARB_gl_spirv>`
- :glfn:`Custom link title <DrawElementsIndirect>`