chiark / gitweb /
m.gl: ability to link to WebGL extensions.
authorVladimír Vondruš <mosra@centrum.cz>
Thu, 18 Jan 2018 12:10:29 +0000 (13:10 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Thu, 18 Jan 2018 12:10:29 +0000 (13:10 +0100)
doc/plugins/links.rst
pelican-plugins/m/gl.py
pelican-plugins/m/test/gl/page.html
pelican-plugins/m/test/gl/page.rst

index 4b22139d47957171dcb78ce0a0eead6bb61efd19..f39d128577745cfa86f4f8a48f72e53baea2e79d 100644 (file)
@@ -110,14 +110,16 @@ including the ``m/`` directory into one of your :py:`PLUGIN_PATHS` and add
     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::
 
@@ -125,11 +127,13 @@ possible to specify alternate link text using the well-known syntax.
 
         -   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>`
 
index bb36dab83840430605010d507c53e510c669f3ea..7ef8071a61f6995e352bc5642292cb95e7a94ef9 100644 (file)
@@ -34,6 +34,13 @@ def glext(name, rawtext, text, lineno, inliner, options={}, content=[]):
     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)
@@ -50,5 +57,6 @@ def glfnext(name, rawtext, text, lineno, inliner, options={}, content=[]):
 
 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)
index 9ae1fd4e5d020314f6515eb65f9d3b37a9effbc6..9676821cc1ea8a84b8cbc65da1bef47a0dfef713 100644 (file)
@@ -26,6 +26,7 @@
 <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>
index 3ec3f93ea2dc840ecfde0ad93bc61025d39804a4..efe36130292c620f1a6cff44c0db8c332dfb10e6 100644 (file)
@@ -3,5 +3,6 @@ m.gl
 
 -   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>`