-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Furo styling for API pages with methods on class page (Cherry-pic…
…k of #458) (#478) We're planning to switch some Qiskit projects to stop having dedicated HTML pages per method, mostly due to performance concerns. Closes #466. Methods were using `inline-block` rather than `block` when on the classes page, which resulted in a bug when highlighting over the method to show the `#` anchor tag: ![Screenshot 2023-07-07 at 11 25 45 AM](https://github.com/Qiskit/qiskit_sphinx_theme/assets/14852634/004da4c0-3702-4cd7-9601-5baa46a992a7) Instead, we now turn off floating of the `[source]` label because it causes issues on long code signatures: ![Screenshot 2023-07-07 at 3 02 44 PM](https://github.com/Qiskit/qiskit_sphinx_theme/assets/14852634/19c45f5a-8fc7-44f5-a9d8-997b9a0bfa6e) After: ![Screenshot 2023-07-07 at 3 03 08 PM](https://github.com/Qiskit/qiskit_sphinx_theme/assets/14852634/55e865c9-b376-40e0-846d-cfdd4b1efd1a) Even though the `[source]` floating to the right is more "elegant", we have too many long signatures in Qiskit to be worth it. It's safer to turn off the float. This also improves the information hierarchy so that page feels less crowded. Relates to #459: * Use a border-width of 2px for top-level code objects, but otherwise 1 * Increases the font sizes so headings look bigger.
- Loading branch information
1 parent
918f11e
commit 99e0342
Showing
9 changed files
with
62 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 17 additions & 27 deletions
44
example_docs/docs/_templates/autosummary/class_no_inherited_members.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,28 @@ | ||
{# | ||
This is very similar to the default class template, except this one is used | ||
when we don't want to generate any inherited methods. | ||
-#} | ||
{# This is identical to class.rst, except for the filtering in `set wanted_methods`. -#} | ||
|
||
{{ objname | escape | underline }} | ||
|
||
.. currentmodule:: {{ module }} | ||
|
||
.. autoclass:: {{ objname }} | ||
{#- | ||
Avoid having autodoc populate the class with the members we're about to | ||
summarize to avoid duplication. | ||
#} | ||
:no-members: | ||
:show-inheritance: | ||
{# | ||
Methods all get their own separate page, with their names and the first lines | ||
of their docstrings tabulated. | ||
-#} | ||
{% block methods_summary %}{% set wanted_methods = (methods | reject('in', inherited_members) | reject('==', '__init__') | list) %}{% if wanted_methods %} | ||
.. rubric:: Methods Defined Here | ||
|
||
.. autosummary:: | ||
:nosignatures: | ||
:toctree: ../stubs/ | ||
{% for item in wanted_methods %} | ||
~{{ name }}.{{ item }} | ||
{%- endfor %} | ||
{% endif %}{% endblock %} | ||
|
||
{% block attributes_summary %}{% if attributes %} | ||
{% block attributes_summary %} | ||
{% if attributes %} | ||
.. rubric:: Attributes | ||
{# Attributes should all be summarized directly on the same page. -#} | ||
{% for item in attributes %} | ||
{% for item in attributes %} | ||
.. autoattribute:: {{ item }} | ||
{%- endfor %} | ||
{% endif %}{% endblock -%} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock -%} | ||
|
||
{% block methods_summary %} | ||
{% set wanted_methods = (methods | reject('in', inherited_members) | reject('==', '__init__') | list) %} | ||
{% if wanted_methods %} | ||
.. rubric:: Methods | ||
{% for item in wanted_methods %} | ||
.. automethod:: {{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+54.6 KB
(180%)
tests/js/snapshots.test.js-snapshots/api-docs-class-page-1-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.1 KB
(100%)
tests/js/snapshots.test.js-snapshots/api-docs-function-page-1-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-30.3 KB
tests/js/snapshots.test.js-snapshots/api-docs-method-page-1-linux.png
Binary file not shown.
Binary file removed
BIN
-42.4 KB
tests/js/snapshots.test.js-snapshots/api-docs-method-page-2-linux.png
Binary file not shown.
Binary file modified
BIN
-181 Bytes
(100%)
tests/js/snapshots.test.js-snapshots/left-side-bar-renders-correctly-1-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.