all repos — honk @ c01ea21a29f8c98f662895b3132b6b100bf67219

my fork of honk

cleanup up emoji in hoots
Ted Unangst tedu@tedunangst.com
Sun, 19 Feb 2023 19:39:13 -0500
commit

c01ea21a29f8c98f662895b3132b6b100bf67219

parent

a4404276b31370652ab7cf8734096a153344ccd2

1 files changed, 3 insertions(+), 2 deletions(-)

jump to
M hoot.gohoot.go

@@ -55,10 +55,11 @@

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(" <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