1
0
Fork 0
forked from forgejo/forgejo

Allow 's in mentions

When mentioning a user in a comment, or a similar place, sometimes one
would wish to use a possessive: `As per @user's suggestion` or somesuch.
This patch modifies the `mentionPattern` used to find mentions, to allow
- and then ignore - apostrophes and whatever comes after them.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
Gergely Nagy 2024-02-27 11:04:12 +01:00 committed by Earl Warren
parent c39321c6ca
commit 00b24d2d9a
3 changed files with 9 additions and 1 deletions

View file

@ -59,6 +59,11 @@ func TestMain(m *testing.M) {
os.Exit(m.Run())
}
func TestApostrophesInMentions(t *testing.T) {
rendered := RenderMarkdownToHtml(context.Background(), "@mention-user's comment")
assert.EqualValues(t, "<p><a href=\"http://localhost:3000/mention-user\" rel=\"nofollow\">@mention-user</a>&#39;s comment</p>\n", rendered)
}
func TestRenderCommitBody(t *testing.T) {
type args struct {
ctx context.Context