better auto-link

This commit is contained in:
Ville Rantanen
2023-07-24 22:22:16 +03:00
parent 384051bcd4
commit 1c6cbbe9ed
2 changed files with 3 additions and 3 deletions

View File

@@ -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<pre>^|\s|\n)(?P<url>https?://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-]))(?P<post>\s|\n|$)"
)
def html(text):
text = RE_PLAINURL.sub(r'\1[\2](\2)', text)
text = RE_PLAINURL.sub(r'\g<pre>[\g<url>](\g<url>)\g<post>', text)
return markdown2.markdown(text)

View File

@@ -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