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
3ee4990e
Verified
Commit
3ee4990e
authored
Feb 18, 2020
by
Laurent Heirendt
✈
Browse files
inplace editing of index
parent
da014728
Changes
1
Hide whitespace changes
Inline
Side-by-side
generateIndex.py
View file @
3ee4990e
...
...
@@ -59,7 +59,7 @@ index = ""
for
d
in
dirs
:
# set the header of the section
index
+=
"### "
+
d
.
capitalize
()
+
"
\n
"
index
+=
"
\n
### "
+
d
.
capitalize
()
+
"
\n
"
localIndexArr
=
[]
# walk through the folders with all the cards
...
...
@@ -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."
)
...
...
@@ -126,4 +126,15 @@ for d in dirs:
index
+=
''
.
join
(
localIndexArr
)
# output the index
print
(
index
)
\ No newline at end of file
#print(index)
# Read in the file
indexFile
=
"index.md"
with
open
(
indexFile
,
'r'
)
as
file
:
filedata
=
file
.
read
()
# Replace the target string
filedata
=
filedata
.
replace
(
'[[ index ]]'
,
index
)
# Write the file out again
with
open
(
indexFile
,
'w'
)
as
file
:
file
.
write
(
filedata
)
\ 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