better herding of emus

This commit is contained in:
Ted Unangst 2019-04-13 12:32:24 -04:00
parent 6bd837c378
commit 02da8c739a
2 changed files with 7 additions and 1 deletions

View File

@ -575,6 +575,9 @@ func jonkjonk(user *WhatAbout, h *Honk) (map[string]interface{}, map[string]inte
}
var atts []interface{}
for _, d := range h.Donks {
if re_emus.MatchString(d.Name) {
continue
}
jd := NewJunk()
jd["mediaType"] = d.Media
jd["name"] = d.Name

View File

@ -170,7 +170,9 @@ func reverbolate(honks []*Honk) {
h.HTML = template.HTML(re_emus.ReplaceAllStringFunc(string(h.HTML), emuxifier))
for i := 0; i < len(h.Donks); i++ {
if zap[h.Donks[i]] {
h.Donks = append(h.Donks[0:i], h.Donks[i+1:]...)
copy(h.Donks[i:], h.Donks[i+1:])
h.Donks = h.Donks[:len(h.Donks)-1]
i--
}
}
}
@ -824,6 +826,7 @@ var re_emus = regexp.MustCompile(`:[[:alnum:]_]+:`)
func herdofemus(noise string) []Emu {
m := re_emus.FindAllString(noise, -1)
m = oneofakind(m)
var emus []Emu
for _, e := range m {
fname := e[1 : len(e)-1]