Skip to content
Snippets Groups Projects
Verified Commit 3ee4990e authored by Laurent Heirendt's avatar Laurent Heirendt :airplane:
Browse files

inplace editing of index

parent da014728
No related branches found
No related tags found
2 merge requests!72Regular merge of develop,!70Major update: streamline repository
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment