- :gh:`m.gh <mosra/m.css$master/pelican-plugins/m/gh.py>`,
:gh:`m.dox <mosra/m.css$master/pelican-plugins/m/dox.py>`,
:gh:`m.gl <mosra/m.css$master/pelican-plugins/m/gl.py>`,
+ :gh:`m.vk <mosra/m.css$master/pelican-plugins/m/vk.py>`,
:gh:`m.abbr <mosra/m.css$master/pelican-plugins/m/abbr.py>`,
:gh:`m.filesize <mosra/m.css$master/pelican-plugins/m/filesize.py>`,
:gh:`m.alias <mosra/m.css$master/pelican-plugins/m/alias.py>`
`Links and other » <{filename}/plugins/links.rst>`_
===================================================
-The :py:`m.gh`, :py:`m.dox`, :py:`m.gl`, :py:`m.abbr`, :py:`m.fiilesize` and
-:py:`m.alias` plugins make it easy for you to link to GitHub projects, issues
-or PRs, to Doxygen documentation, query file sizes and provide URL aliases to
-preserve link compatibility.
+The :py:`m.gh`, :py:`m.dox`, :py:`m.gl`, :py:`m.vk`, :py:`m.abbr`,
+:py:`m.fiilesize` and :py:`m.alias` plugins make it easy for you to link to
+GitHub projects, issues or PRs, to Doxygen documentation, query file sizes and
+provide URL aliases to preserve link compatibility.
`Metadata » <{filename}/plugins/metadata.rst>`_
===============================================
- Extension function link: :glfnext:`SpecializeShader <ARB_gl_spirv>`
- :glfn:`Custom link title <DrawElementsIndirect>`
+`Vulkan functions and extensions`_
+==================================
+
+Download the `m/vk.py <{filename}/plugins.rst>`_ file, put it
+including the ``m/`` directory into one of your :py:`PLUGIN_PATHS` and add
+:py:`m.vk` package to your :py:`PLUGINS` in ``pelicanconf.py``:
+
+.. code:: python
+
+ PLUGINS += ['m.vk']
+
+Use the :rst:`:vkfn:` interpreted text role for linking to functions,
+:rst:`:vktype:` for linking to types and :rst:`:vkext:` for linking to
+extensions. In the link target the leading ``vk`` prefix of functions, ``Vk``
+prefix of types and the leading ``VK_`` prefix of extensions is prepended
+automatically.
+
+Link text is equal to full function name including the ``vk`` prefix and
+``()`` for functions, ``Vk`` prefix for types or equal to extension name. It's
+possible to specify alternate link text using the well-known syntax.
+
+.. code-figure::
+
+ .. code:: rst
+
+ - Function link: :vkfn:`CreateInstance`
+ - Type link: :vktype:`InstanceCreateInfo`
+ - Definition link: :vktype:`VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO <StructureType>`
+ - Extension link: :vkext:`KHR_swapchain`
+ - :vkfn:`Custom link title <DestroyInstance>`
+
+ - Function link: :vkfn:`CreateInstance`
+ - Type link: :vktype:`InstanceCreateInfo`
+ - Definition link: :vktype:`VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO <StructureType>`
+ - Extension link: :vkext:`KHR_swapchain`
+ - :vkfn:`Custom link title <DestroyInstance>`
+
`Doxygen documentation`_
========================
from docutils.parsers import rst
# to avoid dependencies, link_regexp and parse_link() is common for m.abbr,
-# m.gh and m.gl
+# m.gh, m.gl and m.vk
link_regexp = re.compile(r'(?P<title>.*) <(?P<link>.+)>')
from docutils.parsers import rst
# to avoid dependencies, link_regexp and parse_link() is common for m.abbr,
-# m.gh and m.gl
+# m.gh, m.gl and m.vk
link_regexp = re.compile(r'(?P<title>.*) <(?P<link>.+)>')
from docutils.parsers import rst
# to avoid dependencies, link_regexp and parse_link() is common for m.abbr,
-# m.gh and m.gl
+# m.gh, m.gl and m.vk
link_regexp = re.compile(r'(?P<title>.*) <(?P<link>.+)>')
--- /dev/null
+#
+# This file is part of m.css.
+#
+# Copyright © 2017, 2018 Vladimír Vondruš <mosra@centrum.cz>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+from m.test import PluginTestCase
+
+class Vk(PluginTestCase):
+ def __init__(self, *args, **kwargs):
+ super().__init__(__file__, '', *args, **kwargs)
+
+ def test(self):
+ self.run_pelican({
+ 'PLUGINS': ['m.htmlsanity', 'm.vk']
+ })
+
+ self.assertEqual(*self.actual_expected_contents('page.html'))
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>m.vk | A Pelican Blog</title>
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
+ <link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="canonical" href="page.html" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+ <div class="m-container">
+ <div class="m-row">
+ <a href="./" id="m-navbar-brand" class="m-col-t-9 m-col-m-none m-left-m">A Pelican Blog</a>
+ </div>
+ </div>
+</nav></header>
+<main>
+<article>
+ <div class="m-container m-container-inflatable">
+ <div class="m-row">
+ <div class="m-col-l-10 m-push-l-1">
+ <h1>m.vk</h1>
+<!-- content -->
+<ul>
+<li>Function link: <a href="https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/vkCreateInstance.html">vkCreateInstance()</a></li>
+<li>Type link: <a href="https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkInstanceCreateInfo.html">VkInstanceCreateInfo</a></li>
+<li>Definition link: <a href="https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkStructureType.html">VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO</a></li>
+<li>Extension link: <a href="https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VK_KHR_swapchain">KHR_swapchain</a></li>
+<li><a href="https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/vkDestroyInstance.html">Custom link title</a></li>
+</ul>
+<!-- /content -->
+ </div>
+ </div>
+ </div>
+</article>
+</main>
+</body>
+</html>
--- /dev/null
+m.vk
+####
+
+- Function link: :vkfn:`CreateInstance`
+- Type link: :vktype:`InstanceCreateInfo`
+- Definition link: :vktype:`VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO <StructureType>`
+- Extension link: :vkext:`KHR_swapchain`
+- :vkfn:`Custom link title <DestroyInstance>`
--- /dev/null
+#
+# This file is part of m.css.
+#
+# Copyright © 2017, 2018 Vladimír Vondruš <mosra@centrum.cz>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+import re
+from docutils import nodes, utils
+from docutils.parsers import rst
+
+# to avoid dependencies, link_regexp and parse_link() is common for m.abbr,
+# m.gh, m.gl and m.vk
+
+link_regexp = re.compile(r'(?P<title>.*) <(?P<link>.+)>')
+
+def parse_link(text):
+ link = utils.unescape(text)
+ m = link_regexp.match(link)
+ if m: return m.group('title', 'link')
+ return None, link
+
+def vkext(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ title, extension = parse_link(text)
+ if not title: title = extension
+ url = "https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VK_{}".format(extension)
+ node = nodes.reference(rawtext, title, refuri=url, **options)
+ return [node], []
+
+def vkfn(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ title, fn = parse_link(text)
+ if not title: title = "vk{}()".format(fn)
+ url = "https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/vk{}.html".format(fn)
+ node = nodes.reference(rawtext, title, refuri=url, **options)
+ return [node], []
+
+def vktype(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ title, fn = parse_link(text)
+ if not title: title = "Vk{}".format(fn)
+ url = "https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/Vk{}.html".format(fn)
+ node = nodes.reference(rawtext, title, refuri=url, **options)
+ return [node], []
+
+def register():
+ rst.roles.register_local_role('vkext', vkext)
+ rst.roles.register_local_role('vkfn', vkfn)
+ rst.roles.register_local_role('vktype', vktype)
'm.images',
'm.math',
'm.metadata',
- 'm.plots']
+ 'm.plots',
+ 'm.vk']
THEME = '../pelican-theme'
THEME_STATIC_DIR = 'static'