Skip to content

Commit fb9580c

Browse files
authored
feat(babel): add directory creation support with :mkdirp header argument (#928)
* feat(babel): add directory creation support with :mkdirp header argument When tangling code blocks to files, automatically create parent directories when the :mkdirp header argument is set to 'yes'. * fix(babel): remove debug message * fix(babel): replace double quotes with single quotes. Coding style requires single quotes
1 parent dafb6aa commit fb9580c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lua/orgmode/babel/tangle.lua

+6
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ function Tangle:tangle()
5454
end
5555
end
5656
end
57+
58+
if info.header_args[':mkdirp'] == 'yes' then
59+
local path = vim.fn.fnamemodify(info.filename, ':h')
60+
vim.fn.mkdir(path, 'p')
61+
end
62+
5763
if info.name then
5864
block_content_by_name[info.name] = parsed_content
5965
end

0 commit comments

Comments
 (0)