rearrange the html filtering to make rewrite rules more predictable
Ted Unangst tedu@tedunangst.com
Wed, 16 Oct 2019 18:04:38 -0400
M
fun.go
→
fun.go
@@ -87,10 +87,17 @@ }
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 @@ }
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 @@ }
} 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 @@ j++
} } h.Donks = h.Donks[:j] + + h.HTPrecis = template.HTML(h.Precis) + h.HTML = template.HTML(h.Noise) } }
M
go.mod
→
go.mod
@@ -7,7 +7,7 @@ github.com/mattn/go-runewidth v0.0.4
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
M
go.sum
→
go.sum
@@ -25,3 +25,5 @@ humungus.tedunangst.com/r/webs v0.6.12 h1:tRQOF/tJ6FeT3V1KO+8iz+WFNwMQvzMmPqiykD0rgnA=
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=