Skip to content
Snippets Groups Projects

[release] Regular merge of develop

Closed cylon-x requested to merge develop into master
84 files
+ 1583
533
Compare changes
  • Side-by-side
  • Inline
Files
84
+ 20
2
import os, re
from os import path
from natsort import natsorted
from pathlib import Path
def line_prepender(filename, line):
with open(filename, 'r+') as f:
@@ -33,7 +34,7 @@ def build_section_start(title, shortcut):
title = title.replace("Covid 19", "COVID-19")
title = title.replace("Ppc", "PPC")
return f'\n\t<div class="index-box noborderbox" id="{shortcut}">\n\t\t<h3>{title}</h3>\n\t\t<ul>\n'
return f'\n\t<div class="index-box noborderbox" id="{shortcut}-card">\n\t\t<h3>{title}</h3>\n\t\t<ul>\n'
def build_section_end():
return "\t\t</ul>\n\t</div>"
@@ -100,6 +101,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 +159,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 +205,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 +234,13 @@ 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"
if Path(whiteListFile).exists():
with open(whiteListFile, 'r') as file :
for line in file:
whiteList += line
with open(whiteListFile, 'w') as file:
file.write(whiteList)
Loading