From 2a191560266ea1f0dfc4c337eadfddbde9cfd97d Mon Sep 17 00:00:00 2001 From: laurentheirendt <laurent.heirendt@uni.lu> Date: Mon, 21 Feb 2022 06:50:17 +0100 Subject: [PATCH] add special treatment to links to preserve backward compatibility --- .ci/generateIndex.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.ci/generateIndex.py b/.ci/generateIndex.py index f4d04998..85d0345c 100644 --- a/.ci/generateIndex.py +++ b/.ci/generateIndex.py @@ -29,6 +29,17 @@ 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") @@ -250,6 +261,10 @@ for folder in cardDirs: if "handbook-annexes" in permalink or "handbook-additional" in permalink: header += " - /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 if len(legacy_from) > 0: @@ -261,11 +276,15 @@ for folder in cardDirs: # add autogenerated links to whitelist whiteList += permalink + "\n" whiteList += "/?" + shortcut + "\n" - whiteList += "/cards/" +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" + # 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 line_prepender(fileName, header) -- GitLab