diff --git a/obsidian_to_anki.py b/obsidian_to_anki.py index 315ff21a..3165a01c 100644 --- a/obsidian_to_anki.py +++ b/obsidian_to_anki.py @@ -1384,13 +1384,17 @@ def __init__(self, abspath, regex=False, onefile=None): self.files = [self.file_class(onefile)] else: with os.scandir() as it: - self.files = [ - self.file_class(entry.path) - for entry in it - if entry.is_file() and os.path.splitext( - entry.path - )[1] in App.SUPPORTED_EXTS - ] + self.files = sorted( + [ + self.file_class(entry.path) + for entry in it + if entry.is_file() and os.path.splitext( + entry.path + )[1] in App.SUPPORTED_EXTS + ], key=lambda file: [ + int(part) if part.isdigit() else part.lower() + for part in re.split(r'(\d+)', file.filename)] + ) for file in self.files: file.scan_file() os.chdir(self.parent) diff --git a/obsidian_to_anki_config.ini b/obsidian_to_anki_config.ini index e5149fda..4fb53c4d 100644 --- a/obsidian_to_anki_config.ini +++ b/obsidian_to_anki_config.ini @@ -49,14 +49,15 @@ CurlyCloze = False GUI = True Regex = False ID Comments = True -Anki Path = -Anki Profile = +Anki Path = +Anki Profile = [Custom Regexps] -Basic = -Basic (and reversed card) = -Basic (optional reversed card) = -Basic (type in the answer) = -Cloze = +Basic = +Basic (and reversed card) = +Basic (optional reversed card) = +Basic (type in the answer) = +Cloze = [Added Media] +