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") local data = table.concat(lines, "\n")
-- read existing data from output_file -- read existing data from output_file
local f = assert(io.open(output_file), "\n" .. local f = io.open(output_file)
"[ERROR] could not open " .. output_file .. " for reading.") local data_old
local data_old = f:read("a") if f then data_old = f:read("a"); f:close() end
f:close()
-- write to output_file if data changed -- 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" .. local f = assert(io.open(output_file, "w"), "\n" ..
"[ERROR] could not open " .. output_file .. " for writing.") "[ERROR] could not open " .. output_file .. " for writing.")
f:write(data) f:write(data)