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

Add missing attribute headers for API docs #2341

Closed arnaucasau closed 2 days ago

arnaucasau commented 3 days ago

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.

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