Skip to content

Commit

Permalink
Always add citeproc to filters when it is explicitly enabled
Browse files Browse the repository at this point in the history
Fixes #2294
  • Loading branch information
dragonstyle committed Sep 6, 2022
1 parent c7c9d48 commit beb9e38
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
3 changes: 2 additions & 1 deletion news/changelog-1.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@

- Handle CNAME file for `gh-pages` either without or without protocol prefix (e.g. https://)

## Bibliographies
## Bibliographies and Citations

- Support formats `bibtex`, `biblatex`, and `csljson`. When rendered to one of these formats any citations within the document will be rendered as the specified bibliography format.
- Always add citeproc filter if `citeproc: true` is specified, even if there isn't a bibliography or references in the document (#2294)

## Miscellaneous

Expand Down
22 changes: 19 additions & 3 deletions src/command/render/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,13 +582,29 @@ function citeMethod(options: PandocOptions): CiteMethod | null {
// no handler if no references
const pandoc = options.format.pandoc;
const metadata = options.format.metadata;

// determine the engine, if provided
const engine = bibEngine(options.format.pandoc, options.flags);

// If the user is explicitly enabling citeproc: true, use this as the citemethod
// even when there may be no bibliography (see
// https://github.com/quarto-dev/quarto-cli/issues/2294 for an example of why)
if (pandoc.citeproc) {
// If both citeproc and a bib engine are specified, throw an error
if (engine) {
throw new Error(
`The bibliography engine '${engine}' was set when 'citeproc' was also explicitly requested.`,
);
}

return "citeproc";
}

// No bibliography or refences, and no explicit request, so no engine specified
if (!metadata[kBibliography] && !metadata.references) {
return null;
}

// collect config
const engine = bibEngine(options.format.pandoc, options.flags);

// if it's pdf-based output check for natbib or biblatex
if (engine) {
return engine;
Expand Down

0 comments on commit beb9e38

Please sign in to comment.