From 65a27bf3599170681a5c62494b4390aba7300615 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sun, 19 Feb 2023 19:39:13 -0500 Subject: [PATCH] cleanup up emoji in hoots --- hoot.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hoot.go b/hoot.go index 5ebedee..a1a93ac 100644 --- a/hoot.go +++ b/hoot.go @@ -55,10 +55,11 @@ func hootextractor(r io.Reader, url string, seen map[string]bool) string { var htf htfilter.Filter htf.Imager = func(node *html.Node) string { 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 string(templates.Sprintf(" %s", htfilter.GetAttr(node, "src"), alt)) + return string(templates.Sprintf(" %s", src, alt)) } var buf strings.Builder