commit 52c4571
Santtu Lakkala
·
2025-01-31 11:58:10 +0000 UTC
parent 8f76c4d
Fix link detection. Fixes: #290
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