Skip to content

Commit

Permalink
API generation script - Fix loadImages function (#665)
Browse files Browse the repository at this point in the history
The `processHtml.ts` script assumes that we always have an `src`
attribute in the `img` tags, and even though this is true for the latest
API versions, for Qiskit historical versions, we can find cases like the
following example:

**Qiskit v0.41 release_notes.html line 23360**
```html
<div class="animation">
  <img id="_anim_imga6548212aea7457ca5d2f940fabeaea3">
  <div class="anim-controls">
    <input id="_anim_slidera6548212aea7457ca5d2f940fabeaea3" type="range" class="anim-slider"
```

This PR adds an early return to the `loadImage` function to skip the
images without a `src` attribute given that we can't find the image in
the `_images` folder of the GitHub artifact.
  • Loading branch information
arnaucasau authored Jan 22, 2024
1 parent 3a96134 commit 488f833
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions scripts/lib/api/processHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export function loadImages(
return $main
.find("img")
.toArray()
.filter((img) => $(img).attr("src"))
.map((img) => {
const $img = $(img);

Expand Down

0 comments on commit 488f833

Please sign in to comment.