aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pandoc/filters/include-files.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/pandoc/filters/include-files.lua b/pandoc/filters/include-files.lua
index 06cfd4e6..a42ae1ec 100644
--- a/pandoc/filters/include-files.lua
+++ b/pandoc/filters/include-files.lua
@@ -41,6 +41,26 @@ local function update_contents(blocks, shift_by, include_path)
end
return image
end,
+ -- If tex input paths are relative then prepend include file path
+ RawBlock = function (el)
+ io.stderr:write("include-filter: Raw Block found.\n")
+ -- Only handle tex RawBlocks
+ if el.format ~= 'tex' then
+ return el
+ end
+ io.stderr:write("include-filter: Raw Tex Block found.\n")
+
+ el.text = el.text:gsub('\\input{([^}]+)}', function(match)
+ local input_path = match
+ if path.is_relative(include_path) then
+ include_path = path.normalize(path.join({include_path, input_path}))
+ end
+
+ return '\\input{' .. include_path .. '}'
+ end)
+
+ return el
+ end,
-- Update path for include-code-files.lua filter style CodeBlocks
CodeBlock = function (cb)
if cb.attributes.include and path.is_relative(cb.attributes.include) then