cleanup up emoji in hoots

This commit is contained in:
Ted Unangst 2023-02-19 19:39:13 -05:00
parent 4ed4ae3186
commit 65a27bf359
1 changed files with 3 additions and 2 deletions

View File

@ -55,10 +55,11 @@ func hootextractor(r io.Reader, url string, seen map[string]bool) string {
var htf htfilter.Filter var htf htfilter.Filter
htf.Imager = func(node *html.Node) string { htf.Imager = func(node *html.Node) string {
alt := htfilter.GetAttr(node, "alt") alt := htfilter.GetAttr(node, "alt")
if htfilter.HasClass(node, "Emoji") && alt != "" { src := htfilter.GetAttr(node, "src")
if htfilter.HasClass(node, "Emoji") || strings.HasSuffix(src, ".svg") {
return alt return alt
} }
return string(templates.Sprintf(" <img src='%s' alt='%s'>", htfilter.GetAttr(node, "src"), alt)) return string(templates.Sprintf(" <img src='%s' alt='%s'>", src, alt))
} }
var buf strings.Builder var buf strings.Builder