Skip to content

Commit

Permalink
feat(gdocs): add hide-citation Archie field
Browse files Browse the repository at this point in the history
  • Loading branch information
mlbrgl committed Oct 5, 2023
1 parent 2fc92a6 commit 95bc8da
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion db/model/Gdoc/archieToGdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function* owidArticleToArchieMLStringGenerator(
yield* propertyToArchieMLString("type", article)
// TODO: inline refs
yieldMultiBlockPropertyIfDefined("summary", article, article.summary)
yieldMultiBlockPropertyIfDefined("citation", article, article.summary)
yield* propertyToArchieMLString("hide-citation", article)
yield* propertyToArchieMLString("cover-image", article)
yield* propertyToArchieMLString("cover-color", article)
yield* propertyToArchieMLString("featured-image", article)
Expand Down
2 changes: 1 addition & 1 deletion packages/@ourworldindata/utils/src/owidTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ export interface OwidGdocContent {
excerpt?: string
refs?: { definitions: RefDictionary; errors: OwidGdocErrorMessage[] }
summary?: EnrichedBlockText[]
citation?: EnrichedBlockSimpleText[]
"hide-citation"?: boolean
toc?: TocHeadingWithTitleSupertitle[]
"cover-image"?: string
"featured-image"?: string
Expand Down
32 changes: 17 additions & 15 deletions site/gdocs/OwidGdoc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,24 @@ export function OwidGdoc({
<Footnotes definitions={content.refs.definitions} />
) : null}

<section
id={CITATION_ID}
className="grid grid-cols-12-full-width col-start-1 col-end-limit"
>
<div className="col-start-4 span-cols-8 col-md-start-3 span-md-cols-10 col-sm-start-2 span-sm-cols-12">
<h3>Cite this work</h3>
<p>{citationDescription}</p>
<div>
<CodeSnippet code={citationText} />
</div>
<p>BibTeX citation</p>
<div>
<CodeSnippet code={bibtex} />
{!content["hide-citation"] && (
<section
id={CITATION_ID}
className="grid grid-cols-12-full-width col-start-1 col-end-limit"
>
<div className="col-start-4 span-cols-8 col-md-start-3 span-md-cols-10 col-sm-start-2 span-sm-cols-12">
<h3>Cite this work</h3>
<p>{citationDescription}</p>
<div>
<CodeSnippet code={citationText} />
</div>
<p>BibTeX citation</p>
<div>
<CodeSnippet code={bibtex} />
</div>
</div>
</div>
</section>
</section>
)}

<section
id={LICENSE_ID}
Expand Down
16 changes: 9 additions & 7 deletions site/gdocs/OwidGdocHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,15 @@ function OwidArticleHeader({
</div>
</div>
<div className="span-cols-1 span-sm-cols-2">
<a
href="#article-citation"
className="body-1-regular display-block"
>
<FontAwesomeIcon icon={faBook} />
Cite this article
</a>
{!content["hide-citation"] && (
<a
href="#article-citation"
className="body-1-regular display-block"
>
<FontAwesomeIcon icon={faBook} />
Cite this article
</a>
)}

<a
href="#article-licence"
Expand Down

0 comments on commit 95bc8da

Please sign in to comment.