File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -40,14 +40,18 @@ function transclude (cb)
4040 for line in cb .text :gmatch (' [^\n ]+' ) do
4141 if line :sub (1 ,2 ) ~= ' //' then
4242 local fh = io.open (line )
43- local contents = pandoc .read (fh :read ' *a' , format ).blocks
44- -- recursive transclusion
45- contents = pandoc .walk_block (
46- pandoc .Div (contents ),
47- {CodeBlock = transclude }
48- ).content
49- blocks :extend (shift_headings (contents , shift_heading_level_by ))
50- fh :close ()
43+ if not fh then
44+ io.stderr :write (" Cannot open file " .. line .. " | Skipping includes\n " )
45+ else
46+ local contents = pandoc .read (fh :read ' *a' , format ).blocks
47+ -- recursive transclusion
48+ contents = pandoc .walk_block (
49+ pandoc .Div (contents ),
50+ {CodeBlock = transclude }
51+ ).content
52+ blocks :extend (shift_headings (contents , shift_heading_level_by ))
53+ fh :close ()
54+ end
5155 end
5256 end
5357 return blocks
You can’t perform that action at this time.
0 commit comments