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
4 changes: 4 additions & 0 deletions news/changelog-1.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ All changes included in 1.7:
- ([#11664](https://github.com/quarto-dev/quarto-cli/issues/11664)): `lipsum` shortcode is no longer randomly generated by default, use `{{< lipsum random=true >}}` to restore randomness.
- ([#11379](https://github.com/quarto-dev/quarto-cli/issues/11379)): Add `version` shortcode to display the current Quarto version.

## Quarto Lua API

- ([#12299](https://github.com/quarto-dev/quarto-cli/issues/12299)): `quarto.doc.pdf_engine()` now correctly returns the PDF engine used for the document. `quarto.doc.cite_method()` now returns `nil` if no citation method will be used (i.e. no references is the document set).

## Engines

### `julia`
Expand Down
2 changes: 1 addition & 1 deletion src/command/render/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ function citeMethod(options: PandocOptions): CiteMethod | null {

function pdfEngine(options: PandocOptions): string {
const pdfEngine = options.flags?.pdfEngine ||
options.metadata?.[kPdfEngine] as string ||
options.format.pandoc?.[kPdfEngine] as string ||
"pdflatex";
return pdfEngine;
}
Expand Down
2 changes: 1 addition & 1 deletion src/resources/pandoc/datadir/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,7 @@ quarto = {
is_format = format.isFormat,

cite_method = function()
local citeMethod = param('cite-method', 'citeproc')
local citeMethod = param('cite-method', nil)
return citeMethod
end,
pdf_engine = function()
Expand Down
5 changes: 5 additions & 0 deletions tests/docs/smoke-all/2025/03/27/12299-1.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function Pandoc(doc)
assert(quarto.doc.pdf_engine() == "xelatex", "`quarto.doc.pdf_engine()` should be xelatex but is instead: " .. quarto.doc.pdf_engine())
assert(quarto.doc.cite_method() == "natbib", "`quarto.doc.cite_method()` should return natbib but return instead: " .. (quarto.doc.cite_method() or 'unset'))
return doc
end
34 changes: 34 additions & 0 deletions tests/docs/smoke-all/2025/03/27/12299-1.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: testing Lua API value for latex
format:
latex:
pdf-engine: xelatex
cite-method: natbib
references:
- type: article-journal
id: WatsonCrick1953
author:
- family: Watson
given: J. D.
- family: Crick
given: F. H. C.
issued:
date-parts:
- - 1953
- 4
- 25
title: 'Molecular structure of nucleic acids: a structure for
deoxyribose nucleic acid'
title-short: Molecular structure of nucleic acids
container-title: Nature
volume: 171
issue: 4356
page: 737-738
DOI: 10.1038/171737a0
URL: https://www.nature.com/articles/171737a0
language: en-GB
filters:
- 12299-1.lua
---


5 changes: 5 additions & 0 deletions tests/docs/smoke-all/2025/03/27/12299.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function Pandoc(doc)
assert(quarto.doc.pdf_engine() == "xelatex", "`quarto.doc.pdf_engine()` should be xelatex but is instead: " .. quarto.doc.pdf_engine())
assert(quarto.doc.cite_method() == nil, "`quarto.doc.cite_method()` should return natbib but return instead: " .. (quarto.doc.cite_method() or 'unset'))
return doc
end
11 changes: 11 additions & 0 deletions tests/docs/smoke-all/2025/03/27/12299.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: testing Lua API value for latex
format:
latex:
pdf-engine: xelatex
cite-method: natbib
filters:
- 12299.lua
---