mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-07-28 04:07:46 +00:00
doc/common/requirements: Fix image paths.
This ensures that the requirements directive works regardless of the depth of the document in the tree.
This commit is contained in:
@@ -57,13 +57,21 @@ class PybricksRequirementsStaticDirective(Directive):
|
||||
# Cell with image of a hub.
|
||||
hub_cell = """
|
||||
<th><div class="align-default">
|
||||
<img alt="" src="../_images/compat_{0}_{1}_label.png">
|
||||
<img alt="" src="{0}_images/compat_{1}_{2}_label.png">
|
||||
</div></th>
|
||||
"""
|
||||
|
||||
# Determine how far up the tree we are to set correct image path.
|
||||
current_document = env.docname
|
||||
depth = len(current_document.split("/")) - 1
|
||||
depth_path = "../" * depth
|
||||
|
||||
# Table row with hub images.
|
||||
compat_row = "".join([
|
||||
hub_cell.format(hub, "true" if requirements <= features else "false")
|
||||
hub_cell.format(
|
||||
depth_path,
|
||||
hub,
|
||||
"true" if requirements <= features else "false")
|
||||
for hub, features in HUB_FEATURES.items()
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user