diff --git a/news/changelog-1.5.md b/news/changelog-1.5.md index d45b005dd6..39d62d1cda 100644 --- a/news/changelog-1.5.md +++ b/news/changelog-1.5.md @@ -7,13 +7,10 @@ All changes included in 1.5: ## Website +- ([#8108](https://github.com/quarto-dev/quarto-cli/issues/8108)): Individual pages can suppress breadcrumbs using `bread-crumbs: false` - ([#8267](https://github.com/quarto-dev/quarto-cli/issues/8267)): Improve responsive layout of `page-footer` - ([#8294](https://github.com/quarto-dev/quarto-cli/issues/8294)): Add support for website announcements, using the `announcement` key under `website`. -## Website - -- ([#8108](https://github.com/quarto-dev/quarto-cli/issues/8108)): Individual pages can suppress breadcrumbs using `bread-crumbs: false` - ## Manuscripts - ([#8277](https://github.com/quarto-dev/quarto-cli/issues/8277)): Improve notebook ordering within Manuscript projects @@ -25,6 +22,7 @@ All changes included in 1.5: ## Website - ([#7318](https://github.com/quarto-dev/quarto-cli/issues/7318)): Don't improperly overwrite page titles +- ([#8426](https://github.com/quarto-dev/quarto-cli/issues/8426)): Ignore invalid dates for references when generating Google Scholar data. ## Other Fixes diff --git a/src/core/csl.ts b/src/core/csl.ts index 2c13cf128a..235d76b5d3 100644 --- a/src/core/csl.ts +++ b/src/core/csl.ts @@ -165,7 +165,7 @@ export function suggestId(author: CSLName[], date?: CSLDate) { // See https://www.loc.gov/standards/datetime/ // Currently omits time component so this isn't truly level 0 export function cslDateToEDTFDate(date: CSLDate) { - if (date["date-parts"]) { + if (date["date-parts"] && date["date-parts"].length > 0) { const paddedParts = date["date-parts"][0].map((part) => { const partStr = part?.toString(); if (partStr?.length === 1) { diff --git a/src/format/html/format-html-meta.ts b/src/format/html/format-html-meta.ts index c73dbe891e..5843310f4b 100644 --- a/src/format/html/format-html-meta.ts +++ b/src/format/html/format-html-meta.ts @@ -136,16 +136,21 @@ function googleScholarMeta( if (csl.issued) { const edtfIssued = cslDateToEDTFDate(csl.issued); - write("citation_publication_date", edtfIssued); - write("citation_cover_date", edtfIssued); + if (edtfIssued) { + write("citation_publication_date", edtfIssued); + write("citation_cover_date", edtfIssued); + } const parts = csl.issued["date-parts"]; - if (parts) { + if (parts && parts.length > 0) { write("citation_year", parts[0][0]); } } if (csl["available-date"]) { - write("citation_online_date", cslDateToEDTFDate(csl["available-date"])); + const edtfAvailable = cslDateToEDTFDate(csl["available-date"]); + if (edtfAvailable) { + write("citation_online_date", edtfAvailable); + } } if (csl.URL) { diff --git a/tests/docs/smoke-all/2024/01/24/8362.qmd b/tests/docs/smoke-all/2024/01/24/8362.qmd new file mode 100644 index 0000000000..4becc41d96 --- /dev/null +++ b/tests/docs/smoke-all/2024/01/24/8362.qmd @@ -0,0 +1,15 @@ +--- +title: Hello World +format: html +bibliography: bad.bib +google-scholar: true +nocite: | + @* +--- + +## Hello. + +### References + +::: {#refs} +::: \ No newline at end of file diff --git a/tests/docs/smoke-all/2024/01/24/bad.bib b/tests/docs/smoke-all/2024/01/24/bad.bib new file mode 100644 index 0000000000..b3b21026ba --- /dev/null +++ b/tests/docs/smoke-all/2024/01/24/bad.bib @@ -0,0 +1,24 @@ + +@article{guo2020, + title = {The origin, transmission and clinical therapies on coronavirus disease 2019 (COVID-19) outbreak {\textendash} an update on the status of our research.}, + author = {{Guo}, {Yan-Rong} and {Cao}, {Qing-Dong} and {Hong}, {Zhong-Si} and {Tan}, {Yuan-Yang} and {Chen}, {Shou-Deng} and {Jin}, {Hong-Jun} and {Tan}, {Kai-Sen} and {Wang}, {De-Yun} and {Yan}, {Yan}}, + year = {2020}, + month = {12}, + date = {2020-12}, + journal = {Military Medical Research}, + pages = {11}, + volume = {7}, + number = {1}, + doi = {10.1186/s40779-020-00240-0}, + url = {https://mmrjournal.biomedcentral.com/articles/10.1186/s40779-020-00240-0}, + langid = {en} +} + + +@book{hootsteinWearingFourPairs2012, + title = {Wearing Four Pairs of Shoes: {{The}} Roles of e-Learning Facilitators}, + author = {Hootstein, Ed}, + year = {August 16, 2012 2002}, + publisher = {{American Society for Training and Development}}, + abstract = {The emergence of e-learning comes at a time when education and training are undergoing important transformations. The teacher-centered model that has dominated instruction for centuries is slowly giving way to a learner-centered model with instructors in the roles of facilitators or "guides on the side." E-learning is no exception. But e-learning's use doesn't preclude facilitators' responsibilities for structuring learning experiences. The effectiveness and success of e-learning programs are dependent on facilitators' roles in delivering and managing instruction. One of the leading conceptualizers in the field of distance learning, Zane Berge, broke down an instructor's role in computer conferencing into four separate parts. I propose a similar model, in which an e-learning facilitator "wears four pairs of shoes"{\textendash}acting as instructor, social director, program manager, and technical assistant.} +} \ No newline at end of file