Skip to content

Commit

Permalink
doc/common/extensions: Separate checkmark from image.
Browse files Browse the repository at this point in the history
This makes it easier to see when the images are small.

Fixes: pybricks/support#838
  • Loading branch information
laurensvalk committed Dec 9, 2022
1 parent 8bfc2e1 commit d9dfd0e
Show file tree
Hide file tree
Showing 33 changed files with 53 additions and 633 deletions.
4 changes: 2 additions & 2 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ help:
.PHONY: help Makefile

diagrams:
@$(MAKE) -C "$(SOURCEDIR)"/diagram_source clean
@$(MAKE) -C "$(SOURCEDIR)"/diagram_source
@$(MAKE) -C "$(SOURCEDIR)"/diagrams_source clean
@$(MAKE) -C "$(SOURCEDIR)"/diagrams_source

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
Expand Down
19 changes: 9 additions & 10 deletions doc/common/extensions/requirements-static.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,19 @@ def run(self):
makedirs(destdir)

for hub in HUB_FEATURES:
for compat in ("true", "false"):
uri = "compat_{0}_{1}.png".format(hub, compat)
src_uri = path.join(env.app.builder.srcdir, "diagrams", uri)
build_uri = path.join(env.app.builder.outdir, "_images", uri)
copyfile(src_uri, build_uri)
uri = "compat_{0}.png".format(hub)
src_uri = path.join(env.app.builder.srcdir, "diagrams", uri)
build_uri = path.join(env.app.builder.outdir, "_images", uri)
copyfile(src_uri, build_uri)

# Get requirements from sphinx-directive.
requirements = set(self.arguments)

# Cell with image of a hub.
hub_cell = """
<th><div class="align-default">
<img alt="" src="{0}_images/compat_{1}_{2}.png">
</div></th>
<th background="{0}_images/compat_{1}.png" class="requirements-table-th requirements-table-th">
{2}
</th>
"""

# Determine how far up the tree we are to set correct image path.
Expand All @@ -72,7 +71,7 @@ def run(self):
compat_row = "".join(
[
hub_cell.format(
depth_path, hub, "true" if requirements <= features else "false"
depth_path, hub, "" if requirements <= features else ""
)
for hub, features in HUB_FEATURES.items()
]
Expand All @@ -81,7 +80,7 @@ def run(self):
# Generate full table.
html = """
<div class="wy-table-responsive">
<table class="docutils align-default">
<table class="docutils align-default requirements-table">
<tbody>
<tr>
{0}
Expand Down
16 changes: 16 additions & 0 deletions doc/common/extensions/requirements.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,19 @@ SOFTWARE. */
margin-bottom: 0px;
}

.requirements-table {
width: 100%;
}

.requirements-table-th {
background-size:contain;
background-repeat: no-repeat;
text-align: right;
padding: 6px !important;
}

.requirements-table-th:after {
content: '';
display: block;
margin-top: 80%;
}
Binary file added doc/main/diagrams/compat_cityhub.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/main/diagrams/compat_cityhub_false.png
Binary file not shown.
Binary file removed doc/main/diagrams/compat_cityhub_true.png
Binary file not shown.
Binary file added doc/main/diagrams/compat_essentialhub.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/main/diagrams/compat_essentialhub_false.png
Binary file not shown.
Binary file removed doc/main/diagrams/compat_essentialhub_true.png
Binary file not shown.
Binary file added doc/main/diagrams/compat_inventorhub.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/main/diagrams/compat_inventorhub_false.png
Binary file not shown.
Binary file removed doc/main/diagrams/compat_inventorhub_true.png
Binary file not shown.
Binary file added doc/main/diagrams/compat_movehub.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/main/diagrams/compat_movehub_false.png
Binary file not shown.
Binary file removed doc/main/diagrams/compat_movehub_true.png
Binary file not shown.
Binary file added doc/main/diagrams/compat_primehub.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/main/diagrams/compat_primehub_false.png
Binary file not shown.
Binary file removed doc/main/diagrams/compat_primehub_true.png
Binary file not shown.
Binary file added doc/main/diagrams/compat_technichub.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/main/diagrams/compat_technichub_false.png
Binary file not shown.
Binary file removed doc/main/diagrams/compat_technichub_true.png
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 0 additions & 94 deletions doc/main/diagrams_source/compat_cityhub_false.svg

This file was deleted.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 0 additions & 94 deletions doc/main/diagrams_source/compat_essentialhub_false.svg

This file was deleted.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d9dfd0e

Please sign in to comment.