Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate headers for overloaded methods #167

Closed
Tracked by #479
kevinsung opened this issue Oct 13, 2023 · 1 comment · Fixed by #895
Closed
Tracked by #479

Duplicate headers for overloaded methods #167

kevinsung opened this issue Oct 13, 2023 · 1 comment · Fixed by #895
Assignees
Labels
API docs infra 🏗️ UI feedback rendering/layout issues with the user interface

Comments

@kevinsung
Copy link
Collaborator

kevinsung commented Oct 13, 2023

URL to the relevant documentation

https://docs.quantum-computing.ibm.com/api/qiskit/qiskit.circuit.QuantumCircuit

Please describe the UI problem.

For example, look at the right sidebar:
image

Each Example and Notes section should have the most indentation, but they have the least. Also, there are duplicates like if_test that show up with the same indentation.

@kevinsung kevinsung added the UI feedback rendering/layout issues with the user interface label Oct 13, 2023
@Eric-Arellano Eric-Arellano removed their assignment Nov 6, 2023
@Eric-Arellano Eric-Arellano changed the title API Reference has incorrect heading and indentation structure Duplicate headers for overloaded methods Jan 26, 2024
@Eric-Arellano
Copy link
Collaborator

@frankharkins fixed the bad Example headers in #683. But the issue with duplicate headers remains. This is specifically when methods are overloaded, and probably also when functions or exceptions are overloaded; like they have multiple signatures. https://docs.quantum.ibm.com/api/qiskit/qiskit.circuit.QuantumCircuit#if_test is a good example

I renamed the issue title to focus on that problem.

github-merge-queue bot pushed a commit that referenced this issue Feb 27, 2024
Closes #167

The script was creating a title for every `<dt>` tag inside a `<dl>`
tag. This is almost always correct given that we only have a `<dt>` tag
for each method. The problem with overload methods is that we have a
`<dt>` for each `@typing.overload` definition.

For example, the `quantumcircuit.py` file overloads the definition of
for_loop:


https://github.com/Qiskit/qiskit/blob/244940a10c17f1dc3d74e2665a3ae869dc3d7291/qiskit/circuit/quantumcircuit.py#L4862-L4884

This is an example of the HTML generated

```html
<dl class="py method">
    <dt class="sig sig-object py" id="qiskit.circuit.QuantumCircuit.for_loop">
    <span class="sig-name descname"><span class="pre">for_loop</span>

    <dt class="sig sig-object py">
    <span class="sig-name descname"><span class="pre">for_loop</span>
    
    <dd><p>Create a <code class="docutils literal notranslate"><span class="pre">for</span></code> loop on this circuit.</p>
```
To solve the problem this PR adds an extra condition to check whether
the `<dt>` tag has an id or not. Only the first `<dt>` tag will have an
id, so we can use this fact to create only one `<h3>` for each method.
frankharkins pushed a commit to frankharkins/documentation that referenced this issue Jul 22, 2024
Closes Qiskit#167

The script was creating a title for every `<dt>` tag inside a `<dl>`
tag. This is almost always correct given that we only have a `<dt>` tag
for each method. The problem with overload methods is that we have a
`<dt>` for each `@typing.overload` definition.

For example, the `quantumcircuit.py` file overloads the definition of
for_loop:


https://github.com/Qiskit/qiskit/blob/244940a10c17f1dc3d74e2665a3ae869dc3d7291/qiskit/circuit/quantumcircuit.py#L4862-L4884

This is an example of the HTML generated

```html
<dl class="py method">
    <dt class="sig sig-object py" id="qiskit.circuit.QuantumCircuit.for_loop">
    <span class="sig-name descname"><span class="pre">for_loop</span>

    <dt class="sig sig-object py">
    <span class="sig-name descname"><span class="pre">for_loop</span>
    
    <dd><p>Create a <code class="docutils literal notranslate"><span class="pre">for</span></code> loop on this circuit.</p>
```
To solve the problem this PR adds an extra condition to check whether
the `<dt>` tag has an id or not. Only the first `<dt>` tag will have an
id, so we can use this fact to create only one `<h3>` for each method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API docs infra 🏗️ UI feedback rendering/layout issues with the user interface
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants