Manual selecting emojis on page by codes contain

This commit is contained in:
localhost_frssoft 2022-09-19 23:41:35 +03:00
parent 5f688c6318
commit f219ac0dca
2 changed files with 13 additions and 0 deletions

View file

@ -40,6 +40,16 @@ type TemplateData struct {
Ctx *Context
}
func allowed_emoji_page(emoj string, codes ...string) bool {
for _, code := range codes {
if strings.Contains(emoj, code) {
return true
}
}
return false
}
func emojiHTML(e mastodon.Emoji, height string) string {
return `<img class="emoji" src="` + e.URL + `" alt=":` + e.ShortCode + `:" title=":` + e.ShortCode + `:" height="` + height + `"/>`
}
@ -142,6 +152,7 @@ func NewRenderer(templateGlobPattern string) (r *renderer, err error) {
t := template.New("default")
t, err = t.Funcs(template.FuncMap{
"EmojiFilter": emojiFilter,
"Allowed_emoji_page": allowed_emoji_page,
"StatusContentFilter": statusContentFilter,
"DisplayInteractionCount": displayInteractionCount,
"TimeSince": timeSince,