commit 6b4b331
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
1 files changed,
+4,
-2
M
format.c
M
format.c
+4,
-2
1@@ -78,6 +78,8 @@ xs_dict *emojis(void)
2 return d;
3 }
4
5+/* Non-whitespace without trailing comma, period or closing paren */
6+#define NOSPACE "([^[:space:],.)]+|[,.)]+[^[:space:],.)])+"
7
8 static xs_str *format_line(const char *line, xs_list **attach)
9 /* formats a line */
10@@ -96,8 +98,8 @@ static xs_str *format_line(const char *line, xs_list **attach)
11 "__[^_]+__" "|" //anzu
12 "!\\[[^]]+\\]\\([^\\)]+\\)" "|"
13 "\\[[^]]+\\]\\([^\\)]+\\)" "|"
14- "[a-z]+:/" "/[^[:space:]]+" "|"
15- "(mailto|xmpp):[^@[:space:]]+@[^[:space:]]+"
16+ "[a-z]+:/" "/" NOSPACE "|"
17+ "(mailto|xmpp):[^@[:space:]]+@" NOSPACE
18 ")");
19 int n = 0;
20