update `pandoc` data dir

master
urosm 2024-05-17 15:35:50 +02:00
parent 4fdb624ab3
commit 9aa9531a78
1 changed files with 4 additions and 5 deletions

View File

@ -150,13 +150,12 @@ table.insert(lines, "</article>")
local data = table.concat(lines, "\n")
-- read existing data from output_file
local f = assert(io.open(output_file), "\n" ..
"[ERROR] could not open " .. output_file .. " for reading.")
local data_old = f:read("a")
f:close()
local f = io.open(output_file)
local data_old
if f then data_old = f:read("a"); f:close() end
-- write to output_file if data changed
if data ~= data_old then
if not data_old or data ~= data_old then
local f = assert(io.open(output_file, "w"), "\n" ..
"[ERROR] could not open " .. output_file .. " for writing.")
f:write(data)