Sort the entries alphabetically
This commit is contained in:
parent
b4066c1552
commit
4446c33fd2
|
@ -67,6 +67,9 @@ class DocumentNode():
|
||||||
if file not in children:
|
if file not in children:
|
||||||
children.append(DocumentNode(file, []))
|
children.append(DocumentNode(file, []))
|
||||||
|
|
||||||
|
# With this algorithm they're not properly sorted
|
||||||
|
children.sort(key=lambda x: x.name)
|
||||||
|
|
||||||
return DocumentNode(path.split('/')[-1], children)
|
return DocumentNode(path.split('/')[-1], children)
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,7 +101,7 @@ class DocumentTree():
|
||||||
internal_path = os.path.join(self.base, *path.split('/')) + '.md'
|
internal_path = os.path.join(self.base, *path.split('/')) + '.md'
|
||||||
|
|
||||||
# TODO: Probably add some sort of confirmation beforehand?
|
# TODO: Probably add some sort of confirmation beforehand?
|
||||||
os.makedirs(os.path.dirname(internal_path))
|
os.makedirs(os.path.dirname(internal_path), exist_ok=True)
|
||||||
with open(internal_path, 'w') as file:
|
with open(internal_path, 'w') as file:
|
||||||
file.write(text)
|
file.write(text)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue