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
3997edb7
Verified
Commit
3997edb7
authored
Feb 18, 2020
by
Laurent Heirendt
✈
Browse files
change mechanism to dump index
parent
25475586
Changes
1
Hide whitespace changes
Inline
Side-by-side
generateIndex.py
View file @
3997edb7
...
...
@@ -60,7 +60,7 @@ for d in dirs:
# set the header of the section
index
+=
"
\n
### "
+
d
.
capitalize
()
+
"
\n
"
localIndexArr
=
[]
localIndexArr
=
[
"
\n
"
]
# walk through the folders with all the cards
for
root
,
dirs
,
files
in
os
.
walk
(
folder
+
"/"
+
d
):
...
...
@@ -115,7 +115,7 @@ for d in dirs:
title
=
title
[
2
:]
#index += " * [" + title + "](./" + root + "/" + "\n"
localIndexArr
.
append
(
"
* ["
+
title
+
"](./"
+
root
+
"/"
+
")
\n
"
)
localIndexArr
.
append
(
"* ["
+
title
+
"](./"
+
root
+
"/"
+
")
\n
"
)
# output
print
(
" + New header added."
)
...
...
@@ -129,8 +129,15 @@ for d in dirs:
#print(index)
# Read in the file
indexFile
=
"index.md"
filedata
=
""
with
open
(
indexFile
,
'r'
)
as
file
:
filedata
=
file
.
read
()
for
line
in
file
:
filedata
+=
line
# stop reading once the index place holder has been reached
if
re
.
search
(
"<!-- index -->"
,
line
):
filedata
+=
"[[ index ]]"
break
# Replace the target string
filedata
=
filedata
.
replace
(
'[[ index ]]'
,
index
)
...
...
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