From 06dcc71a90b67de144d7812a9ece4d2fbcc32446 Mon Sep 17 00:00:00 2001 From: Carina Schmitt <cschmitt@mpi-klsb.mpg.de> Date: Wed, 9 Nov 2022 09:14:22 +0000 Subject: [PATCH] use custom alectryon driver to comply with DSGVO (Germany privacy law) The generated HTML pages must reference MPI-SWS servers, not third-party CDNs. --- scripts/alectryon.sh | 2 +- scripts/alectryon_custom_driver.py | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 scripts/alectryon_custom_driver.py diff --git a/scripts/alectryon.sh b/scripts/alectryon.sh index 0dbcbf518..7a8de83aa 100755 --- a/scripts/alectryon.sh +++ b/scripts/alectryon.sh @@ -1,7 +1,7 @@ #!/bin/sh set -e -ALE="alectryon" +ALE="python3 ./scripts/alectryon_custom_driver.py" OUT="./html-alectryon" mkdir -p "$OUT" diff --git a/scripts/alectryon_custom_driver.py b/scripts/alectryon_custom_driver.py new file mode 100644 index 000000000..5736c06a5 --- /dev/null +++ b/scripts/alectryon_custom_driver.py @@ -0,0 +1,27 @@ +#!/usr/bin/python3 + +import re +import sys +from alectryon import cli +from alectryon.html import ASSETS + +current_fira_version = '5.2.0' +current_ibmtype_version = '0.5.4' + +assets_ibmtype_version = re.search(r'\d+\.\d+\.\d+', ASSETS.IBM_PLEX_CDN).group() +assets_fira_version = re.search(r'\d+\.\d+\.\d+', ASSETS.FIRA_CODE_CDN).group() + +if str(current_ibmtype_version) == str(assets_ibmtype_version): +#https://cdnjs.cloudflare.com/ajax/libs/IBM-type/0.5.4/css/ibm-type.min.css + ASSETS.IBM_PLEX_CDN = '<link rel="stylesheet" href="https://cdn.mpi-klsb.mpg.de/IBM-type/' + str(current_ibmtype_version) + '/css/ibm-type.min.css" />' +else: + sys.stderr.write("Assets: ASSETS.IBM_PLEX_CDN changed from " + str(current_ibmtype_version) + " to " + str(assets_ibmtype_version) + "\n") + +if str(current_fira_version) == str(assets_fira_version): +#https://cdnjs.cloudflare.com/ajax/libs/firacode/5.2.0/fira_code.min.css + ASSETS.FIRA_CODE_CDN = '<link rel="stylesheet" href="https://cdn.mpi-klsb.mpg.de/firacode/' + str(current_fira_version) + '/fira_code.min.css" />' +else: + sys.stderr.write("Assets: FIRA_CODE_CDN changed from " + str(current_fira_version) + " to " + str(assets_fira_version) + " \n") + +cli.main() + -- GitLab