update `pandoc` data dir
parent
4fdb624ab3
commit
9aa9531a78
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue