Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
raw_dir,
site_dir,
write_settings,
get_ignore_list,
filter_obsidian_files
)

if __name__ == "__main__":
Expand All @@ -25,7 +27,10 @@
section_count = 0

all_paths = list(sorted(raw_dir.glob("**/*")))

# Filter files found in an optional .zolaignore file
ignore_list = get_ignore_list()
if len(ignore_list) > 0:
all_paths = list(filter(filter_obsidian_files(ignore_list), all_paths))
for path in [raw_dir, *all_paths]:
doc_path = DocPath(path)
if doc_path.is_file:
Expand Down
17 changes: 17 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,20 @@ def write_settings():
]
)
)


def get_ignore_list():
ignore_file = site_dir.parent.parent / ".zolaignore"
ignore_list = []
if ignore_file.exists():
print("found ignore file, processing...")
with open(ignore_file, encoding="utf-8") as f:
for line in f:
print("ignoring " + line)
ignore_list.append(line.rstrip())
return ignore_list
print("No ignore file found.")
return []

def filter_obsidian_files(ignore_list):
return lambda a: next(filter(lambda x: a.match(x), ignore_list), None) is None