Skip to content

Commit 4cbb8d8

Browse files
committed
include-files: use pandoc's warn function if possible
Fixes: #281
1 parent 53f3c1c commit 4cbb8d8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

include-files/include-files.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ local List = require 'pandoc.List'
1010
local path = require 'pandoc.path'
1111
local system = require 'pandoc.system'
1212

13+
local warn = pcall(require, 'pandoc.log')
14+
and (require 'pandoc.log').warn
15+
or warn
16+
or function (msg) io.stderr:write(msg .. '\n') end
17+
1318
--- Get include auto mode
1419
local include_auto = false
1520
function get_vars (meta)
@@ -85,7 +90,7 @@ function transclude (cb)
8590
if line:sub(1,2) ~= '//' then
8691
local fh = io.open(line)
8792
if not fh then
88-
io.stderr:write("Cannot open file " .. line .. " | Skipping includes\n")
93+
warn("Cannot open file " .. line .. " | Skipping includes")
8994
else
9095
-- read file as the given format with global reader options
9196
local contents = pandoc.read(

0 commit comments

Comments
 (0)