commit 52c45718208f076ba1e4a30d7d54655cb4dcc78c
parent 8f76c4d8f6ac9d4fa81ab9fd13d8f5e8e65ea8b8
Author: Santtu Lakkala <inz@inz.fi>
Date: Fri, 31 Jan 2025 13:58:10 +0200
Fix link detection. Fixes: #290
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;