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

prepare qms

parent 39cd9dc0
No related branches found
No related tags found
No related merge requests found
......@@ -239,6 +239,35 @@ def generate_whitelist_entry(folder, permalink, shortcut):
return wl_entry
def prepare_qms(localroot, root, filename):
os.chdir(root)
filedata = ""
with open(filename, 'r') as file :
for line in file:
filedata += line
# shift the subtitles by 1 level down
filedata = filedata.replace("#", "##")
# replace latex command for titles
filedata = filedata.replace("{-}", "##")
# deal with img location
filedata = filedata.replace("policies/"+filename[:-3]+"/", "")
filedata = filedata.replace("sops/"+filename[:-3]+"/", "")
# replace img attributes
filedata = filename.replace("{ width=50% }", "")
# Write the file out again
with open(filename, 'w') as file:
file.write(filedata)
# change back to the local root
os.chdir(localroot)
# loop through the entire internal tree
localroot = os.getcwd()
......@@ -310,6 +339,7 @@ for folder in cardDirs:
# extract the title from the QMS metadata
if "qms" in root:
title = save_tag(localroot, root, file[:-3] + ".yml", "title")
prepare_qms(localroot, root, file)
# remove the previous header
n = remove_header(localroot, root, 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