Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/changelog-1.11.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ All changes included in 1.11:
- ([#15108](https://github.com/quarto-dev/quarto-cli/pull/15108)): Fix Google Scholar metadata showing formatting markup such as `<i>` in `citation_reference` tags for bibliography entries, and `undefined` as the book title of a chapter without one.
- ([#15115](https://github.com/quarto-dev/quarto-cli/pull/15115)): Fix Google Scholar writing two `citation_reference` tags for a reference defined in two bibliography files. The tag now describes the entry Pandoc renders.
- ([#15118](https://github.com/quarto-dev/quarto-cli/pull/15118)): Fix Google Scholar metadata missing the first and last page of bibliography entries, and giving wrong pages for a citation `page` written with an en-dash or as a page list.
- ([#15125](https://github.com/quarto-dev/quarto-cli/pull/15125)): Fix Google Scholar metadata failing the render with a CSL JSON (`.json`) bibliography.

### `pdf`

Expand Down
7 changes: 6 additions & 1 deletion src/core/bibliography.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Adapted from: https://github.com/watson/ci-info
*/

import { dirname, isAbsolute, join } from "../deno_ral/path.ts";
import { dirname, extname, isAbsolute, join } from "../deno_ral/path.ts";
import { kBibliography } from "../config/constants.ts";
import { Metadata } from "../config/types.ts";
import { asArray } from "./array.ts";
Expand Down Expand Up @@ -85,6 +85,11 @@ export async function renderToCSLJSON(
// in which case just leave it alone (otherwise it is cwd relative)
const biblioPath = join(dir, biblio);
const cmd = [pandocBinaryPath()];
// Without -f, pandoc reads a .json input as its own JSON AST
if (extname(biblioPath).toLowerCase() === ".json") {
cmd.push("-f");
cmd.push("csljson");
}
cmd.push(
isAbsolute(biblioPath) ? biblioPath : join(Deno.cwd(), biblioPath),
);
Expand Down
15 changes: 15 additions & 0 deletions tests/docs/smoke-all/2026/10/14/scholar-references/csl-json.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Scholar metadata for a CSL JSON bibliography
format: html
google-scholar: true
bibliography: references.json
_quarto:
tests:
html:
ensureHtmlElements:
- ['meta[name="citation_reference"][content*="citation_author=Alice Smith;"]']
---

The bibliography is a CSL JSON file. Pandoc reads a bare `.json` input as its own JSON AST, so the Scholar reference tags need the bibliography read explicitly as CSL JSON.

This article cites one work [@cited].
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"id": "cited",
"type": "article-journal",
"title": "Cited reference",
"author": [{ "family": "Smith", "given": "Alice" }],
"issued": { "date-parts": [[2024]] }
}
]
Loading