aboutsummaryrefslogtreecommitdiff
path: root/format.c
diff options
context:
space:
mode:
authorSanttu Lakkala <inz@inz.fi>2025-01-31 13:58:10 +0200
committerSanttu Lakkala <santtu.lakkala@unikie.com>2025-02-05 10:57:27 +0200
commit52c45718208f076ba1e4a30d7d54655cb4dcc78c (patch)
treef7eae615376ba7aa64ba1d7351d0b9a935f63649 /format.c
parent8f76c4d8f6ac9d4fa81ab9fd13d8f5e8e65ea8b8 (diff)
Fix link detection. Fixes: #290
Diffstat (limited to 'format.c')
-rw-r--r--format.c6
1 files changed, 4 insertions, 2 deletions
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;