mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 17:14:41 +00:00
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:
@@ -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>' +
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user