doc/common/extensions: Fix classlink.

Allow the link to be different from the name.

This lets us fix the link for the Inventor Hub, which was linking to a non-existent page.
This commit is contained in:
Laurens Valk
2021-11-22 14:49:20 +01:00
parent 1af876ac8f
commit 7d0fe9cb85
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -5,13 +5,15 @@ from docutils.parsers.rst import Directive
class PybricksClasslinkDirective(Directive):
required_arguments = 1
optional_arguments = 1
def run(self):
# Get link name from sphinx-directive
# Get link and name from sphinx-directive
name = self.arguments[0]
link = name if len(self.arguments) == 1 else self.arguments[1]
html = (
'<a href="{0}.html">'.format(name.lower()) +
'<a href="{0}.html">'.format(link.lower()) +
'<dl class="py class">' +
'<dt>' +
'<em class="property">class </em>' +
+1 -1
View File
@@ -38,7 +38,7 @@
:height: 10 em
:target: primehub.html
.. pybricks-classlink:: InventorHub
.. pybricks-classlink:: InventorHub PrimeHub
.. figure:: ../../main/images/inventorhub.png
:height: 10 em