Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaehn committed Aug 15, 2024
1 parent e5876aa commit 64aea0c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/format_external_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)'

Expand Down

0 comments on commit 64aea0c

Please sign in to comment.