feat: add glob method on ContentDirectory
This commit is contained in:
parent
f691669d76
commit
051a51280f
|
|
@ -1,6 +1,6 @@
|
|||
from functools import cache
|
||||
from pathlib import Path
|
||||
from typing import Any, Iterator
|
||||
from typing import Any, Iterable, Iterator
|
||||
|
||||
from markdown import Markdown
|
||||
from yaml import Loader, load
|
||||
|
|
@ -27,6 +27,10 @@ class ContentDirectory(Content):
|
|||
|
||||
return current
|
||||
|
||||
def glob(self, pattern: str) -> Iterable[Content]:
|
||||
for item in self.path.glob(pattern):
|
||||
yield self.load(str(item))
|
||||
|
||||
@cache # noqa: B019
|
||||
def __load_children(self, name: str) -> Content:
|
||||
child_path = self.path / name
|
||||
|
|
|
|||
Loading…
Reference in New Issue