Skip to content

Commit e94c0d9

Browse files
committed
Use pandoc pipe
1 parent 5c6e18c commit e94c0d9

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

news/changelog-1.3.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
- Fix wrong page number in the TOC for appendices ([#3164](https://github.com/quarto-dev/quarto-cli/issues/3164)) (Thank you, @iusgit!)
2020
- Add support for automatically converting SVG images to PDF ([#2575](https://github.com/quarto-dev/quarto-cli/issues/2575))
21+
- Previously, if the `pdf-engine` was set to `latexmk`, we would bypass many features of Quarto and use Pandoc to produce the PDF output. Starting in in Quarto 1.3, all Quarto features will be enabled for the `latexmk` engine and `latexmk` will be used to run the PDF generation loop.
2122

2223
## Beamer Format
2324

src/resources/filters/quarto-post/pdf-images.lua

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@
44
local function convert_svg(path)
55
local stem = pandoc.path.split_extension(path)
66
local output = stem .. '.pdf'
7-
local result = os.execute("rsvg-convert -f pdf -a -o" .. output .. " " .. path)
8-
if result then
7+
8+
local status, results = pcall(pandoc.pipe, "rsvg-convert", {"-f", "pdf", "-a", "-o", output, path}, "")
9+
if status then
910
return output
1011
else
11-
error("Failed when attempting to convert a SVG to a PDF for output. Please ensure that rsvg-convert is available on the path.")
12-
os.exit(1)
12+
if results['command'] == nil then
13+
-- command not found
14+
error("Failed when attempting to convert a SVG to a PDF for output. Please ensure that rsvg-convert is available on the path.")
15+
os.exit(1)
16+
else
17+
error("Failed when attempting to convert a SVG to a PDF for output. An error occurred while attempting to run rsvg-convert.\nError code " .. tostring(results['error_code']) )
18+
os.exit(1)
19+
end
1320
end
1421
end
1522

0 commit comments

Comments
 (0)