rearrange the html filtering to make rewrite rules more predictable

master
Ted Unangst 5 years ago
parent d45de9d733
commit a5f2dd74c2

@ -87,10 +87,17 @@ func reverbolate(userid int64, honks []*Honk) {
if h.Oonker != "" {
_, h.Oondle = handles(h.Oonker)
}
zap := make(map[*Donk]bool)
h.Precis = demoji(h.Precis)
h.Noise = demoji(h.Noise)
h.Open = "open"
{
p, _ := filt.String(h.Precis)
n, _ := filt.String(h.Noise)
h.Precis = string(p)
h.Noise = string(n)
}
if userid == -1 {
if h.Precis != "" {
h.Open = ""
@ -108,8 +115,7 @@ func reverbolate(userid int64, honks []*Honk) {
h.Open = ""
}
h.HTPrecis, _ = filt.String(h.Precis)
h.HTML, _ = filt.String(h.Noise)
zap := make(map[*Donk]bool)
emuxifier := func(e string) string {
for _, d := range h.Donks {
if d.Name == e {
@ -121,8 +127,9 @@ func reverbolate(userid int64, honks []*Honk) {
}
return e
}
h.HTPrecis = template.HTML(re_emus.ReplaceAllStringFunc(string(h.HTPrecis), emuxifier))
h.HTML = template.HTML(re_emus.ReplaceAllStringFunc(string(h.HTML), emuxifier))
h.Precis = re_emus.ReplaceAllStringFunc(h.Precis, emuxifier)
h.Noise = re_emus.ReplaceAllStringFunc(h.Noise, emuxifier)
j := 0
for i := 0; i < len(h.Donks); i++ {
if !zap[h.Donks[i]] {
@ -131,6 +138,9 @@ func reverbolate(userid int64, honks []*Honk) {
}
}
h.Donks = h.Donks[:j]
h.HTPrecis = template.HTML(h.Precis)
h.HTML = template.HTML(h.Noise)
}
}

@ -7,7 +7,7 @@ require (
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
humungus.tedunangst.com/r/go-sqlite3 v1.1.3
humungus.tedunangst.com/r/webs v0.6.13
humungus.tedunangst.com/r/webs v0.6.14
)
go 1.11

@ -25,3 +25,5 @@ humungus.tedunangst.com/r/webs v0.6.12 h1:tRQOF/tJ6FeT3V1KO+8iz+WFNwMQvzMmPqiykD
humungus.tedunangst.com/r/webs v0.6.12/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps=
humungus.tedunangst.com/r/webs v0.6.13 h1:NoPvn+92GVCmMekUCyfgT9rSgDQs6Jp5Fv/tyhHD1Gc=
humungus.tedunangst.com/r/webs v0.6.13/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps=
humungus.tedunangst.com/r/webs v0.6.14 h1:R7UxnmXSw3MN/FMQgCR/Gzn84lOIJ6tnIjgmreApwLo=
humungus.tedunangst.com/r/webs v0.6.14/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps=

Loading…
Cancel
Save