Skip to content

Commit c5abb1a

Browse files
author
Pseudonium
authored
Merge pull request #60 from Pseudonium/develop
Files processed in natural order
2 parents e22ded3 + 5fed678 commit c5abb1a

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

obsidian_to_anki.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,13 +1384,17 @@ def __init__(self, abspath, regex=False, onefile=None):
13841384
self.files = [self.file_class(onefile)]
13851385
else:
13861386
with os.scandir() as it:
1387-
self.files = [
1388-
self.file_class(entry.path)
1389-
for entry in it
1390-
if entry.is_file() and os.path.splitext(
1391-
entry.path
1392-
)[1] in App.SUPPORTED_EXTS
1393-
]
1387+
self.files = sorted(
1388+
[
1389+
self.file_class(entry.path)
1390+
for entry in it
1391+
if entry.is_file() and os.path.splitext(
1392+
entry.path
1393+
)[1] in App.SUPPORTED_EXTS
1394+
], key=lambda file: [
1395+
int(part) if part.isdigit() else part.lower()
1396+
for part in re.split(r'(\d+)', file.filename)]
1397+
)
13941398
for file in self.files:
13951399
file.scan_file()
13961400
os.chdir(self.parent)

obsidian_to_anki_config.ini

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ CurlyCloze = False
4949
GUI = True
5050
Regex = False
5151
ID Comments = True
52-
Anki Path =
53-
Anki Profile =
52+
Anki Path =
53+
Anki Profile =
5454

5555
[Custom Regexps]
56-
Basic =
57-
Basic (and reversed card) =
58-
Basic (optional reversed card) =
59-
Basic (type in the answer) =
60-
Cloze =
56+
Basic =
57+
Basic (and reversed card) =
58+
Basic (optional reversed card) =
59+
Basic (type in the answer) =
60+
Cloze =
6161

6262
[Added Media]
63+

0 commit comments

Comments
 (0)