From 64aea0cd3633a0b24bdf31fa32711c987336fedc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20J=C3=A4hn?= Date: Thu, 15 Aug 2024 15:01:10 +0200 Subject: [PATCH] Cleanup --- scripts/format_external_links.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/format_external_links.py b/scripts/format_external_links.py index 302bfd31..e3029ce2 100755 --- a/scripts/format_external_links.py +++ b/scripts/format_external_links.py @@ -5,14 +5,16 @@ def modify_link(line): replaced = False + # Define icons and attributes + icon_external_link = ':material-open-in-new:' + icon_download = ':material-download:' + open_new_tab = '{:target="_blank"}' + # Define patterns for general and download links general_pattern = r'\[([^\]]+)\]\((http[s]?://[^\s\)]+)\)' download_pattern = r'\[([^\]]+)\]\((https://polybox\.ethz\.ch/index\.php/s/[^\s\)]+)\)' # Define replacements for general and download links - icon_external_link = ':material-open-in-new:' - icon_download = ':material-download:' - open_new_tab = '{:target="_blank"}' general_replacement = r'[\1 ' + icon_external_link + r'](\2)' download_replacement = r'[\1 ' + icon_download + r'](\2)'