Do not leak working directory in TikZ filter

This commit is contained in:
Jeroen de Haas 2021-08-30 12:52:45 +02:00 committed by John MacFarlane
parent 5dcd4610e2
commit 7d91ff28ac

View file

@ -695,12 +695,12 @@ end
function RawBlock(el)
if starts_with('\\begin{tikzpicture}', el.text) then
local filetype = extension_for[FORMAT] or 'svg'
local fname = system.get_working_directory() .. '/' ..
pandoc.sha1(el.text) .. '.' .. filetype
local fbasename = pandoc.sha1(el.text) .. '.' .. filetype
local fname = system.get_working_directory() .. '/' .. fbasename
if not file_exists(fname) then
tikz2image(el.text, filetype, fname)
end
return pandoc.Para({pandoc.Image({}, fname)})
return pandoc.Para({pandoc.Image({}, fbasename)})
else
return el
end