Skip to content
Snippets Groups Projects

[release] Regular merge of develop

Merged cylon-x requested to merge develop into master
164 files
+ 159
77
Compare changes
  • Side-by-side
  • Inline
Files
164
+ 64
34
@@ -29,13 +29,27 @@ def root_handbook(href):
return href
def root_lab(href):
# remove sym link reference in href
if ('lab-software' in href):
href = href.replace('lab-software', 'lab').strip()
elif ('lab-equipment' in href):
href = href.replace('lab-equipment', 'lab').strip()
elif ('lab-hsa' in href):
href = href.replace('lab-hsa', 'lab').strip()
return href
def build_section_start(title, shortcut):
title = title.replace("Gdpr", "GDPR")
title = title.replace("Handbook additional", "PI/Supervisor specifics")
title = title.replace("Handbook annexes", "Annexes")
title = title.replace("Handbook additional", "Handbook: PI/Supervisor specifics")
title = title.replace("Handbook annexes", "Handbook: Annexes")
title = title.replace("Covid 19", "COVID-19")
title = title.replace("Ppc", "PPC")
title = title.replace("Lab software", "Lab: Software")
title = title.replace("Lab equipment", "Lab: Equipment")
title = title.replace("Lab hsa", "Lab: Health & Safety, Access")
return f'\n\t<div class="index-box noborderbox" id="{shortcut}-card">\n\t\t<h3>{title}</h3>\n\t\t<ul>\n'
@@ -133,6 +147,50 @@ def remove_header(localroot, root, filename):
return n
def generate_header(folder, permalink, shortcut, order, legacy_from):
header = "---\n"
if len(order) > 0:
header += "order: " + str(order) + "\n"
header += "layout: page\n"
header += "permalink: " + permalink + "\n"
header += "shortcut: " + root_handbook(shortcut) + "\n"
header += "redirect_from:\n"
header += " - /cards/" + shortcut + "\n"
header += " - /" + folder + "/cards/" + shortcut + "\n"
# special case of handbook
if "handbook-annexes" in permalink or "handbook-additional" in permalink:
header += " - /cards/" + root_handbook(shortcut) + "\n"
header += " - /" + folder + "/cards/" + root_handbook(shortcut) + "\n"
# separate lab section
if "lab-software" in permalink or "lab-equipment" in permalink or "lab-hsa" in permalink:
header += " - /cards/" + root_lab(shortcut) + "\n"
header += " - /" + folder + "/cards/" + root_lab(shortcut) + "\n"
# include the legacy section
if len(legacy_from) > 0:
for item in legacy_from:
header += str(item)
else:
header += "---"
return header
def generate_whitelist_entry(folder, permalink, shortcut):
wl_entry = permalink + "\n"
wl_entry += "/?" + shortcut + "\n"
wl_entry += "/cards/" + shortcut + "\n"
wl_entry += "/" + folder + "/cards/" + shortcut + "\n"
if "handbook-annexes" in permalink or "handbook-additional" in permalink:
wl_entry += "/cards/" + root_handbook(shortcut) + "\n"
wl_entry += "/" + folder + "/cards/" + root_handbook(shortcut) + "\n"
# separate lab section
if "lab-software" in permalink or "lab-equipment" in permalink or "lab-hsa" in permalink:
wl_entry += "/cards/" + root_lab(shortcut) + "\n"
wl_entry += "/" + folder + "/cards/" + root_lab(shortcut) + "\n"
return wl_entry
# loop through the entire internal tree
localroot = os.getcwd()
@@ -214,14 +272,8 @@ for folder in cardDirs:
# replace the / with a :
shortcut = re.sub('/', ':', shortcut)
# define the header for each card
header = "---\n"
if len(order) > 0:
header += "order: " + str(order) + "\n"
# append the order of the card
# find the maximum of existing orders
# find the maximum of existing orders
if folderFlag:
if len(orderArr[indexS]) > 0:
maxOrder = max(orderArr[indexS])
@@ -236,33 +288,11 @@ for folder in cardDirs:
else:
orderArr[indexS] = []
header += "layout: page\n"
header += "permalink: " + permalink + "\n"
header += "shortcut: " + root_handbook(shortcut) + "\n"
header += "redirect_from:\n"
header += " - /cards/" + shortcut + "\n"
header += " - /" + folder + "/cards/" + shortcut + "\n"
# special case of handbook
if "handbook-annexes" in permalink or "handbook-additional" in permalink:
header += " - /cards/" + root_handbook(shortcut) + "\n"
header += " - /" + folder + "/cards/" + root_handbook(shortcut) + "\n"
# include the legacy section
if len(legacy_from) > 0:
for item in legacy_from:
header += str(item)
else:
header += "---"
# generate the header for each card
header = generate_header(folder, permalink, shortcut, order, legacy_from)
# add autogenerated links to whitelist
whiteList += permalink + "\n"
whiteList += "/?" + shortcut + "\n"
whiteList += "/cards/" +shortcut + "\n"
whiteList += "/" + folder + "/cards/" + shortcut + "\n"
if "handbook-annexes" in permalink or "handbook-additional" in permalink:
whiteList += " - /cards/" + root_handbook(shortcut) + "\n"
whiteList += " - /" + folder + "/cards/" + root_handbook(shortcut) + "\n"
whiteList += generate_whitelist_entry(folder, permalink, shortcut)
# add the header properly speaking
line_prepender(fileName, header)
Loading