From 1c6cbbe9ed1f6427f1c8d1b166248a1e0e7c9ffc Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Mon, 24 Jul 2023 22:22:16 +0300 Subject: [PATCH] better auto-link --- forum/minimd.py | 4 ++-- restart.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/forum/minimd.py b/forum/minimd.py index 40a80b3..c81addd 100755 --- a/forum/minimd.py +++ b/forum/minimd.py @@ -11,11 +11,11 @@ RE_EM = re.compile(r"\*(.*?)\*") RE_LIST = re.compile(r"(-|[0-9]\.) .*") RE_PLAINURL = re.compile( - r"([ |\n])(https?://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-]))[^\)]" + r"(?P
^|\s|\n)(?Phttps?://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-]))(?P\s|\n|$)"
 )
 
 def html(text):
-    text = RE_PLAINURL.sub(r'\1[\2](\2)', text)
+    text = RE_PLAINURL.sub(r'\g
[\g](\g)\g', text)
     return markdown2.markdown(text)
 
 
diff --git a/restart.sh b/restart.sh
index fc77957..e56c829 100755
--- a/restart.sh
+++ b/restart.sh
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
 
 set -e
-docker-compose up -d -t 0 --build forum
+docker-compose up -d -t 0 --build --force-recreate forum
 docker-compose logs -f