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

add special treatment to links to preserve backward compatibility

parent 0bd295cb
No related branches found
No related tags found
2 merge requests!354[release] Regular merge of develop,!347Move lab cards external
Pipeline #52776 passed with warnings
...@@ -29,6 +29,17 @@ def root_handbook(href): ...@@ -29,6 +29,17 @@ def root_handbook(href):
return 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): def build_section_start(title, shortcut):
title = title.replace("Gdpr", "GDPR") title = title.replace("Gdpr", "GDPR")
...@@ -250,6 +261,10 @@ for folder in cardDirs: ...@@ -250,6 +261,10 @@ for folder in cardDirs:
if "handbook-annexes" in permalink or "handbook-additional" in permalink: if "handbook-annexes" in permalink or "handbook-additional" in permalink:
header += " - /cards/" + root_handbook(shortcut) + "\n" header += " - /cards/" + root_handbook(shortcut) + "\n"
header += " - /" + folder + "/cards/" + root_handbook(shortcut) + "\n" header += " - /" + folder + "/cards/" + root_handbook(shortcut) + "\n"
# after moving lab cards
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 # include the legacy section
if len(legacy_from) > 0: if len(legacy_from) > 0:
...@@ -261,11 +276,15 @@ for folder in cardDirs: ...@@ -261,11 +276,15 @@ for folder in cardDirs:
# add autogenerated links to whitelist # add autogenerated links to whitelist
whiteList += permalink + "\n" whiteList += permalink + "\n"
whiteList += "/?" + shortcut + "\n" whiteList += "/?" + shortcut + "\n"
whiteList += "/cards/" +shortcut + "\n" whiteList += "/cards/" + shortcut + "\n"
whiteList += "/" + folder + "/cards/" + shortcut + "\n" whiteList += "/" + folder + "/cards/" + shortcut + "\n"
if "handbook-annexes" in permalink or "handbook-additional" in permalink: if "handbook-annexes" in permalink or "handbook-additional" in permalink:
whiteList += " - /cards/" + root_handbook(shortcut) + "\n" whiteList += " - /cards/" + root_handbook(shortcut) + "\n"
whiteList += " - /" + folder + "/cards/" + root_handbook(shortcut) + "\n" whiteList += " - /" + folder + "/cards/" + root_handbook(shortcut) + "\n"
# after moving lab cards
if "lab-software" in permalink or "lab-equipment" in permalink or "lab-hsa" in permalink:
whiteList += " - /cards/" + root_lab(shortcut) + "\n"
whiteList += " - /" + folder + "/cards/" + root_lab(shortcut) + "\n"
# add the header properly speaking # add the header properly speaking
line_prepender(fileName, header) line_prepender(fileName, header)
......
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