From acd96f17eec9fbc4458e4ca0923f7349d600cdc8 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Tue, 22 Oct 2019 02:02:36 -0400 Subject: [PATCH] bump htfilter --- fun.go | 26 +++++++++++++------------- go.mod | 2 +- go.sum | 2 ++ hoot.go | 4 ++-- markitzero_test.go | 1 - web.go | 4 +--- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/fun.go b/fun.go index 1834316..3f88a6b 100644 --- a/fun.go +++ b/fun.go @@ -91,11 +91,11 @@ func reverbolate(userid int64, honks []*Honk) { zap := make(map[string]bool) { - filt := htfilter.New() - filt.Imager = replaceimgsand(zap, false) - filt.SpanClasses = allowedclasses - p, _ := filt.String(h.Precis) - n, _ := filt.String(h.Noise) + var htf htfilter.Filter + htf.Imager = replaceimgsand(zap, false) + htf.SpanClasses = allowedclasses + p, _ := htf.String(h.Precis) + n, _ := htf.String(h.Noise) h.Precis = string(p) h.Noise = string(n) } @@ -180,9 +180,9 @@ func inlineimgsfor(honk *Honk) func(node *html.Node) string { } func imaginate(honk *Honk) { - imgfilt := htfilter.New() - imgfilt.Imager = inlineimgsfor(honk) - imgfilt.String(honk.Noise) + var htf htfilter.Filter + htf.Imager = inlineimgsfor(honk) + htf.String(honk.Noise) } func translate(honk *Honk, redoimages bool) { @@ -211,11 +211,11 @@ func translate(honk *Honk, redoimages bool) { if redoimages { zap := make(map[string]bool) { - filt := htfilter.New() - filt.Imager = replaceimgsand(zap, true) - filt.SpanClasses = allowedclasses - p, _ := filt.String(honk.Precis) - n, _ := filt.String(honk.Noise) + var htf htfilter.Filter + htf.Imager = replaceimgsand(zap, true) + htf.SpanClasses = allowedclasses + p, _ := htf.String(honk.Precis) + n, _ := htf.String(honk.Noise) honk.Precis = string(p) honk.Noise = string(n) } diff --git a/go.mod b/go.mod index 6d975a7..e28cd86 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,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.17 + humungus.tedunangst.com/r/webs v0.6.18 ) go 1.11 diff --git a/go.sum b/go.sum index 1ffb487..83fe4f5 100644 --- a/go.sum +++ b/go.sum @@ -36,3 +36,5 @@ humungus.tedunangst.com/r/go-sqlite3 v1.1.3 h1:G2N4wzDS0NbuvrZtQJhh4F+3X+s7BF8b9 humungus.tedunangst.com/r/go-sqlite3 v1.1.3/go.mod h1:FtEEmQM7U2Ey1TuEEOyY1BmphTZnmiEjPsNLEAkpf/M= humungus.tedunangst.com/r/webs v0.6.17 h1:d9kyIeS9lRinJrToI+7O6SUUiE/dSI7ke1T/Kmbm70A= humungus.tedunangst.com/r/webs v0.6.17/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps= +humungus.tedunangst.com/r/webs v0.6.18 h1:5bho2umHAyT+DUTxbO9pCB3nETvuT7dgcc+3/voopTY= +humungus.tedunangst.com/r/webs v0.6.18/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps= diff --git a/hoot.go b/hoot.go index dd1e714..6624f68 100644 --- a/hoot.go +++ b/hoot.go @@ -78,7 +78,7 @@ func hootfixer(r io.Reader, url string) string { wanted := wantmatch[1] var buf strings.Builder - filt := htfilter.New() + var htf htfilter.Filter fmt.Fprintf(&buf, "%s\n", url) for _, div := range divs { twp := div.Parent.Parent.Parent @@ -97,7 +97,7 @@ func hootfixer(r io.Reader, url string) string { if author != wanted { continue } - text := filt.TextOnly(div) + text := htf.TextOnly(div) text = strings.Replace(text, "\n", " ", -1) text = strings.Replace(text, "pic.twitter.com", "https://pic.twitter.com", -1) diff --git a/markitzero_test.go b/markitzero_test.go index db0e912..d5a6b7a 100644 --- a/markitzero_test.go +++ b/markitzero_test.go @@ -76,4 +76,3 @@ func TestImagelink(t *testing.T) { output := `an image caption and linked ` doonezerotest(t, input, output) } - diff --git a/web.go b/web.go index 3c3d576..1f94576 100644 --- a/web.go +++ b/web.go @@ -34,7 +34,6 @@ import ( "github.com/gorilla/mux" "humungus.tedunangst.com/r/webs/cache" "humungus.tedunangst.com/r/webs/css" - "humungus.tedunangst.com/r/webs/htfilter" "humungus.tedunangst.com/r/webs/httpsig" "humungus.tedunangst.com/r/webs/image" "humungus.tedunangst.com/r/webs/junk" @@ -572,11 +571,10 @@ func showuser(w http.ResponseWriter, r *http.Request) { u := login.GetUserInfo(r) honks := gethonksbyuser(name, u != nil && u.Username == name, 0) templinfo := getInfo(r) - filt := htfilter.New() templinfo["Name"] = user.Name whatabout := user.About whatabout = markitzero(user.About) - templinfo["WhatAbout"], _ = filt.String(whatabout) + templinfo["WhatAbout"] = template.HTML(whatabout) templinfo["ServerMessage"] = "" templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) honkpage(w, u, honks, templinfo)