commit 6b4b3317e3ba5fb6570c43a307383b43cd609eb1
parent 1d37e33e405975ce740be89fc02968cc7ec09b0f
Author: grunfink <grunfink@noreply.codeberg.org>
Date: Wed, 5 Feb 2025 09:17:02 +0000
Merge pull request 'Fix link detection. Fixes: #290' (#296) from inz/snac2:link-detect into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/296
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/format.c b/format.c
@@ -78,6 +78,8 @@ xs_dict *emojis(void)
return d;
}
+/* Non-whitespace without trailing comma, period or closing paren */
+#define NOSPACE "([^[:space:],.)]+|[,.)]+[^[:space:],.)])+"
static xs_str *format_line(const char *line, xs_list **attach)
/* formats a line */
@@ -96,8 +98,8 @@ static xs_str *format_line(const char *line, xs_list **attach)
"__[^_]+__" "|" //anzu
"!\\[[^]]+\\]\\([^\\)]+\\)" "|"
"\\[[^]]+\\]\\([^\\)]+\\)" "|"
- "[a-z]+:/" "/[^[:space:]]+" "|"
- "(mailto|xmpp):[^@[:space:]]+@[^[:space:]]+"
+ "[a-z]+:/" "/" NOSPACE "|"
+ "(mailto|xmpp):[^@[:space:]]+@" NOSPACE
")");
int n = 0;