Do not include trailing punctuation or whitespace in plain links.

This commit is contained in:
Tom Alexander 2023-08-29 17:35:04 -04:00
parent 66037356c5
commit f426e32798
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 9 additions and 1 deletions

View File

@ -1 +1,3 @@
mailto:foo@bar.baz.
mailto:foo@bar.baz....

View File

@ -134,6 +134,7 @@ fn path_plain<'r, 's>(
many_till(anychar, peek(exit_matcher)),
|(children, _exit_contents)| !children.is_empty(),
))(input)?;
Ok((remaining, path))
}
@ -142,5 +143,10 @@ fn path_plain_end<'r, 's>(
_context: Context<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
recognize(one_of(" \t\r\n()[]<>"))(input)
recognize(many_till(
verify(anychar, |c| {
*c != '/' && (c.is_ascii_punctuation() || c.is_whitespace())
}),
one_of(" \t\r\n()[]<>"),
))(input)
}