Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
R3
howto-cards
Commits
131d6bf1
Verified
Commit
131d6bf1
authored
Feb 18, 2020
by
Laurent Heirendt
✈
Browse files
sort entries in the index
parent
5898e4da
Changes
1
Hide whitespace changes
Inline
Side-by-side
generateIndex.py
View file @
131d6bf1
...
...
@@ -57,8 +57,12 @@ dirs = sorted(dirs)
index
=
""
for
d
in
dirs
:
# set the header of the section
index
+=
"### "
+
d
.
capitalize
()
+
"
\n
"
localIndexArr
=
[]
# walk through the folders with all the cards
for
root
,
dirs
,
files
in
os
.
walk
(
folder
+
"/"
+
d
):
for
file
in
files
:
if
file
.
endswith
(
".md"
):
...
...
@@ -110,11 +114,16 @@ for d in dirs:
title
=
title
.
rstrip
(
"
\n\r
"
)
title
=
title
[
2
:]
index
+=
" * ["
+
title
+
"](./"
+
root
+
"/"
+
"
\n
"
#index += " * [" + title + "](./" + root + "/" + "\n"
localIndexArr
.
append
(
" * ["
+
title
+
"](./"
+
root
+
"/"
+
"
\n
"
)
# output
print
(
" + New header added."
)
print
(
"-----------------------"
)
# join all subcategories to the index
localIndexArr
.
sort
()
index
+=
''
.
join
(
localIndexArr
)
# output the index
print
(
index
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment