From 5256a324031c3314e13959e20541b7c293239f0d Mon Sep 17 00:00:00 2001 From: laurentheirendt <laurent.heirendt@uni.lu> Date: Tue, 24 Aug 2021 09:05:33 +0200 Subject: [PATCH] draft to generate headers in whitelist --- .ci/generateIndex.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.ci/generateIndex.py b/.ci/generateIndex.py index bb897388..e54a7c68 100644 --- a/.ci/generateIndex.py +++ b/.ci/generateIndex.py @@ -100,6 +100,7 @@ sections = natsorted(sections) # Index contains the generated content, init it with an empty container index = '' index += '\n<div class="index-box-container">\n' +whiteList = '' localIndexArr = [[]] * len(sections) for folder in cardDirs: @@ -157,6 +158,12 @@ for folder in cardDirs: header += " - /" + folder + "/cards/" + shortcut + "\n" header += "---" + # add autogenerated links to whitelist + whiteList += permalink + "\n" + whiteList += "/?" + shortcut + "\n" + whiteList += "/cards/" +shortcut + "\n" + whiteList += "/" + folder + "/cards/" + shortcut + "\n" + # add the header properly speaking line_prepender(fileName, header) @@ -197,7 +204,7 @@ for s in sections: index += build_section_end() k += 1 -# Close the container +# close the container index += "\n</div>" ## add link to return to main index @@ -226,3 +233,12 @@ with open(indexFile, 'w') as file: file.write(filedata) print("\n > New index generated and saved in " + indexFile) + +# write link whitelist out +whiteListFile = ".ci/whitelist.txt" +with open(whiteListFile, 'r') as file : + for line in file: + whiteList += line + +with open(whiteListFile, 'w') as file: + file.write(whiteList) -- GitLab