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

change mechanism to dump index

parent 25475586
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
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