Author: Adam <git@apiote.xyz>
unescape HTML entities
go.mod | 5 ++++- go.sum | 2 ++ gonk.go | 6 +++++-
diff --git a/go.mod b/go.mod index 59aa03df3a0873d3f0f5292bc33c5c85db101131..b75dd541de32bda161d3234a6d8c517a39fc6770 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,7 @@ module notabug.org/apiote/gonk go 1.18 -require gitea.com/lunny/html2md v0.0.0-20181018071239-7d234de44546 +require ( + gitea.com/lunny/html2md v0.0.0-20181018071239-7d234de44546 + golang.org/x/net v0.0.0-20220607020251-c690dde0001d +) diff --git a/go.sum b/go.sum index 575d442dc3831cd34e5b926b966793d24832cc0e..70d141ccc1ac958cc37d5cfa204ef41878debd48 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,4 @@ gitea.com/lunny/html2md v0.0.0-20181018071239-7d234de44546 h1:3NO55alTul/szd/Iq0dBHYjXlYXYAYaokmQ56XZZXD0= gitea.com/lunny/html2md v0.0.0-20181018071239-7d234de44546/go.mod h1:6uRHlQWwXQ24vAtVfvO4dsM+xRQSeUkl6xGmzb0HPEw= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d h1:4SFsTMi4UahlKoloni7L4eYzhFRifURQLw+yv0QDCx8= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= diff --git a/gonk.go b/gonk.go index 501d7f8f0b6fc6c463b1d50aeb4f04e30619c7f1..40e11d17986da2200162d90dd8de04a30aee587a 100644 --- a/gonk.go +++ b/gonk.go @@ -3,7 +3,6 @@ import ( "encoding/json" "fmt" - "gitea.com/lunny/html2md" "io/ioutil" "log" "net/http" @@ -13,6 +12,10 @@ "os/exec" "regexp" "sort" "strings" + + "golang.org/x/net/html" + + "gitea.com/lunny/html2md" ) type Colour struct { @@ -176,6 +179,7 @@ broken := false honksNumber := len(honks.Honks) for i, honk := range honks.Honks { md := html2md.Convert(honk.Noise) + md = html.UnescapeString(md) md = changeA(md, colour) fmt.Printf(colour.White+"%d/%d\n%s %s %s (%s) \n%s\n\n"+colour.Reset, i+1, honksNumber, honk.Handle, honk.What, honk.Oondle, honk.Date, honk.XID) fmt.Printf("%s\n\n", md)