Skip to content

Commit

Permalink
Fix missing link to grapher in image caption
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyi committed Jan 3, 2025
1 parent daf1174 commit 71ed671
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion db/model/Gdoc/GdocBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,17 @@ export class GdocBase implements OwidGdocBaseInterface {
block: OwidEnrichedGdocBlock
): DbInsertPostGdocLink[] | void {
const links: DbInsertPostGdocLink[] = match(block)
.with({ type: "image" }, (block) => {
const links: DbInsertPostGdocLink[] = []
if (!block.caption) return links
for (const span of block.caption) {
traverseEnrichedSpan(span, (span) => {
const link = this.extractLinkFromSpan(span)
if (link) links.push(link)
})
}
return links
})
.with({ type: "person" }, (block) => {
if (!block.url) return []
return [
Expand Down Expand Up @@ -563,7 +574,6 @@ export class GdocBase implements OwidGdocBaseInterface {
"heading",
"horizontal-rule",
"html",
"image",
"key-indicator-collection",
"list",
"missing-data",
Expand Down

0 comments on commit 71ed671

Please sign in to comment.