Qiskit / documentation

The documentation content home for https://docs.quantum.ibm.com.
https://docs.quantum.ibm.com
Apache License 2.0
38 stars 81 forks source link

[WIP] Add missing attribute headers for API docs #2340

Closed arnaucasau closed 3 days ago

arnaucasau commented 3 days ago

This is a work in progress

This PR adds missing attribute headers for some versions of Qiskit. To decide if an attribute was on a dedicated page and therefore didn't need a header, the code was checking if the id existed and if the priorApiType wasn't defined. The absence of a priorApiType in an attribute could be seen as indicative of the attribute not being in a class page, but it's not enough to check if that page is dedicated to just one attribute or if there are more.

To solve this, the PR changes the conditional to check if the page heading matches the id of the attribute as we are already doing for the functions' component. I've checked the correctness by running npm run regen-apis and the only changes found are the missing attribute headers for qiskit 0.44.0, 0.45.3, 0.45.3, and 1.0.2.

The list of commits shows the first regeneration of the APIs without making any change to the code (it updates the object.inv and the transpiler version), and a later regeneration after the code changes (commit: 22ad01d6386eb05afaee37c98a4d31bc99e9a604)

Furthermore, I tested with the MPF docs, and it solves the issue with the missing attribute:

-<Attribute id="qiskit_addon_mpf.backends.HAS_QUIMB" isDedicatedPage={true}>
+### HAS\_QUIMB
+
+<Attribute id="qiskit_addon_mpf.backends.HAS_QUIMB">

Part of https://github.com/Qiskit/documentation/issues/2331