Fix function formatting getting zettel from dir
This commit is contained in:
parent
5228a3b49e
commit
e31630a8c4
4 changed files with 9 additions and 5 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
public/
|
|
@ -65,6 +65,7 @@ next up:
|
|||
* [ ] zettel 'lens' (preview first headline + content of linked zettel through floating window etc, on keypress)
|
||||
* [ ] support *both* md-style and wiki-style links at the same time
|
||||
* [ ] file/directory exception list for gathering files, which will be ignored
|
||||
* [ ] 'strict' mode *only* matching and following valid anchor links
|
||||
|
||||
## TODO: maintenance
|
||||
|
||||
|
|
|
@ -64,12 +64,13 @@ end
|
|||
-- Take a list of zettel as an optional variable, without which
|
||||
-- it will use the (recursive) results of the zettel_root directory.
|
||||
function ls.get_zettel(anchor, all)
|
||||
local zettels = all or
|
||||
ls.get_anchors_and_paths(
|
||||
ls.get_all_files(o.zettel().rootdir, true))
|
||||
if not zettels then return end
|
||||
if not all then
|
||||
local files = ls.get_all_files(o.zettel().rootdir, true)
|
||||
all = ls.get_anchors_and_paths(files)
|
||||
end
|
||||
if not all then return end
|
||||
|
||||
return zettels[anchor]
|
||||
return all[anchor]
|
||||
end
|
||||
|
||||
return ls
|
||||
|
|
|
@ -167,4 +167,5 @@ describe("get_zettel", function()
|
|||
ls.get_zettel(expected)
|
||||
assert.stub(fc).was_called_with(expected, true)
|
||||
end)
|
||||
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue