From ee047312a1a3238a8504200f7ded8536ebc838e3 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 24 Aug 2020 03:44:53 +0200 Subject: Fix emoji replacements, make emoji images consistent (#12567) - Fix emoji not being replaced in issue title change text - Make the image attributes consistent, add alt, remove align Co-authored-by: zeripath Co-authored-by: techknowlogick --- modules/markup/html.go | 1 + modules/markup/html_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/markup') diff --git a/modules/markup/html.go b/modules/markup/html.go index 41248654d8..bef6269a69 100644 --- a/modules/markup/html.go +++ b/modules/markup/html.go @@ -481,6 +481,7 @@ func createCustomEmoji(alias, class string) *html.Node { Attr: []html.Attribute{}, } if class != "" { + img.Attr = append(img.Attr, html.Attribute{Key: "alt", Val: fmt.Sprintf(`:%s:`, alias)}) img.Attr = append(img.Attr, html.Attribute{Key: "src", Val: fmt.Sprintf(`%s/img/emoji/%s.png`, setting.StaticURLPrefix, alias)}) } diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go index 69c4e675f5..7f820d3990 100644 --- a/modules/markup/html_test.go +++ b/modules/markup/html_test.go @@ -255,7 +255,7 @@ func TestRender_emoji(t *testing.T) { //Text that should be turned into or recognized as emoji test( ":gitea:", - `

`) + `

:gitea:

`) test( "Some text with 😄 in the middle", -- cgit v1.2.3