Skip to content

Commit

Permalink
include-files: use pandoc's warn function if possible
Browse files Browse the repository at this point in the history
Fixes: #281
  • Loading branch information
tarleb committed Jul 11, 2024
1 parent 53f3c1c commit 4cbb8d8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion include-files/include-files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ local List = require 'pandoc.List'
local path = require 'pandoc.path'
local system = require 'pandoc.system'

local warn = pcall(require, 'pandoc.log')
and (require 'pandoc.log').warn
or warn
or function (msg) io.stderr:write(msg .. '\n') end

--- Get include auto mode
local include_auto = false
function get_vars (meta)
Expand Down Expand Up @@ -85,7 +90,7 @@ function transclude (cb)
if line:sub(1,2) ~= '//' then
local fh = io.open(line)
if not fh then
io.stderr:write("Cannot open file " .. line .. " | Skipping includes\n")
warn("Cannot open file " .. line .. " | Skipping includes")
else
-- read file as the given format with global reader options
local contents = pandoc.read(
Expand Down

0 comments on commit 4cbb8d8

Please sign in to comment.