rearrange the html filtering to make rewrite rules more predictable
This commit is contained in:
parent
d45de9d733
commit
a5f2dd74c2
20
fun.go
20
fun.go
|
@ -87,10 +87,17 @@ func reverbolate(userid int64, honks []*Honk) {
|
||||||
if h.Oonker != "" {
|
if h.Oonker != "" {
|
||||||
_, h.Oondle = handles(h.Oonker)
|
_, h.Oondle = handles(h.Oonker)
|
||||||
}
|
}
|
||||||
zap := make(map[*Donk]bool)
|
|
||||||
h.Precis = demoji(h.Precis)
|
h.Precis = demoji(h.Precis)
|
||||||
h.Noise = demoji(h.Noise)
|
h.Noise = demoji(h.Noise)
|
||||||
h.Open = "open"
|
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 userid == -1 {
|
||||||
if h.Precis != "" {
|
if h.Precis != "" {
|
||||||
h.Open = ""
|
h.Open = ""
|
||||||
|
@ -108,8 +115,7 @@ func reverbolate(userid int64, honks []*Honk) {
|
||||||
h.Open = ""
|
h.Open = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
h.HTPrecis, _ = filt.String(h.Precis)
|
zap := make(map[*Donk]bool)
|
||||||
h.HTML, _ = filt.String(h.Noise)
|
|
||||||
emuxifier := func(e string) string {
|
emuxifier := func(e string) string {
|
||||||
for _, d := range h.Donks {
|
for _, d := range h.Donks {
|
||||||
if d.Name == e {
|
if d.Name == e {
|
||||||
|
@ -121,8 +127,9 @@ func reverbolate(userid int64, honks []*Honk) {
|
||||||
}
|
}
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
h.HTPrecis = template.HTML(re_emus.ReplaceAllStringFunc(string(h.HTPrecis), emuxifier))
|
h.Precis = re_emus.ReplaceAllStringFunc(h.Precis, emuxifier)
|
||||||
h.HTML = template.HTML(re_emus.ReplaceAllStringFunc(string(h.HTML), emuxifier))
|
h.Noise = re_emus.ReplaceAllStringFunc(h.Noise, emuxifier)
|
||||||
|
|
||||||
j := 0
|
j := 0
|
||||||
for i := 0; i < len(h.Donks); i++ {
|
for i := 0; i < len(h.Donks); i++ {
|
||||||
if !zap[h.Donks[i]] {
|
if !zap[h.Donks[i]] {
|
||||||
|
@ -131,6 +138,9 @@ func reverbolate(userid int64, honks []*Honk) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
h.Donks = h.Donks[:j]
|
h.Donks = h.Donks[:j]
|
||||||
|
|
||||||
|
h.HTPrecis = template.HTML(h.Precis)
|
||||||
|
h.HTML = template.HTML(h.Noise)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -7,7 +7,7 @@ require (
|
||||||
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
|
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
|
||||||
humungus.tedunangst.com/r/go-sqlite3 v1.1.3
|
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
|
go 1.11
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -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.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 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.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…
Reference in New Issue