From 32ead257fc93970f8cfcb8ec3322d45467372ec1 Mon Sep 17 00:00:00 2001 From: Charles Teague Date: Tue, 18 Jul 2023 11:14:25 -0400 Subject: [PATCH] Add keywords to title block --- news/changelog-1.4.md | 1 + src/config/constants.ts | 3 +++ src/config/types.ts | 2 ++ src/resources/filters/modules/authors.lua | 7 +++++++ src/resources/formats/html/templates/title-block.scss | 3 ++- .../formats/html/templates/title-metadata.html | 11 ++++++++++- src/resources/language/_language-cs.yml | 1 + src/resources/language/_language-da.yml | 1 + src/resources/language/_language-de.yml | 1 + src/resources/language/_language-el.yml | 1 + src/resources/language/_language-es.yml | 1 + src/resources/language/_language-fi.yml | 1 + src/resources/language/_language-fr.yml | 1 + src/resources/language/_language-id.yml | 1 + src/resources/language/_language-it.yml | 1 + src/resources/language/_language-ja.yml | 1 + src/resources/language/_language-ko.yml | 1 + src/resources/language/_language-lt.yml | 1 + src/resources/language/_language-nb.yml | 3 ++- src/resources/language/_language-nl.yml | 1 + src/resources/language/_language-nn.yml | 1 + src/resources/language/_language-pl.yml | 1 + src/resources/language/_language-pt-BR.yml | 1 + src/resources/language/_language-pt.yml | 1 + src/resources/language/_language-ru.yml | 1 + src/resources/language/_language-sk.yml | 1 + src/resources/language/_language-sv.yml | 1 + src/resources/language/_language-tr.yml | 1 + src/resources/language/_language-zh.yml | 1 + src/resources/language/_language.yml | 1 + src/resources/language/_language_nb.yml | 1 + 31 files changed, 51 insertions(+), 3 deletions(-) diff --git a/news/changelog-1.4.md b/news/changelog-1.4.md index 7057699ab3..cad74d8b47 100644 --- a/news/changelog-1.4.md +++ b/news/changelog-1.4.md @@ -28,6 +28,7 @@ - ([#5929](https://github.com/quarto-dev/quarto-cli/issues/5929)): Split border-bottom properties to avoid invalid `inherit` entry in resulting CSS. - ([#5957](https://github.com/quarto-dev/quarto-cli/issues/5957)): Fix layout issues when margin footnotes are contained in headings or other formatted text. - ([#6163](https://github.com/quarto-dev/quarto-cli/issues/6163)): Wrap `svg` output of `dot` cells in RawBlock `html` elements. +- Add support for displaying `keywords` in HTML page title block, when present. ## RevealJS Format diff --git a/src/config/constants.ts b/src/config/constants.ts index b0b270d714..ebe0fc2605 100644 --- a/src/config/constants.ts +++ b/src/config/constants.ts @@ -235,6 +235,7 @@ export const kTitleBlockAffiliationSingle = "title-block-affiliation-single"; export const kTitleBlockAffiliationPlural = "title-block-affiliation-plural"; export const kTitleBlockPublished = "title-block-published"; export const kTitleBlockModified = "title-block-modified"; +export const kTitleBlockKeywords = "title-block-keywords"; export const kCodeSummary = "code-summary"; export const kCodeLine = "code-line"; export const kCodeLines = "code-lines"; @@ -348,6 +349,7 @@ export const kLanguageDefaultsKeys = [ kTitleBlockAuthorSingle, kTitleBlockPublished, kTitleBlockModified, + kTitleBlockKeywords, kCodeSummary, kCodeLine, kCodeLines, @@ -433,6 +435,7 @@ export const kLanguageDefaultsKeys = [ kTitleBlockAffiliationPlural, kTitleBlockPublished, kTitleBlockModified, + kTitleBlockKeywords, kNotebookPreviewDownload, kNotebookPreviewDownloadSrc, kNotebookPreviewBack, diff --git a/src/config/types.ts b/src/config/types.ts index 1a356afdb2..e1a2796b8b 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -201,6 +201,7 @@ import { kTitleBlockAffiliationSingle, kTitleBlockAuthorPlural, kTitleBlockAuthorSingle, + kTitleBlockKeywords, kTitleBlockModified, kTitleBlockPublished, kTitlePrefix, @@ -585,6 +586,7 @@ export interface FormatLanguage { [kTitleBlockAuthorPlural]?: string; [kTitleBlockPublished]?: string; [kTitleBlockModified]?: string; + [kTitleBlockKeywords]?: string; [kSectionTitleFootnotes]?: string; [kSectionTitleReferences]?: string; [kSectionTitleAppendices]?: string; diff --git a/src/resources/filters/modules/authors.lua b/src/resources/filters/modules/authors.lua index 28930fc32b..50c273a143 100644 --- a/src/resources/filters/modules/authors.lua +++ b/src/resources/filters/modules/authors.lua @@ -189,6 +189,7 @@ local kModifiedLbl = 'modified' local kDoiLbl = 'doi' local kDescriptionLbl = 'description' local kAbstractLbl = 'abstract' +local kKeywordsLbl = 'keywords' -- affiliation fields that might be parsed into other fields -- (e.g. if we see affiliation-url with author, we make that affiliation/url) @@ -810,6 +811,12 @@ local function computeLabels(authors, affiliations, meta) if meta[kDescriptionTitle] then meta[kLabels][kDescriptionLbl] = meta[kDescriptionTitle] end + + meta[kLabels][kKeywordsLbl] = {pandoc.Str(language["title-block-keywords"])} + if meta[kKeywordsTitle] then + meta[kLabels][kKeywordsLbl] = meta[kKeywordsTitle] + end + end return meta diff --git a/src/resources/formats/html/templates/title-block.scss b/src/resources/formats/html/templates/title-block.scss index 270e848e11..7bd57e70d4 100644 --- a/src/resources/formats/html/templates/title-block.scss +++ b/src/resources/formats/html/templates/title-block.scss @@ -165,6 +165,7 @@ main.quarto-banner-title-block > section:first-child > h4 { margin-bottom: 0.1em; } + .keywords, .description, .abstract { margin-top: 0; @@ -176,7 +177,7 @@ main.quarto-banner-title-block > section:first-child > h4 { margin-bottom: 0; } - .abstract-title { + .block-title { margin-top: 1em; text-transform: uppercase; font-size: 0.8em; diff --git a/src/resources/formats/html/templates/title-metadata.html b/src/resources/formats/html/templates/title-metadata.html index 258e4cd00b..77bb36bc03 100644 --- a/src/resources/formats/html/templates/title-metadata.html +++ b/src/resources/formats/html/templates/title-metadata.html @@ -73,8 +73,17 @@ $if(abstract)$
-
$labels.abstract$
+
$labels.abstract$
$abstract$
$endif$ + +$if(keywords)$ +
+
+
$labels.keywords$
+

$for(keywords)$$it$$sep$, $endfor$

+
+
+$endif$ diff --git a/src/resources/language/_language-cs.yml b/src/resources/language/_language-cs.yml index 17d7db4871..a9dbfb865c 100644 --- a/src/resources/language/_language-cs.yml +++ b/src/resources/language/_language-cs.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Afiliace" title-block-affiliation-plural: "Afiliace" title-block-published: "Publikováno" title-block-modified: "Upraveno" +title-block-keywords: "Klíčová slova" callout-tip-title: "Tip" callout-note-title: "Poznámka" diff --git a/src/resources/language/_language-da.yml b/src/resources/language/_language-da.yml index 5e157997ef..f150599a1a 100644 --- a/src/resources/language/_language-da.yml +++ b/src/resources/language/_language-da.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Tilknytning" title-block-affiliation-plural: "Tilknytninger" title-block-published: "Udgivet" title-block-modified: "Ændret" +title-block-keywords: "Nøgleord" callout-tip-title: "Tip" callout-note-title: "Note" diff --git a/src/resources/language/_language-de.yml b/src/resources/language/_language-de.yml index 7ff7341a76..cfead2755a 100644 --- a/src/resources/language/_language-de.yml +++ b/src/resources/language/_language-de.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Zugehörigkeit" title-block-affiliation-plural: "Zugehörigkeiten" title-block-published: "Veröffentlichungsdatum" title-block-modified: "Geändert" +title-block-keywords: "Schlüsselwörter" callout-tip-title: "Tipp" callout-note-title: "Hinweis" diff --git a/src/resources/language/_language-el.yml b/src/resources/language/_language-el.yml index b73012e847..270eaaccc6 100644 --- a/src/resources/language/_language-el.yml +++ b/src/resources/language/_language-el.yml @@ -19,6 +19,7 @@ section-title-references: "Αναφορές" section-title-reuse: "Επαναχρησιμοποίηση" section-title-copyright: "Πνευματικά δικαιώματα" section-title-citation: "Αναφορά" +title-block-keywords: "Λέξεις-κλειδιά" appendix-attribution-cite-as: "Για απόδοση ευγνωμοσύνης, παρακαλούμε αναφερθείτε σε αυτό το έργο ως:" appendix-attribution-bibtex: "Αναφορά BibTeX:" diff --git a/src/resources/language/_language-es.yml b/src/resources/language/_language-es.yml index ffc3d184fe..34fa64a84b 100644 --- a/src/resources/language/_language-es.yml +++ b/src/resources/language/_language-es.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Afiliación" title-block-affiliation-plural: "Afiliaciones" title-block-published: "Fecha de publicación" title-block-modified: "Fecha de modificación" +title-block-keywords: "Palabras clave" callout-tip-title: "Tip" callout-note-title: "Nota" diff --git a/src/resources/language/_language-fi.yml b/src/resources/language/_language-fi.yml index 5fb4a31ce4..57dfcdd004 100644 --- a/src/resources/language/_language-fi.yml +++ b/src/resources/language/_language-fi.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Affiliaatio" title-block-affiliation-plural: "Affiliaatiot" title-block-published: "Julkaistu" title-block-modified: "Muokattu" +title-block-keywords: "Avainsanat" callout-tip-title: "Vihje" callout-note-title: "Huomautus" diff --git a/src/resources/language/_language-fr.yml b/src/resources/language/_language-fr.yml index 626465d698..c35a9f8d63 100644 --- a/src/resources/language/_language-fr.yml +++ b/src/resources/language/_language-fr.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Affiliation" title-block-affiliation-plural: "Affiliations" title-block-published: "Date de publication" title-block-modified: "Modifié" +title-block-keywords: "Mots clés" callout-tip-title: "Astuce" callout-note-title: "Note" diff --git a/src/resources/language/_language-id.yml b/src/resources/language/_language-id.yml index 716bf9d617..cf3c52950c 100644 --- a/src/resources/language/_language-id.yml +++ b/src/resources/language/_language-id.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Afiliasi" title-block-affiliation-plural: "Afiliasi" title-block-published: "Diterbitkan" title-block-modified: "Diubah" +title-block-keywords: "Kata kunci" callout-tip-title: "Tip" callout-note-title: "Catatan" diff --git a/src/resources/language/_language-it.yml b/src/resources/language/_language-it.yml index bd1af92836..16b54d4ce1 100644 --- a/src/resources/language/_language-it.yml +++ b/src/resources/language/_language-it.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Affiliazione" title-block-affiliation-plural: "Affiliazioni" title-block-published: "Data di Pubblicazione" title-block-modified: "Data di modifica" +title-block-keywords: "Parole chiave" callout-tip-title: "Consiglio" callout-note-title: "Nota" diff --git a/src/resources/language/_language-ja.yml b/src/resources/language/_language-ja.yml index 2178cb0290..50998980ac 100644 --- a/src/resources/language/_language-ja.yml +++ b/src/resources/language/_language-ja.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "所属" title-block-affiliation-plural: "所属" title-block-published: "公開" title-block-modified: "更新日" +title-block-keywords: "キーワード" callout-tip-title: "ヒント" callout-note-title: "ノート" diff --git a/src/resources/language/_language-ko.yml b/src/resources/language/_language-ko.yml index 7f2984f8bb..6a4cc013b1 100644 --- a/src/resources/language/_language-ko.yml +++ b/src/resources/language/_language-ko.yml @@ -28,6 +28,7 @@ title-block-author-plural: "저자" title-block-affiliation-single: "소속" title-block-affiliation-plural: "소속" title-block-published: "공개" +title-block-keywords: "키워드" callout-tip-title: "힌트" callout-note-title: "노트" diff --git a/src/resources/language/_language-lt.yml b/src/resources/language/_language-lt.yml index 10ffa43b86..ba8802df0c 100644 --- a/src/resources/language/_language-lt.yml +++ b/src/resources/language/_language-lt.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Organizacija" title-block-affiliation-plural: "Organizacijos" title-block-published: "Paskelbta" title-block-modified: "Atnaujinta" +title-block-keywords: "Raktiniai žodžiai" callout-tip-title: "Patarimas" callout-note-title: "Pastaba" diff --git a/src/resources/language/_language-nb.yml b/src/resources/language/_language-nb.yml index 64bea3ce3c..3b05f266ab 100644 --- a/src/resources/language/_language-nb.yml +++ b/src/resources/language/_language-nb.yml @@ -8,7 +8,7 @@ other-links-title: "Andre lenker" article-notebook-label: "Artikkelskrivebok" notebook-preview-download: "Last ned skrivebok" -notebook-preview-download-src: " Last ned kildekode" +notebook-preview-download-src: "Last ned kildekode" notebook-preview-back: "Tilbake til artikkelen" manuscript-meca-bundle: "MECA-arkiv" @@ -29,6 +29,7 @@ title-block-affiliation-single: "Tilknytning" title-block-affiliation-plural: "Tilknytninger" title-block-published: "Utgitt" title-block-modified: "Endret" +title-block-keywords: "Nøkkelord" callout-tip-title: "Tips" callout-note-title: "Note" diff --git a/src/resources/language/_language-nl.yml b/src/resources/language/_language-nl.yml index 8a985e5916..2e2c658e01 100644 --- a/src/resources/language/_language-nl.yml +++ b/src/resources/language/_language-nl.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Affiliatie" title-block-affiliation-plural: "Affiliaties" title-block-published: "Publicatiedatum" title-block-modified: "Gewijzigd" + title-block-keywords: "Sleutelwoorden" callout-tip-title: "Tip" callout-note-title: "Opmerking" diff --git a/src/resources/language/_language-nn.yml b/src/resources/language/_language-nn.yml index 7d3a9b62e0..74ad09690b 100644 --- a/src/resources/language/_language-nn.yml +++ b/src/resources/language/_language-nn.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Tilknyting" title-block-affiliation-plural: "Tilknytingar" title-block-published: "Publisert" title-block-modified: "Endra" +title-block-keywords: "Nøkkelord" callout-tip-title: "Tips" callout-note-title: "Obs" diff --git a/src/resources/language/_language-pl.yml b/src/resources/language/_language-pl.yml index cd1043d3d9..faf887f978 100644 --- a/src/resources/language/_language-pl.yml +++ b/src/resources/language/_language-pl.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Afiliacja" title-block-affiliation-plural: "Afiliacje" title-block-published: "Opublikowano" title-block-modified: "Zmodyfikowano" +title-block-keywords: "Słowa kluczowe" callout-tip-title: "Wskazówka" callout-note-title: "Adnotacja" diff --git a/src/resources/language/_language-pt-BR.yml b/src/resources/language/_language-pt-BR.yml index eaae421640..d738f574b2 100644 --- a/src/resources/language/_language-pt-BR.yml +++ b/src/resources/language/_language-pt-BR.yml @@ -28,6 +28,7 @@ title-block-author-plural: "Autores" title-block-affiliation-single: "Afiliação" title-block-affiliation-plural: "Afiliações" title-block-published: "Data de Publicação" +title-block-keywords: "Palavras-chave" callout-tip-title: "Dica" callout-note-title: "Nota" diff --git a/src/resources/language/_language-pt.yml b/src/resources/language/_language-pt.yml index 61ae4d9b87..45dcb7289e 100644 --- a/src/resources/language/_language-pt.yml +++ b/src/resources/language/_language-pt.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Afiliação" title-block-affiliation-plural: "Afiliações" title-block-published: "Data de Publicação" title-block-modified: "Data de Modificação" +title-block-keywords: "Palavras-chave" callout-tip-title: "Dica" callout-note-title: "Nota" diff --git a/src/resources/language/_language-ru.yml b/src/resources/language/_language-ru.yml index 2e7e05733b..4eea5222b9 100644 --- a/src/resources/language/_language-ru.yml +++ b/src/resources/language/_language-ru.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "принадлежность" title-block-affiliation-plural: "Принадлежности" title-block-published: "Дата публикации" title-block-modified: "Файл изменен" +title-block-keywords: "Ключевые слова" callout-tip-title: "Совет" callout-note-title: "Уведомление" diff --git a/src/resources/language/_language-sk.yml b/src/resources/language/_language-sk.yml index 4e64a0c8bc..1990be0008 100644 --- a/src/resources/language/_language-sk.yml +++ b/src/resources/language/_language-sk.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Príslušnosť" title-block-affiliation-plural: "Príslušnosť" title-block-published: "Publikované" title-block-modified: "Zmenené" +title-block-keywords: "Kľúčové slová" callout-tip-title: "Tip" callout-note-title: "Poznámka" diff --git a/src/resources/language/_language-sv.yml b/src/resources/language/_language-sv.yml index 0058f35820..d40af56c3d 100644 --- a/src/resources/language/_language-sv.yml +++ b/src/resources/language/_language-sv.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Anknuten" title-block-affiliation-plural: "Anknutna" title-block-published: "Utgiven" title-block-modified: "Ändrad" +title-block-keywords: "Nyckelord" callout-tip-title: "Tips" callout-note-title: "Notera" diff --git a/src/resources/language/_language-tr.yml b/src/resources/language/_language-tr.yml index 169e5b9ff1..fde944948d 100644 --- a/src/resources/language/_language-tr.yml +++ b/src/resources/language/_language-tr.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "üyelik" title-block-affiliation-plural: "Bağlantılar" title-block-published: "Yayınlanma Tarihi" title-block-modified: "Değiştirilmiş" +title-block-keywords: "Anahtar kelimeler" callout-tip-title: "Tavsiye" callout-note-title: "Not" diff --git a/src/resources/language/_language-zh.yml b/src/resources/language/_language-zh.yml index 5d4657f493..070fb4c576 100644 --- a/src/resources/language/_language-zh.yml +++ b/src/resources/language/_language-zh.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "联系" title-block-affiliation-plural: "隶属关系" title-block-published: "发布日期" title-block-modified: "修改的" + title-block-keywords: "关键词" callout-tip-title: "提示" callout-note-title: "注释" diff --git a/src/resources/language/_language.yml b/src/resources/language/_language.yml index 9ef642ba59..3ea6aaf3fc 100644 --- a/src/resources/language/_language.yml +++ b/src/resources/language/_language.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Affiliation" title-block-affiliation-plural: "Affiliations" title-block-published: "Published" title-block-modified: "Modified" +title-block-keywords: "Keywords" callout-tip-title: "Tip" callout-note-title: "Note" diff --git a/src/resources/language/_language_nb.yml b/src/resources/language/_language_nb.yml index 90eb99191d..3b05f266ab 100644 --- a/src/resources/language/_language_nb.yml +++ b/src/resources/language/_language_nb.yml @@ -29,6 +29,7 @@ title-block-affiliation-single: "Tilknytning" title-block-affiliation-plural: "Tilknytninger" title-block-published: "Utgitt" title-block-modified: "Endret" +title-block-keywords: "Nøkkelord" callout-tip-title: "Tips" callout-note-title: "Note"