Skip to content

Commit

Permalink
[Filter] refactor includemd to improve readability (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
cagix authored Aug 22, 2023
1 parent 386c1b6 commit 985ba52
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions filters/include-mdfiles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ end
-- to be used as a filter function for pandoc.Para: check each inline in a pandoc.Para block and
-- split this block into a list of blocks (before and after the links) and splice a list of blocks
-- for each link to a local Markdown file
function _include_md (bl)
function _include_md (para)
local block_list = pandoc.List:new()
local current_block = pandoc.Para({})
block_list:insert(current_block)

for _,i in ipairs(bl.content) do
for _,i in ipairs(para.content) do
if _is_local_markdown_file_link(i) then
-- process link target
block_list:extend(_handle_file(i.target))

-- "close" current block and open new one for any remaining inlines in current block 'bl'
-- "close" current block and open new one for any remaining inlines in current block 'para'
current_block = pandoc.Para({})
block_list:insert(current_block)
else
Expand Down

0 comments on commit 985ba52

Please sign in to comment.