From 52c45718208f076ba1e4a30d7d54655cb4dcc78c Mon Sep 17 00:00:00 2001 From: Santtu Lakkala Date: Fri, 31 Jan 2025 13:58:10 +0200 Subject: Fix link detection. Fixes: #290 --- format.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'format.c') diff --git a/format.c b/format.c index e5934b8..4c8ed29 100644 --- 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; -- cgit v1.2.3