cleanup up emoji in hoots
This commit is contained in:
parent
4ed4ae3186
commit
65a27bf359
5
hoot.go
5
hoot.go
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue