Fix zettel listing obeying zettel extension option
This commit is contained in:
parent
e5afcb5e15
commit
441cbcbc63
2 changed files with 5 additions and 3 deletions
|
@ -58,7 +58,7 @@ end
|
|||
-- table.
|
||||
-- Recurses into subdirectories if recursive argument is true.
|
||||
function ZK.get_zettel_list(path, recursive)
|
||||
return ls.get_anchors_and_paths(path, recursive or false)
|
||||
return ls.get_anchors_and_paths(path, recursive or false, ZK.options)
|
||||
end
|
||||
|
||||
return {
|
||||
|
|
|
@ -8,10 +8,12 @@ end
|
|||
-- TODO transform paths:
|
||||
-- * to absolute value (e.g. ~ to home, scandir needs absolute)
|
||||
-- * to ensure / at the end (or no /) gets taken into account
|
||||
function ls.get_anchors_and_paths(path, recursive)
|
||||
function ls.get_anchors_and_paths(path, recursive, options)
|
||||
options = options or {}
|
||||
-- TODO check for duplicates and warn user
|
||||
local zettel = {}
|
||||
local anchorreg = '^.*/?([%d][%d][%d][%d][%d][%d][%d][%d][%d][%d])[^/]*.md$'
|
||||
local anchorreg = '^.*/?([%d][%d][%d][%d][%d][%d][%d][%d][%d][%d])[^/]*%' ..
|
||||
(options.zettel_extension or '.md') .. '$'
|
||||
|
||||
local handle = vim.loop.fs_scandir(path)
|
||||
while handle do
|
||||
|
|
Loading…
Reference in a new issue